Autor Beitrag
aXiEd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Sa 22.01.05 12:31 
Ich hab für ein Programm ein Options-Form erstellt. Wenn man auf 'Options' klickt, dann wird dieses Form visible, bei OK oder Cancel wieder invisible. Nun will ich wissen wie man verhindern kann, dass der User wieder auf das Main-Form des Programms zurückgreifen kann.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Sa 22.01.05 12:40 
ausblenden Delphi-Quelltext
1:
2:
OptionsForm.ShowModal; // zum Anzeigen
OptionsForm.Hide;  // zum verstecken


Also nicht mit OptionsForm.visible arbeiten :)


MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
aXiEd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Sa 22.01.05 13:08 
Das klappt soweit ganz gut, nur jetzt besteht das Problem dass das Main-Frame nicht mehr reagiert wenn ich das Options-Frame 'hide'. :( ShowModal vom Main-Frame ergibt ne Fehlermeldung dass man ein sichtbares Frame nicht 'ShowModal'n kann...
Radioactive
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179

Win 98, Win XP Home SP2
D3 Prof, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 22.01.05 14:05 
Wenn du die OptionsForm mit OptionForm.ShowModal; geöffenet hast, schließt du sie wieder mit Close;. Dann kehrt das Programm automatisch wieder auf die MainForm zurück. Benutze nicht Hide.
aXiEd Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Sa 22.01.05 14:38 
OK funktioniert jetzt einwandfrei. :) Dankö
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 22.01.05 15:39 
Radioactive hat folgendes geschrieben:
Wenn du die OptionsForm mit OptionForm.ShowModal; geöffenet hast, schließt du sie wieder mit Close;. Dann kehrt das Programm automatisch wieder auf die MainForm zurück. Benutze nicht Hide.


alternativ kannst du auch ModalResult einen Wert <> 0 zuweisen... bzw deinem Button bei ModalResult einen Wert geben... dann könntest du auch mit

ausblenden Delphi-Quelltext
1:
if OptionForm.ShowModal = mrOK thenn Beep;					


arbeiten

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)