Autor Beitrag
Andreas L.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 19.01.03 14:17 
Hallo,
wenn auf meinen Form1 der RadioButton1 markiert wird und man auf Button1 klickt soll Form2 angezeigt werden. Wenn man jedoch RadioButton2 markiert und Button1 klickt soll Form3 angezeigt werden.

Wie stell ich das an. Ich hab mir das so vorgestellt:
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure Button1 (sender...)
begin
  if RadioButton1.clicked then form2.show
  if RadioButton2.clicked then form3.show
end;

Kann mir jemand helfen

Moderiert von user profile iconTino: Code-Tags hinzugefügt.
Andreas L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1703
Erhaltene Danke: 25

Windows Vista / Windows 10
Delphi 2009 Pro (JVCL, DragDrop, rmKlever, ICS, EmbeddedWB, DEC, Indy)
BeitragVerfasst: So 19.01.03 14:22 
Oh sorry, habs selbst gelöst:
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure Button1 (sender...)
begin
  if RadioButton1.checked then form2.show;
  if RadioButton2.checked then form3.show;
end;


Moderiert von user profile iconTino: Code-Tags hinzugefügt.
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: So 19.01.03 14:26 
Das ist ganz einfach:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.Button1Click(Sender: TObject);
begin
  if RadioButton1.Checked then
    begin
      Form2.Show;
    end
  else
    begin
      if RadioButton2.Checked then
        begin
          Form3.Show;
        end;
    end;
end;


Da fehlt jetzt noch die uses-Klausel:

ausblenden Quelltext
1:
uses Unit2, Unit3;					


Im Prinzip ist es so wie du es dort stehen hast, aber ich würde aus rein syntaktischen Gründen mit else versuchen.[/b]

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 20.01.03 13:59 
wieso denn "else"??

bei seinem Quellcode will er doch wenn der erste gechecked ist form2 öffnen und wenn der zweite gechecked ist form3 öffnen...
und wenn beide gechecked sind beide öffnen, was bei dir nicht der fall ist...

Fiji-Fighter
smiegel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 992
Erhaltene Danke: 1

WIN 7
D7 Prof., C#, RAD XE Prof.
BeitragVerfasst: Mo 20.01.03 14:02 
Hallo,

Zitat:

und wenn beide gechecked sind beide öffnen, ...


Wo steht das?

_________________
Gruß Smiegel
Ich weiß, daß ich nichts weiß, aber ich weiß mehr als die, die nicht wissen, daß sie nichts wissen. (Sokrates)
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Mo 20.01.03 17:09 
Also ich habe gelesen, wenn der RadioButton1 abgehakt ist und man Button1 klickt wird die Form2 angezeigt und wenn man RadioButton2 abhakt und Button1 klickt wird Form3 angezeigt.
D.h. else

Das Einzige was man noch ist, ist dass man eigentlich die zweite If-Abfrage weglassen kann und direkt nach else Form3 anzeigt.

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.
Raphael O.
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1596


VS 2013
BeitragVerfasst: Mo 20.01.03 19:09 
ups... :oops:
hatte nur den ersten Quelltext gelesen, wo es ohne else realisiert ist :oops:

Fiji-Fighter

P.S wenn ich in der Schule Posts mach bin ich anscheinend immer wetwas verstört ;)