Autor Beitrag
Terra
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 307

Windows 7 Ultimate
Delphi® XE3
BeitragVerfasst: Mo 20.03.06 10:01 
Servus zusammen,

kann mir einer veraten, wie ich aus einem TButtonGroup erstellte Buttons abfragen kann ?

Hab das Problem, das ich ein leeres ButtonGroup erstellt habe und mittels eines Arrays den Inhalt hineinkopiert habe. Jetzt stehen zwar die Strings in der ButtonGroup aber ich weis net, wie man die Buttons abruft.
Kennt da jemand ein Befehl ?

ButtonGoup1.Items. ....

Terra
Terra Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 307

Windows 7 Ultimate
Delphi® XE3
BeitragVerfasst: Mi 22.03.06 11:13 
Ich schieb jetzt einfach mal, da mein Problem anscheinend untergeht.....

Terra
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: Mi 22.03.06 23:57 
Hallo,

was meinst Du mit "Buttons abrufen"?

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

Windows 7 Ultimate
Delphi® XE3
BeitragVerfasst: Fr 24.03.06 10:36 
Wenn ich in einem Form die Componennte TButtonGroup einfüge und dort neue "Buttons" erstelle. Diese Buttons, die dann in dem Feld erscheinen ... wie kann ich die einzeln abfragen ob ein Button angeklickt wurde ?

Terra
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 24.03.06 12:22 
Hallo,

im OnClick-Event der ButtonGroup:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.ButtonGroup1Click(Sender: TObject);
var p : TPoint;
    i : Integer;
begin
  GetCursorPos(p);
  p := ButtonGroup1.ScreenToClient(p);
  i := ButtonGroup1.IndexOfButtonAt(p.x,p.y);
  if i <> -1 then
    Showmessage('Geklickt wurde der Button mit dem Index: '
                 +IntToStr(i));
end;


Wenn Du für alle Items der ButtonGroup eine Ereignis-Behandlungs-Routine einbaust, könnte es so aussehen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.ButtonGroup1AlleItemClick(Sender: TObject);
var p : TPoint;
    i : Integer;
begin
  GetCursorPos(p);
  p := ButtonGroup1.ScreenToClient(p);
  i := ButtonGroup1.IndexOfButtonAt(p.x,p.y);
  if i <> -1 then
    case i of
      0 : TuDies;
      1 : TuDas;
    //...
    end;
end;


Eine andere Möglichkeit kenne ich (noch) nicht.

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

Windows 7 Ultimate
Delphi® XE3
BeitragVerfasst: Fr 24.03.06 12:25 
Supigummigut... vielen Dank !

Werds mal ausprobieren.

Terra