Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Two pages one for desktop and one for mobile
Tue, Dec 18 2018 7:46 PMPermanent Link

KimHJ

Comca Systems, Inc

I have a single web page with labels and Edit boxes,

I would like to have a different layout if a user uses a mobile device.
Is it possible to have two layout with the same code and select the right one based on the device?

If possible how would I do it?

Thanks,
Kim
Tue, Dec 18 2018 10:34 PMPermanent Link

Raul

Team Elevate Team Elevate

On 12/18/2018 7:46 PM, KimHJ wrote:

> I would like to have a different layout if a user uses a mobile device.
> Is it possible to have two layout with the same code and select the right one based on the device?

EWB does have a responsive layout but i assume you need more capability
and separate UI.

How do you want to differentiate between devices - based on screen size
and/or some other criteria like mouse vs touch in terms of UI design ?

You can definitely load forms based on detecting device type but there
is bit extra work involved with code design - moving relevant code out
into common shared units and using it there etc.

> If possible how would I do it?

A super simple way would be to just modify your project file source
(menu Project->View Source) and then start whatever form is appropriate.

For example a super simple example code could be something like this -
it loads form frmSmall is browser window is less whathan 500 pixels wide
or if it's Android or iOS device. You can create your own rules.

begin
   Application.Title := 'My App';
   Application.LoadProgress := False;
   if (Application.ViewPort.Width < 500) or (Application.isIos) or
(Application.isAndroid) then
   begin
      Application.CreateForm(TFormSmall);
      Application.Run('frmSmall');
   end
   else
   begin
      Application.CreateForm(TfrmLarge);
      Application.Run('frmLarge');
   end;
end.


Raul
Tue, Jan 8 2019 11:25 PMPermanent Link

KimHJ

Comca Systems, Inc

>>Raul wrote:

For example a super simple example code could be something like this -
it loads form frmSmall is browser window is less whathan 500 pixels wide
or if it's Android or iOS device. You can create your own rules.

begin
   Application.Title := 'My App';
   Application.LoadProgress := False;
   if (Application.ViewPort.Width < 500) or (Application.isIos) or
(Application.isAndroid) then
   begin
      Application.CreateForm(TFormSmall);
      Application.Run('frmSmall');
   end
   else
   begin
      Application.CreateForm(TfrmLarge);
      Application.Run('frmLarge');
   end;
end.<<

Thanks Raul just back from vacation.

Kim
Image