wsv01 Posted July 2, 2019 Share Posted July 2, 2019 I know this has been covered several times, but I cannot seem to get it to work. Basically, I have an application with a menu on the main form. I have set the Server property of MainFormDisplayMode to mfPage. When the app runs, the main menu is perfect. When I resize the browser window it acts as expected. Now I want to create a form and when opened, act exactly like the main form. I've tried to set the WindowState to wsMaximized and when opened, it looks great, but when I resize the browser window, it just remains the same size. I'm new that this so I am most likely missing something very basic or is this harder than I expect? Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
wsv01 Posted July 3, 2019 Author Share Posted July 3, 2019 Is there a way to make a form behave the same way the main form behaves by using the mfPage type of property? I wish there was a mfPage property on a TUniForm. Quote Link to comment Share on other sites More sharing options...
Wilton Ergon Posted July 4, 2019 Share Posted July 4, 2019 does not exist by default, but if you use a frame, it will look the same Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted July 4, 2019 Share Posted July 4, 2019 procedure TUniForm.UniFormCreate(Sender: TObject); begin Self.Height:= UniApplication.ScreenHeight -40; Self.Width := UniApplication.ScreenWidth -200; and / or procedure TUniForm.xxxxxxFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin Self.Width := AWidth; Self.Height:= AHeight; maybe helpful to you. Quote Link to comment Share on other sites More sharing options...
wsv01 Posted July 4, 2019 Author Share Posted July 4, 2019 Freeman35, Thanks for the code. I tried that and it does resize the screen when opened, but when I resize the browser window, it does not resize the form. What I am trying to do is to have the window that is opened always be the full size of the browser window. wilton_rad, I think the frame idea only works on the main form. I tried frames in forms that I open from the main form and it does not seem to work for me. I looked at the demo layout - features and that does what I want, but that is all done from the main form. I need that same behavior from a form that is opened form the main form. If anyone could create a very simple app that does what I want, that would be great! Quote Link to comment Share on other sites More sharing options...
M.Ammar Posted September 23, 2019 Share Posted September 23, 2019 On 7/4/2019 at 2:48 PM, wsv01 said: Freeman35, Thanks for the code. I tried that and it does resize the screen when opened, but when I resize the browser window, it does not resize the form. What I am trying to do is to have the window that is opened always be the full size of the browser window. wilton_rad, I think the frame idea only works on the main form. I tried frames in forms that I open from the main form and it does not seem to work for me. I looked at the demo layout - features and that does what I want, but that is all done from the main form. I need that same behavior from a form that is opened form the main form. If anyone could create a very simple app that does what I want, that would be great! hi I actually needed the same today and after many tries I found that what you said "UniFormScreenResize only works on the main form" is true , based on that the solution is to resize the other form from the main form like that First Set the form WindowState to wsMaximized; in the main form where the form is created use this procedure TMainForm.ActionExecute(Sender: TObject); begin Lform := TYourform.Create(UniApplication); end; procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin if Assigned(Lform) then begin Lform.WindowState := wsNormal; Lform.Width := AWidth; Lfrom.Height := AHeight; end; end; Regards Quote Link to comment Share on other sites More sharing options...
wsv01 Posted September 23, 2019 Author Share Posted September 23, 2019 Thanks so much for the code, however, I'm not following a couple things. I guess I don't know too much on how this goes together. 1. The ActionExecute procedure. Is that a procedure name you made up or is it an event somewhere I cannot find? Do I just create a new procedure called ActionExecute? 2. The Lform object. Where is that coming from? 3. I'm assuming that the TYourform would be replaced by my actual form name. The way I open new windows from the main form is simply include them in the uses section, then call something like this to open them up. MyForm.ShowModal() Sorry for not understanding, but hopefully you can help me out. 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.