Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread EWB2 for Mobile.
Tue, Apr 14 2015 10:49 PMPermanent Link

Steve Gill

Avatar

Is anyone using EWB2 for mobile applications?  If so, how do you cater for various screen sizes and orientations, and how do you detect the device?

Thanks.

= Steve
Wed, Apr 15 2015 4:14 AMPermanent Link

Matthew Jones

Steve Gill wrote:

> Is anyone using EWB2 for mobile applications?  If so, how do you
> cater for various screen sizes and orientations, and how do you
> detect the device?

Yes. From the advice posted by others before, this is what I do:

In the main form create:

   Application.Desktop.OnResize := DesktopResized;


Then

procedure TfrmMain.DoDesktopResized;
var
   nWidth : Integer;
   nHeight : Integer;
begin  
   try
       nWidth := Application.Desktop.Width;
       nHeight := Application.Desktop.Height;
....

You can then use this to detect orientation, and adjust positions etc.

Detecting devices is sort of easy. Android for example doesn't have the
OnChange for text edits, so you can't enable a button when the text
gets to 6 characters or more, for example. Just use the useragent to
see what the client says it is:

   if Pos('Android', window.navigator.useragent) > 0 then
       keyCheckTimer.Enabled := True;

Apart from that, I don't do any specific device detection as it pretty
much handles all you'd want.

Matthew
Wed, Apr 15 2015 12:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< Is anyone using EWB2 for mobile applications?  If so, how do you cater
for various screen sizes and orientations, and how do you detect the device?
>>

You can detect the device using the Application.IsAndroid and/or
Application.IsIOS properties.

You don't really need to detect the screen resizing directly, rather you
need to *respond* to the screen resizing by making your forms stretch to
fill the available space.

You should use the Stretch layout property to stretch controls *within*
containers as they resize, and use the containers as "blocks" that either
stretch or move below the container above it, depending upon the available
size.

I wish I could go into more detail, but I've got to finish this thing up, so
I'm a little time-constrained right now.

Tim Young
Elevate Software
www.elevatesoft.com



Wed, Apr 15 2015 1:09 PMPermanent Link

Jim Gallagher

Quick question.  I'm a new pre-order customer, so bear with me.  In Mathew's post he references Application.Desktop.  When I use that I get "Variable...Desktop does not exist".  Is Desktop obsolete in version2?  It is in the help, but I know that is a work in progress.

I just want to be sure I'm set up and configured correctly.

-Jim
Wed, Apr 15 2015 1:22 PMPermanent Link

Matthew Jones

Jim Gallagher wrote:

> Quick question.  I'm a new pre-order customer, so bear with me.  In
> Mathew's post he references Application.Desktop.  When I use that I
> get "Variable...Desktop does not exist".  Is Desktop obsolete in
> version2?  It is in the help, but I know that is a work in progress.

Tim renamed it to be more sensible for version 2, and if you search
back you will find it.

The help is currently v1 help.
Wed, Apr 15 2015 3:10 PMPermanent Link

Uli Becker

Jim,

it was renamed to TSurface.

Uli
Wed, Apr 15 2015 3:13 PMPermanent Link

Jim Gallagher

Uli Becker wrote:

>Jim,

>it was renamed to TSurface.

Thanks, Uli.
Wed, Apr 15 2015 6:58 PMPermanent Link

Steve Gill

Avatar

Thanks Tim and Matthew.

= Steve
Image