Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Button Name durch 11x11 Matrix abhängig machen (https://www.delphipraxis.net/105527-button-name-durch-11x11-matrix-abhaengig-machen.html)

Blackstar 23. Dez 2007 18:05


Button Name durch 11x11 Matrix abhängig machen
 
Ich hab eine 11x11 Matrix in der werte gespeichert werden
hab die Buttons schon erstellt

im Format: "ButtonX_Y" wobei X und Y für die zahlen 0-10 stehen
wie spreche ich einen dieser buttons an ohne in direkt zu bezeichnen?

zB mit einer for-schleife

Code:
  for x:=0 to 11 do
    for y:=0 to 11 do begin

buttonx_y.caption:='irendwas';

    end;

Die Muhkuh 23. Dez 2007 18:12

Re: Button Name durch 11x11 Matrix abhängig machen
 
Hi,

Hier im Forum suchenFindComponent, Delphi-Referenz durchsuchenFindComponent

Hador 23. Dez 2007 18:28

Re: Button Name durch 11x11 Matrix abhängig machen
 
Ich würde sie lieber dynamisch in einem zweidimensionalen Array of TButton erzeugen. Dann kannst du sie ganz einfach mit Name[x][y] ansprechen.

Blackstar 23. Dez 2007 18:50

Re: Button Name durch 11x11 Matrix abhängig machen
 
TButton(FindComponent('Button' + inttostr(x)+'_'+inttostr(y))).Caption := '0';

funktioniert für meine bedürfnisse, danke


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:51 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz