Freeman35 Posted May 1, 2018 Share Posted May 1, 2018 Hello, I need set form size to browser's size, so I'll center panel or set position of panel on form. When enduser change browser size I wanna handle it so my setposition procedure will trigger. Any solution abot this? Thank you. window.onresize = function(){ if (typeof FRM_Login !== 'undefined') { var getSize = Ext.getBody().getViewSize(), winWidth = getSize.width, winHeight = getSize.height; ajaxRequest('FRM_Login', 'benden', [ 'width='+winWidth,'height='+winHeight]); } } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 1, 2018 Share Posted May 1, 2018 Hello, Maybe you should use it on the client side like in your old post?: http://forums.unigui.com/index.php?/topic/8677-in-uniloginformcreate-uniapplicationscreenwidth-s-value-is-0/&do=findComment&comment=44992 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 1, 2018 Share Posted May 1, 2018 ajaxRequest(FRM_Login, 'benden', [ 'width='+winWidth,'height='+winHeight]); Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted May 1, 2018 Author Share Posted May 1, 2018 Thank you for help, window.onresize = function(){ if (typeof FRM_Login !== 'undefined') { var getSize = Ext.getBody().getViewSize(), winWidth = getSize.width, winHeight = getSize.height; FRM_Login.window.setPosition(0, 0); FRM_Login.window.setSize(winWidth, winHeight); ajaxRequest(FRM_Login, 'benden', [ 'width='+winWidth,'height='+winHeight]); } } This code work for me what I want. Need little bit improve. 1- When on first run, I mean onshow, not work, if and user change browser size then trigger. "WindowsState:= wsMaximized" correct this and its work goot for me. 2- ajaxRequest create error. "Event benden, Object undefined not found in session list. it could be timed out, refresh page and try again" Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 1, 2018 Share Posted May 1, 2018 Can you make a simple testcase ?! Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted May 1, 2018 Author Share Posted May 1, 2018 Sure, I did what I want, but event so many time triggered, so panel move like a animation Code need a magic finger touch Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted May 1, 2018 Author Share Posted May 1, 2018 I added test case. Please check, when resize browser, scripts working know, if make resize quickly and long time, when relase mouse button, U can see form's border different then browser's border. And then panel still continue moveing I think best event is, when finish resize (not sure afterxxxx). I added "UniApplication.ScreenWidth" label too. Its always zero. I wrote to Farshad and his answer is: UNG-2465 "TUniApplication: ScreenWidth and ScreenWidth should be initialized earlier." has been changed to a status of Resolved didn't understand this. Is mean "should be initialized earlier." we have to set? Its not get it from browser? thank you. to Farshad: If form's WindowsState set to wsMaximized (InDesign time) when form creating, forms width& height setting to browser width & heigh, can be handle this? so set TUniApplication: ScreenWidth and TUniApplication: ScreenHeight ? just Idea Project1.7z Quote Link to comment Share on other sites More sharing options...
Freeman35 Posted May 9, 2018 Author Share Posted May 9, 2018 Fixed in 1454 UniLoginFormScreenResize(Sender: TObject; AWidth, AHeight Integer); begin Self.Width:= AWidth; Self.Height:= AHeight; PAN_1.Left:= (AWidth - PAN_1.Width)div 2; PAN_1.top:= (AHeight - PAN_1.Height)div 2; Thank you 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.