Daniel Br Posted April 26, 2021 Share Posted April 26, 2021 Hello friends. Im using Unigui 1.90.0.1530 Trial Edition on Delphi 10.2 Tokio. I would like to know how to keep the forms with 100% of width and height when I resize the browser. Im using AlignmentClient and vbox layout. It works perfectly just in the main Form. But if I show another form (form.show or form.showmodal) doesn´t work anymore. I tried to use onScreenResize Event, but just works in the Main Form too. I could not find anything about this in the Unigui examples. How can I do it? Please, could you help me? Thanks. Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted April 28, 2021 Share Posted April 28, 2021 On 4/26/2021 at 10:31 PM, Daniel Br said: Hello friends. Im using Unigui 1.90.0.1530 Trial Edition on Delphi 10.2 Tokio. I would like to know how to keep the forms with 100% of width and height when I resize the browser. Im using AlignmentClient and vbox layout. It works perfectly just in the main Form. But if I show another form (form.show or form.showmodal) doesn´t work anymore. I tried to use onScreenResize Event, but just works in the Main Form too. I could not find anything about this in the Unigui examples. How can I do it? Please, could you help me? Thanks. Hi, it is not the best solution but I had to do this for only one form in my application, it will be difficult if you have to do this for all other forms : I have created a LocalResize in the form and then call it on main form screen resize; procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin if Assigned(LfraHomeDashBoard) then LfraHomeDashBoard.LocalResize(AWidth, AHeight); end; Quote Link to comment Share on other sites More sharing options...
Petrov Dmytro Posted April 28, 2021 Share Posted April 28, 2021 You can do it like this (code for LoginFrm). Insert here --> LoginFrm.Script function doOnResizeChange() { if (typeof LoginFrm !== 'undefined') { var winWidth = window.innerWidth, winHeight = window.innerHeight; LoginFrm.window.setPosition(0, 0); LoginFrm.window.setSize(winWidth, winHeight); } } function doOnOrientationChange() { setTimeout(doOnResizeChange, 1000); } window.addEventListener('orientationchange', doOnOrientationChange); window.addEventListener('resize', doOnResizeChange); setTimeout(doOnResizeChange, 10); Quote Link to comment Share on other sites More sharing options...
irigsoft Posted April 29, 2021 Share Posted April 29, 2021 Hello, I use this fo resize mainform and Topform procedure SetFormSize (SelForm : TUniForm); var ClientWidth, ClientHeight : Integer; begin SelForm.Left := 0; SelForm.Top := 0; //Get Screen Size ClientWidth := UniSession.UniApplication.ScreenWidth; ClientHeight := UniSession.UniApplication.ScreenHeight; //Set Data SelForm.Width := ClientWidth; SelForm.Height := ClientHeight; {if (uniMainModule.AppPlatform <> [upDesktop]) AND (AnsiUpperCase (UniServerModule.SistemSettingsList.Values ['useAndroidPOS']) <> 'TRUE') then begin SelForm.WindowState := wsNormal; SelForm.Left := 0; SelForm.Top := 0; ClientWidth := UniSession.UniApplication.ScreenWidth; ClientHeight := UniSession.UniApplication.ScreenHeight; if UniSession.FormsList.Count <= 1 then exit; if (ClientWidth < FormMinWidth) then ClientWidth := TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Width; if (ClientHeight < FormMinHeight) then ClientHeight := TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Height; if ClientWidth < FormMinWidth then ClientWidth := FormMinWidth; if ClientHeight < FormMinHeight then ClientHeight := FormMinHeight; if ClientWidth < SelForm.Width then ClientWidth := SelForm.Width; if ClientHeight < SelForm.Height then ClientHeight := SelForm.Height; SelForm.Width := ClientWidth; SelForm.Height := ClientHeight; end; } SelForm.Repaint;//Set MainForm Size form_general.Left := 0; form_general.Top := 0; form_general.Width := SelForm.Width; form_general.Height := SelForm.Height; form_general.Invalidate; //Set Top form size TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Height := SelForm.Height; TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Width := SelForm.Width; TUniForm (UniSession.FormsList [UniSession.FormsList.Count - 1]).Invalidate; end; procedure TForm_General.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin //activate resize forms if EventName = 'resize' then begin SetFormSize (Self); end; end; 1 Quote Link to comment Share on other sites More sharing options...
Daniel Br Posted April 29, 2021 Author Share Posted April 29, 2021 Hi, Petrov Dmytro Thank you so much for your answer. You helped me a lot. I will try the others suggestion. Thanks, as well. 😁 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.