Autor Beitrag
Stoffel1984
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Di 10.08.04 09:27 
Hallo,

ich zeige in meinem Fenster ein anderes Fenster Modal an. Dieses modale Fenster ändert mir eine String-Variable im Mainform.
Nun... ich würde gerne auf die Variablenänderung zugreifen. Dies ist jedoch schwieriger als Gedacht.

Mit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  Form_Auswahl.ShowModal;
  if sAuswahl <> 'keine' then
  begin
    //Codeschnipsel
  end;


geht es nicht - da er mit nach ShowModal aus der procedure springt.
Das komische ist: Er springt manchmal komplett raus, manchmal ins OnActivate des Mainforms.

Hat jemand ne Idee wie ich das lösen könnte?

Danke,

Stoffel
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Di 10.08.04 09:34 
Sorry hat sich erledigt.
Er hatte mir den Code nach ShowModal wegoptimiert! :autsch:
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 10.08.04 16:14 
Es geht auch viel einfacher: ShowModal gibt einen Wert zurück. Wenn Du z.B. OK- und Abbrechen-Button auf dem Form hast, dann weise denen bei ModalResult mrOK bzw. mrCancel zu. Dann kannst Du mit
ausblenden Delphi-Quelltext
1:
 if Form.ShowModal=mrOK then...					

sehen, welcher Button gedrückt wurde.
Stoffel1984 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 219

Win NT, Win 2000
D6 Prof
BeitragVerfasst: Di 10.08.04 20:59 
Hallo,

ich kenne ShowModal. War nur relativ ungeeignet, da ich Stringvariablen aus einer ComboBox ans Mainform zurück liefere.
Ansonsten ist ModalReasult ne feine Sache ;)

Stoffel