Autor Beitrag
Solaris
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 33



BeitragVerfasst: Fr 20.04.07 10:59 
Hallo,

ich habe in meinem Stringgrid schon im OI die Options auf "goRowSelect" gestellt.
Nun ist es ja so, das mit der linken Maustaste die komplette Zeile markiert wird.
Könnt Ihr mir sagen was ich wo einstellen muss, dmait auch mit der rechten
Maustaste eine komplette Zeile markiert wird?

Danke schonmal im Voraus für die Hilfe.

mfg
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 20.04.07 11:24 
Hallo,

das kann man imho nicht einstellen.
Aber da hilft das Ereignis OnMouseDown des StringGrids weiter.
Die vom Ereignis gelieferten Koordinaten-Werte X und Y können mittels MouseToCell in Zellkoordinaten umgerechnet werden. Dann halt noch die entsprechende Zeile markieren.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Solaris Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 33



BeitragVerfasst: Fr 20.04.07 11:53 
Danke für den Tipp mit Mouse ToCell.

Mit OnMouseDown habe ich auch schon etwas experimentiert...

user profile iconLannes hat folgendes geschrieben:
Dann halt noch die entsprechende Zeile markieren.

Kansnt du mir evtl. nen Codebeispiel dafür geben?
Muss ich mir da die Zeile ausgeben lassen und "manuell" jede Zelle in dieser Zeile markieren?


mfg
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Fr 20.04.07 12:12 
Hallo,

wenn in Options goRowSelect enthalten ist reicht eine Zuweisung an Row.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
var c,r : Integer;
//...
StringGrid.MouseToCell(X,Y,c,r);
StringGrid.Row := r;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )