Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Mi 21.04.21 13:47 
Moin Forum,

wie komme ich in "StringGrid1CellClick(const Column: TColumn;const Row: Integer);" an die Daten die in dieser Zelle stehen?

Danke und Gruß,
Oliver

Moderiert von user profile iconTh69: Delphi-Tags hinzugefügt

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 22.04.21 07:29 
Ein TStringGrid hat das Event OnCellClick nicht. Das gibt es in einem TDBGrid.
Wenn du ein TStringGrid nutzt, wäre OnSelectCell das richtige Ereignis für dich. Dort bekommst du die Spalte und Zeile als Parameter geliefert. Über die Eigenschaft Cells des TStringGrid kommst du dann an die Inhalte der Zelle.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 22.04.21 10:53 
user profile iconjasocul hat folgendes geschrieben Zum zitierten Posting springen:
Ein TStringGrid hat das Event OnCellClick nicht. Das gibt es in einem TDBGrid.
Es geht offensichtlich (wenn man FMX kennt :mrgreen:) um Firemonkey. Dort gibt es das Event bei einem TStringGrid. ;-)

Das geht so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TFormX.StringGrid1CellClick(const Column: TColumn; const Row: Integer);
begin
  ShowMessage(StringGrid1.Cells[StringGrid1.ColumnIndex, Row]);
end;

Warum diese Information nicht in der Column steckt, weiß ich nicht...
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6386
Erhaltene Danke: 146

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 22.04.21 10:59 
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
user profile iconjasocul hat folgendes geschrieben Zum zitierten Posting springen:
Ein TStringGrid hat das Event OnCellClick nicht. Das gibt es in einem TDBGrid.
Es geht offensichtlich (wenn man FMX kennt :mrgreen:) um Firemonkey. Dort gibt es das Event bei einem TStringGrid. ;-)

FMX gab es schon in D2007? Lt. Profil von jjturbo ist das die höchste eingesetze Version.
Aber du hast natürlich Recht. Bei FMX gibt es das.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 22.04.21 14:08 
Da vertraue ich eher der Sachlage als den Angaben im Profil. 8)