Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Stringgrid markiert (https://www.delphipraxis.net/4027-stringgrid-markiert.html)

[TP]Hawk274 11. Apr 2003 18:12


Stringgrid markiert
 
Ich habe sechs StringGrids auf meinem Formular. Wie kann ich nun ermitteln ob eines dieser Stringgrid markiert ist.
Folgenden Lösungsansatz habe ich gewählt.
Delphi-Quellcode:
var
  iLoop: Integer;
  sgTemp: TStringGrid;
begin
  //besitzt ein Stringgrid den Fokus
  sgTemp := nil;
  for iLoop := 0 to Panel1.ControlCount-1 do
  begin
    if( Panel1.Controls[ iLoop ] is TStringGrid ) then
    begin
      if( TStringGrid(Panel1.Controls[ iLoop ]).Focused ) then
      begin
        sgTemp := TStringGrid(Panel1.Controls[ iLoop ]);
        Break;
      end;
    end;
  end;
  if( sgTemp = nil ) then
  begin
    InfoMsg('Kein Grid ausgewählt!');
    Exit;
  end;
end;
Bin mir aber sicher das dieses einfacher geht. Doch finde ich im Moment keine andere Lösung. Gibt es noch eine weitere? Kann man vielleicht die Klasse vom aktuellen fokusierten Objekt heraus finden? Ich weiß zumindestens nicht wie man heraus bekommt welches Objekt zur Zeit den Fokus hat ...

roderich 11. Apr 2003 19:12

probiers mal mit ActiveControl


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:12 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