Autor Beitrag
DaRee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.12.07 15:13 
Tag,

ich habe das problem, dass ich gerne ein Porgramm machen möchte, wo man über RadioGroups die caption des buttons ändert und der dann erkennt welche form er öffnen soll. Soweit so gut. Nur habe ich das problem, wenn ich Einen punkt in der erste RadioGroup anklicke, kann ich keinen in der zweiten anklicken aber umgekehrt ist es nicht der fall. Ich habe mir folgendes überlegt...das klappt aber nicht so ganz...


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
procedure TForm2.ThemenKlick(Sender: TObject);
begin
 if RadioGroup1.ItemIndex = 0 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 1 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 2 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 3 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 4 then RadioGroup2.ItemIndex := -1;
 case RadioGroup1.ItemIndex of
  0 : Button1.Caption := 'Grundlagen Anzeigen';
  1 : Button1.Caption := 'Algebra Anzeigen';
  2 : Button1.Caption := 'Analysis Anzeigen';
  3 : Button1.Caption := 'Numerische Mathematik Anzeigen';
  4 : Button1.Caption := 'Zahlentheorie Anzeigen';
 end// of Case

 if RadioGroup2.ItemIndex = 0 then RadioGroup1.ItemIndex := -1;
 if RadioGroup2.ItemIndex = 1 then RadioGroup1.ItemIndex := -1;
 if RadioGroup2.ItemIndex = 2 then RadioGroup1.ItemIndex := -1;
 if RadioGroup2.ItemIndex = 3 then RadioGroup1.ItemIndex := -1;
 if RadioGroup2.ItemIndex = 4 then RadioGroup1.ItemIndex := -1;
 case RadioGroup2.ItemIndex of
  0 : Button1.Caption := 'Arithmetik Anzeigen';
  1 : Button1.Caption := 'Einheiten Anzeigen';
  2 : Button1.Caption := 'Sonstiges Anzeigen';
  3 : Button1.Caption := 'Trigonometrie Anzeigen';
  4 : Button1.Caption := 'Zahlen und Zahlensystem Anzeigen';
 end// of Case
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mi 19.12.07 15:38 
user profile iconDaRee hat folgendes geschrieben:
Nur habe ich das problem, wenn ich Einen punkt in der erste RadioGroup anklicke, kann ich keinen in der zweiten anklicken


Das liegt bestimmt daran:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
 if RadioGroup1.ItemIndex = 0 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 1 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 2 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 3 then RadioGroup2.ItemIndex := -1;
 if RadioGroup1.ItemIndex = 4 then RadioGroup2.ItemIndex := -1;


Lg, Martin

_________________
Ein Nutzer der Ecke ;-)
DaRee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.12.07 15:42 
Danke für die antwort.

Dachte aber mit den zeilen, dass er, wenn etwas in der ersten gruppe betätigt wird, die zweite gruppe auf "null" setzt. Oder verstehe ich dich falsch?
Martin1966
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1068

Win 2000, Win XP
Delphi 7, Delphi 2005
BeitragVerfasst: Mi 19.12.07 15:44 
user profile iconDaRee hat folgendes geschrieben:
Dachte aber mit den zeilen, dass er, wenn etwas in der ersten gruppe betätigt wird, die zweite gruppe auf "null" setzt. Oder verstehe ich dich falsch?

Das ist korrekt. Aber ich dachte das willst du nicht haben? :guebel:

Jetzt ist es ja so: Wenn du in der RadioGroup1 etwas auswählst wird die Markierung in RadioGroup2 entfernt. Soll das so sein?

_________________
Ein Nutzer der Ecke ;-)
DaRee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.12.07 15:55 
Korrekt, nur kommt das problem auf, wenn ich nun versuche in gruppe 2 einen punkt auszuwählen, ist das nicht möglich. Tut mir leid, wenn ich mich etwas unklar ausgedrückt habe :)
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 19.12.07 16:07 
dann setze RadioGroup2.enabled auf True
PS: anzeigen schreibt man klein

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
DaRee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 19.12.07 16:26 
Danke für deine antwort Kroko, hab aber keine ahnung wie du das meinst.
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 19.12.07 17:02 
dann schau einfach mal im OI ob die Eigenschaft Enabled auf True gesetzt ist

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
SvenAbeln
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 334
Erhaltene Danke: 3



BeitragVerfasst: Mi 19.12.07 17:24 
Du unterscheidest gar nicht in welcher RadioGroup nun gerade etwas ausgewählt wurde.

Wenn du also erst etwas in RadioGroup1 auswählst wird alles richtig gesetzt. Aber beim Klick in RadioGroup2 wird diese Auswahl in den Zeilen 3-7 deiner Funktion direkt wieder gelöscht, obwohl der Anwender gar nichts mit RadioGroup1 gemacht hat.

Du könntest überprüfen welche RadioGroup der Anwender angeklickt hat mit:
ausblenden Delphi-Quelltext
1:
 if Sender=RadioGroup1 then					


Oder du teilst deine Funktion in zwei Teile, jeweils mit den Aktionen für eine einzelne RadioGroup.

Dann kannst du die jeweils andere RadioGroup löschen und die Caption von deinem Button setzten.