![]() |
stringgrid fixedcol oder fixedrow klick
hi :) , wie kann ich per klick oder doppelklick die fixedRow oder fixedCol ansprechen
zum Bsp. für den inhalt eines stringgrid zu sortieren oder ähnliches... |
AW: stringgrid fixedcol oder fixedrow klick
Ein spontaner Ansatz:
Delphi-Quellcode:
procedure TFormTest.StringGridMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var ACol, aRow: integer; begin if Button = mbLeft then begin StringGrid.MouseToCell(X, Y, ACol, ARow); if (ACol < StringGrid.FixedCols) or (ARow < StringGrid.FixedRows) then ShowMessage('Fixe Zelle'); end; end; |
AW: stringgrid fixedcol oder fixedrow klick
Hallo,
vielleicht sollte man noch die -1 berücksichtigen, die in ACol und ARow geliefert wird, wenn der Klick etwas außerhalb des "tatsächlich gezeichneten" Grids liegt.
Delphi-Quellcode:
Gruß
if (ACol > -1) and ((ACol < StringGrid.FixedCols) or (ARow < StringGrid.FixedRows)) then
ShowMessage('Fixe Zelle') |
AW: stringgrid fixedcol oder fixedrow klick
Einverstanden, aber wieso nur auf einer Achse?
|
AW: stringgrid fixedcol oder fixedrow klick
Hallo,
wenn der Klick außerhalb "tatsächlich gezeichneten" Grids liegt (egal welche Richtung), dann liefert ACol und ARow immer -1 (zumindest mit XE4 und vermutlich auch davor). Gruß |
AW: stringgrid fixedcol oder fixedrow klick
Ich sollte mir wirklich abgewöhnen, am Smartphone zu antworten, das war mir später auch durch den Kopf geschossen, alles andere wäre ja auch Blödsinn :)
|
AW: stringgrid fixedcol oder fixedrow klick
Hallo,
Zitat:
Gruß |
AW: stringgrid fixedcol oder fixedrow klick
uii, danke schön. :)
hab mir heut morgen auf m rad so überlegt das mit Mouse.CursorPos zu realisieren ... aber die ganze rechnerei ist bestimmt keine gute idee für die cpu ,oder?? jetzt muss ich nur noch so kleinen pfeil (für sortierung) auf die fixed col bringen ... könnt ich das mit (code unten) auch realisieren???
Code:
if ( 4 = vari ) and (bearbMod = 1) and (MRow >= form5.StringGrid1.FixedRows) then begin
form5.StringGrid1.Perform(WM_CANCELMODE, 0, 0); R := form5.StringGrid1.CellRect(MCol, MRow); org := form5.StringGrid1.ScreenToClient(form5.StringGrid1.ClientToScreen(R.TopLeft)); with form5.ComboBox1 do begin SetBounds(org.X, org.Y, R.Right-R.Left, form5.Stringgrid1.Height); ItemIndex := Items.IndexOf(form5.StringGrid1.Cells[MCol, MRow]); Show; BringToFront; SetFocus; DroppedDown := true; end; end else begin form5.ComboBox1.Visible:=false; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:29 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-2025 by Thomas Breitkreuz