form_background.sendtoback;form1.bringtofront;form2.bringtofront;
form_background.PopupMode := pmNone;....Form1.PopupMode := pmExplicit;Form1.PopupParent := Form_background;....Form2.PopupMode := pmExplicit;Form2.PopupParent := Form_background;
unit main;{$mode objfpc}{$H+}interfaceuses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, unit_system, interface_start_menu, interface_bottom_bar, interface_top_bar, interface_licence;type { Tform_main } Tform_main = class(TForm) procedure FormCreate(Sender: TObject); procedure show_form(called_form: TForm); private { private declarations } public { public declarations } end; var form_main: Tform_main; previous_form, current_form: TForm;implementation{$R *.lfm}{ Tform_main }procedure Tform_main.show_form(called_form: TForm);begin // update current and previous form. previous_form := current_form; current_form := called_form; // show current form, hide previous; previous_form.hide; current_form.show; current_form.popupparent:=form_main; current_form.popupmode:=pmExplicit; // show additional formsend;procedure Tform_main.FormCreate(Sender: TObject);begin previous_form := form_start_menu; current_form := form_licence; show_form(form_start_menu); form_main.width := screen.width; form_main.height := screen.height;end;end.
Well there are a few problems that I can see although I'm not very well versed on the flow of things in lazarus so I'm gonna just point your attention.1) is Show_form linked to the onformShow event of your form? if yes please unlink it otherwise its called twice.no, it is not... I only call it where you see it in the code2) popupMode and popupParent require a window recreation (on windows at least) so it is better to set it once when the form is created and leave it at that, there is not need to change every time the form is shown, better yet set it at design time and forget about it during run time.now I am working on linux... in any case, i first tried to set it in the object inspector, but it did not worked... so I tried to do it runtime 3) Stop calling show/hide from inside the creator set the visible property if you want just avoid calling those methods, they interrupt the normal flow raising various problems.I tried changing to form.visible:=true and form.visible:=false but it does not work all the sameregards
now I am working on linux
use form.fromstyle=fsStayonTop and then back to formstyle=fsNormal , it is VERY simple
ehr, what is a TCustomForm??because I did not see such a procedure for TForm...