Link to home
Start Free TrialLog in
Avatar of danz67
danz67Flag for Italy

asked on

Delphi - MainForm

I have two forms, FormAzienda and FormMain, the startup form and FormAzienda, after entering some values in open ShowModal the FormMain.
The problem is that if you iconify the FormMain, the FormAzienda can be seen in the background. I tried several ways but failed to close the FormAzienda.
Avatar of wimmeyvaert
wimmeyvaert

So, FormMain is your MainForm, and you open the FormAzienda as 'ShowModal'.

If so, then I don't understand how you can Minimize the MainForm before closing the FormAzienda.
When you show FormAzienda Modally, then you cannot click other forms before closing the FormAzienda.

Can you clarify a little bit please?
Thanks,

Wim.
Avatar of jimyX
Did you try to hide it ?

FormAzienda.hide;
Avatar of danz67

ASKER

Application.MainForm is FormAzienda
wimmeyvaert, I think that is the opposite  , danz67 please correct me if I'm wrong :
the main form is FormAzienda, some values are entered (like a login)
and then only Main form is displayed as modal

If so, I would recommend Hiding FormAzienda before showing MainForm, and re-show it after ShowModal , something like this


procedure TFormAzienda.btnGoMain(Sender:TObject);
begin
 Hide;
 MainForm.ShowModal;
 Show;
end;

Open in new window

You could also prevent MainFormof being Minimized.
Normally, when you show a form modally, you really need to close the formbefore you can continue.
So, better set the 'BorderIcons' property of the MainForm.
Set biMinimize and biMaximize to False.

Best regards,

Wim.
Avatar of danz67

ASKER

- wimmeyvaert:
The solution to hide the button I do not like, thanks.

- epasquier:
I attach pictures of what happens after writing HIDE


azienda.bmp
Avatar of danz67

ASKER

2 image
FormMain.bmp
Avatar of danz67

ASKER

3 image
result.bmp
hi

change the formStyle of mainform TO "fsNormal", both of them should be "fsNormal" in that kind of application system.

Mainform.formStyle := fsNormal;

You can change it in the form properties.
Avatar of danz67

ASKER

It's already to fsNormal
This behavior happens when you minimize any form that's not the main form.

What you can do is simply make FormMain your main form instead of FormAzienda then when you done with FormAzienda just close it (FormAzienda.close;)
That should fix your issue.
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial