2007. március 15., csütörtök
How to create only one instance of a MDI child form
Problem/Question/Abstract:
I want the form only to appear once on the user's desktop regardless of whether it has focus or not.
Answer:
procedure TfmMain.fmAboutClick(Sender: TObject);
begin
if not (ActiveMDIChild is TfmAboutBox) then
TfmAboutBox.Create(Application);
end;
procedure TfmMain.fmAboutClick(Sender: TObject);
var
myAbout: TfmAboutBox;
i: integer;
begin
for i := 0 to Screen.FormCount - 1 do
if (Screen.Forms[i] is TfmAboutBox) then
myAbout := Screen.Forms[i] as TfmAboutBox; {Form Exists}
if myAbout = nil then {didn't find it so create it...}
myAbout = TfmAboutBox.Create(Application);
myAbout.Show;
end;
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése