How to open a form behind an already opened Delphi form

Asked

Viewed 63 times

0

How did I open a form behind one another form already open? This form that is open have a time to close, when to close, I need the second form is open so modal.

2 answers

0

open normally and use the Sendtoback command to send back

 form.show; 
 form.SendToBack;
  • thanks for the tip, only that when closes the form that is in front it is going back from the main screen the second form

  • can make treatments to fix, tries to use Bringtofront in onClose

-1

Use the Popupmode and Popupparent property of forms.

Consider 3 Forms:
Main form is the main form;
Formbackend is the form that should be Modal and stay behind Formcadastro;
Formcadastro is the form that triggers FormBackend, but which must be above this FormBackend;

Consider that the call order of the forms will be:
Formmain -> Formregister -> Formbackend

Considers that the order in which the forms are submitted should be:
1 Formcadastro
2 Formbackend
3 Formprincipal

Use the properties PopupParent and PopupMode to resolve window order.

Here is a translation of the official documentation:

The estate Popupmode controls how the top level form behaves in relation to style WS_POPUP windows. A window that has the style WS_POPUP is always above its "owner" in Z order. You can use the property Popupmode together with the property Popupparent to avoid the appearance of an app caused by a modal dialogue appearing behind another on-screen form.

Read more in the official documentation: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Forms_TForm_PopupMode.html

Property changed in Formbackend:

PopupMode := pmExplicit;   
PopupParent := FormPrincipal;   

Property changed in Formcadastro:

PopupMode := pmExplicit;

Procedure changing order by Popupparent:

procedure TFormCadastro.butAtivarBackendClick(Sender: TObject);
begin
   FormCadastro.PopupParent :=  FormBackend;
   FormBackend.PopupMode:=pmAuto;
   FormBackend.ShowModal;
end;

Test project: Project test Popupparent

Browser other questions tagged

You are not signed in. Login or sign up in order to post.