Jump to content

Recommended Posts

Posted

Is there a way to get information about the available screen size or panel of a browser? The size may change with different mobile phones and for sure with a desktop browser.

The information should be available during web form creation already to allow a layout adaption to the actual size.

 

BR

Uli

  • 9 months later...
Posted

You can use

ClientEvents->ExtEvents->OnResize

function window.OnResize(sender, width, height)
{
   ajaxRequest(sender, 'screensize', ['width='+width,'height='+height] );
}

And do what ever you want in the form implementing OnAjaxEvent of the form

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if(EventName='screensize') Then Caption:=Params.Values['width'];
End;

  • Like 1
  • Upvote 1
  • 2 weeks later...
  • 5 years later...
  • 11 months later...
Posted
On 8/22/2013 at 11:25 PM, TNT23 said:

You can use

ClientEvents->ExtEvents->OnResize


function window.OnResize(sender, width, height)
{
   ajaxRequest(sender, 'screensize', ['width='+width,'height='+height] );
}

And do what ever you want in the form implementing OnAjaxEvent of the form


procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if(EventName='screensize') Then Caption:=Params.Values['width'];
End;

Does not have effect.

  • 6 months later...
Posted
On 8/22/2013 at 5:25 PM, TNT23 said:

You can use

ClientEvents->ExtEvents->OnResize


function window.OnResize(sender, width, height)
{
   ajaxRequest(sender, 'screensize', ['width='+width,'height='+height] );
}

And do what ever you want in the form implementing OnAjaxEvent of the form


procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TStrings);
begin
  if(EventName='screensize') Then Caption:=Params.Values['width'];
End;

This still is working perfectly (at least for mobile applications),

×
×
  • Create New...