Jump to content

How to send ajaxRequest in this script?


Freeman35

Recommended Posts

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]);      
  }
}
Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...