Autor Beitrag
Flash106
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 234


D7 Ent
BeitragVerfasst: Di 16.05.06 12:51 
Hallo,

ich habe drei checkboxen und möchte wenn ich eine Anklicke die anderen abwählen. Durch das setzen von Checked wird aber wieder onClick aufgerufen. Ich renne quasie im kreis.. wie löse ich das ?? Hier mal das was ich meine:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TfrmRename.chbFrontClick(Sender: TObject);
begin
 chbBack.Checked := false;
 chbOverwrite.Checked := false;
end;

procedure TfrmRename.chbBackClick(Sender: TObject);
begin
  chbFront.Checked := false;
  chbOverwrite.Checked := false;
end;

procedure TfrmRename.chbOverwriteClick(Sender: TObject);
begin
 chbBack.Checked := false;
 chbFront.Checked := false;
end;


Is jetzt so das ich eine checkbox zwei mal anklicken muss.. will ich aba nicht.. soll gleich gehn!
DaKirsche
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 187

Win XP Pro, SuSe Linux 7.3 - 10.2, Win 2k3 Server, Win 2000, Win NT 4.0
Delphi 2006 Pro, Java, HTML, SQL, PHP, CSS
BeitragVerfasst: Di 16.05.06 12:55 
nimm doch radiobuttons und fasse diese in einer radiogroup zusammen....
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 16.05.06 12:56 
Flash106 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 234


D7 Ent
BeitragVerfasst: Di 16.05.06 13:01 
Perfekt Danke!
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: Di 16.05.06 14:21 
Hallo,

so ganz perfekt ist das noch nicht, denn wenn eine der Checkboxen den Focus hat und die Leertaste betätigt wird, lassen sich beide Checkboxen auf checked setzen.

Also noch in OnKeyPres der Checkboxen auf Leertaste prüfen und reagieren:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
//CheckBox1KeyPress(...
if Key = #32 then
  CheckBox2.State := cbUnchecked;
//...usw.

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