![]() |
AW: Komponente Stringgrid mit ComboBox
Liste der Anhänge anzeigen (Anzahl: 1)
Ich habe hier Zuhause leider nur ein 2010 er Delphi und hier funktioniert es problemlos. Falls sich niemand anderes findet um zu suchen, kann ich es morgen im Büro an einer VM mit D7 versuchen.
EDIT: Läuft auch unter D7 problemlos, dass der Beispielcode nur bei Column eine "Combobox" anzeigt hast Du gesehen?
Delphi-Quellcode:
if ACol = 2 then .....
|
AW: Komponente Stringgrid mit ComboBox
Zitat:
Naja ich werd dann wohl mit der Version unten vorlieb nehmene müssen und auf die flexiblere Laufzeiterstellung verzichten... Aber was gut ist, die Version läuft auch unter Lazarus. Trotzdem Danke für die Antworten.
Delphi-Quellcode:
{ StringGrid mit ComboBox }
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean); var CRect:TRect; begin if(ACol=1)then begin CRect:=StringGrid1.CellRect(ACol, ARow); inc(CRect.Left, StringGrid1.Left+2); inc(CRect.Right, StringGrid1.Left+2); inc(CRect.Top, StringGrid1.Top+2); inc(CRect.Bottom, StringGrid1.Top+2); ComboBox1.BoundsRect:=CRect; ComboBox1.Visible:=true; ComboBox1.ItemIndex:=integer(StringGrid1.Objects[ACol, ARow])-1; end else ComboBox1.Visible:=false; end; procedure TForm1.StringGrid1Exit(Sender: TObject); begin if not(ActiveControl=ComboBox1)then begin ComboBox1.Visible:=false; StringGrid1.Selection:= TGridRect(Rect(-1, -1, -1, -1)); end; end; procedure TForm1.ComboBox1Exit(Sender: TObject); begin if not(ActiveControl = StringGrid1)then begin ComboBox1.Visible:= false; StringGrid1.Selection:= TGridRect(Rect(-1, -1, -1, -1)); end; end; procedure TForm1.StringGrid1TopLeftChanged(Sender: TObject); var GRect:TGridRect; begin ComboBox1.Visible:= false; GRect:= StringGrid1.Selection; if(GRect.Left = 0) and (GRect.Right = 0)then begin inc(GRect.Left, 1); inc(GRect.Right, 1); end; StringGrid1.Selection:=GRect; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:00 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz