AMIT Posted July 13, 2011 Share Posted July 13, 2011 I create a test WebApplication and Set MainFormDisplayMode to mfWindow. I also set the position property of the MainForm to poDesktopCenter in order to make my MainForm Display in the center. If the browser windows size is bigger than my MainForm, every thing is look perfect. If the browser windows size is smaller than my MainForm, the top part of my MainForm is hidden because it lay outside the browser windows area. The problem is I can not drag my MainForm back to the browser window. Even there is a vertical scrollbar but the slider of the scrollbar is at the top already. So is it possible to have the MainForm displayed at the horizontal center only. Hope somebody can help, Thank in advance. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 13, 2011 Administrators Share Posted July 13, 2011 Set MainForm->MonitorScreenResize->True In MainForm OnScreenResize event recalculate Form Left, Top, Width and Height so it will fit and show in desired position. Quote Link to comment Share on other sites More sharing options...
AMIT Posted July 14, 2011 Author Share Posted July 14, 2011 Set MainForm->MonitorScreenResize->True In MainForm OnScreenResize event recalculate Form Left, Top, Width and Height so it will fit and show in desired position. I think it is better to let you have the picture of the output that I have so you can understand my problem easily. Please see the pictures attached. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 14, 2011 Administrators Share Posted July 14, 2011 There is no way to enable the scroll bars when Form top has a negative coordinate. There is no solution for this. It is either an Ext JS or a DOM limitation I'm not sure which one. So you must either adjust the coordinates yourself in OnScreenResize event or design your Form as maximized so Top bar will be always visible. TMainForm->MonitorScreenResize->True procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth, AHeight: Integer); begin if AHeight<Self.Height then begin Top:=1; Left:=1; end; end; In mfPage mode you must set AutoScroll->True to see the Scroll bars. I think best way is using mfPage mode + AutoScroll->True. Quote Link to comment Share on other sites More sharing options...
cristianotestai Posted July 14, 2011 Share Posted July 14, 2011 Hi, I have a question regarding the centralization of my main page. My purpose is to have the home centered on the user's browser, regardless of the resolution and screen size that is running, as is seen in most sites today, as an example: fifa.com, twitter.com, etc.. Attached below the image as an example, where in a display of 16.4 "appears perfectly, but in a lower resolution, the login panel is distorted to the right side. I tested the properties MonitorScreenResize and Position, but without success. I use MainFormeDisplayMode = mfPage. Tks. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 14, 2011 Administrators Share Posted July 14, 2011 If you want a screen object (a UniPanel for instance) to always remain in center of its parent just make it "Anchorless" Anchors -> [ ] In your markbook site I can see that you have a main panel (with rounded corners). Remove all of its Anchors and it will remain in center of screen regardless of screen resolution. BTW, cool site. Couldn't notice that it is an Ext JS / uniGUI site. Quote Link to comment Share on other sites More sharing options...
cristianotestai Posted July 15, 2011 Share Posted July 15, 2011 If you want a screen object (a UniPanel for instance) to always remain in center of its parent just make it "Anchorless" Anchors -> [ ] In your markbook site I can see that you have a main panel (with rounded corners). Remove all of its Anchors and it will remain in center of screen regardless of screen resolution. BTW, cool site. Couldn't notice that it is an Ext JS / uniGUI site. Thanks Farshad! I managed with Anchors .. Only the main page after login, where I have a panel to the top and some panels in the center and another panel at the bottom, I had some work to achieve the desired effects .. but it worked! Tks for the comment of the site .. Yes, it is UniGui(fantastic) with Delphi!! I'm also using DataSnap to the business classes and to encapsulate the database access. Best Regards.. 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.