Jump to content

Getting browser width with AJAX and EXT JS


elGringo

Recommended Posts

Didn't find any method in UniGUI how to get browser width, so decided to ask it right from Sencha EXT JS and transport through AJAX

 

MainForm > ClientEvents > OnActivate

function window.activate(sender, eOpts)
{
  var BrowserWidthValue=Ext.getBody().getViewSize().width; 
  ajaxRequest(sender, 'GetBrowserWidth', [ 'BrowserWidth='+BrowserWidthValue, 'param1=B' ]);
}

In MainForm

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings);
begin

 if EventName='GetBrowserWidth' then
  begin
    FBrowserWidth:=Params.Values['BrowserWidth'].ToInteger;
  end;

end;

But I'm not sure if Activate is best event for this

Link to comment
Share on other sites

Hi,

 

Also, you can use OnScreenResize event

procedure TMainForm.UniFormScreenResize(Sender: TObject; AWidth,
  AHeight: Integer);
begin
  // AWidth;
  // AHeight;
end;

Or

UniApplication.ScreenWidth;
UniApplication.ScreenHeight;

http://forums.unigui.com/index.php?/topic/6156-how-to-get-the-client-screen-resolution/

 

Best regards.

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...