Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Can't Scroll Form In Tablet
Mon, Jul 10 2017 10:53 PMPermanent Link

Frederick Chin

I have a form with a basic panel containing an edit box at the top. In a tablet running Android in portrait mode, the form's height is set to the viewport's height.

procedure TfrmMain.frmMainSize(Sender: TObject);
begin
  if Application.IsAndroid or Application.IsIOS then begin
     self.Width:=Application.ViewPort.Width;
     self.Height:=Application.ViewPort.Height;
  end;
end;

When I click on the edit box, the keyboard appears but the edit box is not visible and I can't tell what I am typing and the form does not respond to scrolling so that I can bring the edit box to view.

In the form's OnCreate event, I have added the following:-

procedure TfrmMain.frmMainCreate(Sender: TObject);
begin
  Application.ViewPort.OverflowY:=otAuto;
  with Application.Surface do begin
       Constraints.Min.Height:=(Self.Height+40);
       Background.Fill.Color:=clElevateFillGray;
  end;
end;

Shouldn't the OverflowY property handle automatic display of scroll bars and scrolling?

--
Frederick



Attachments: testcomp.zip
Tue, Jul 11 2017 12:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Shouldn't the OverflowY property handle automatic display of scroll bars and scrolling? >>

No, the Overflow* properties at the application level handle the overflow/scrolling for the application surface, which is equivalent to the <body> tag in plain HTML.  The sizing/layout of the Application.Surface are what control how the viewport scrollbars behave for the entire application in the browser:

https://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TApplication&prop=Surface

In short, the viewport=browser window and the surface=<body> tag.  Anything else is just a plain EWB control with normal scrolling behaviors.

By default, the application surface is set up to be responsive (Layout.Position=lpTopLeft, Layout.Stretch=lsBottomRight).  This means that, if you want your forms to be responsive, you don't need to do anything other than set up your forms to have the same type of layout.

EWB allows scrolling at 3 different levels - viewport, surface, and form/control.

If you just want the form to be scrollable so that you can get access to the edit control, then just:

1) Set the form's ScrollBars property to sbVertical.
2) Get rid of your OnSize event handler for the form.
3) Make sure your form's OnCreate event handler looks like this:

procedure TfrmMain.frmMainCreate(Sender: TObject);
begin
  with Application.Surface do begin
       Background.Fill.Color:=clElevateFillGray;
  end;
  if Application.IsAndroid or Application.IsIOS then begin
     begin
     Layout.Position:=lpTopLeft; // Make the form responsive
     Layout.Stretch:=lsBottomRight;
     end;
  end;
end;

You can set the form's Margins property if you want some gray space (from the application surface) showing around the edges.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Jul 12 2017 4:26 AMPermanent Link

Frederick Chin

Tim,

/*
No, the Overflow* properties at the application level handle the overflow/scrolling for the application surface, which is equivalent to the <body> tag in plain HTML.  The sizing/layout of the Application.Surface are what control how the viewport scrollbars behave for the entire application in the browser:

https://www.elevatesoft.com/manual?action=viewprop&id=ewb2&comp=TApplication&prop=Surface

In short, the viewport=browser window and the surface=<body> tag.  Anything else is just a plain EWB control with normal scrolling behaviors.

By default, the application surface is set up to be responsive (Layout.Position=lpTopLeft, Layout.Stretch=lsBottomRight).  This means that, if you want your forms to be responsive, you don't need to do anything other than set up your forms to have the same type of layout.

EWB allows scrolling at 3 different levels - viewport, surface, and form/control.

If you just want the form to be scrollable so that you can get access to the edit control, then just:

1) Set the form's ScrollBars property to sbVertical.
2) Get rid of your OnSize event handler for the form.
3) Make sure your form's OnCreate event handler looks like this:

procedure TfrmMain.frmMainCreate(Sender: TObject);
begin
  with Application.Surface do begin
       Background.Fill.Color:=clElevateFillGray;
  end;
  if Application.IsAndroid or Application.IsIOS then begin
     begin
     Layout.Position:=lpTopLeft; // Make the form responsive
     Layout.Stretch:=lsBottomRight;
     end;
  end;
end;

You can set the form's Margins property if you want some gray space (from the application surface) showing around the edges.
*/

Thanks! Your detailed explanation helped a lot.

My forms can now be scrolled correctly.

--
Frederick
Mon, Aug 14 2017 4:46 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

If I open the example application 'responsive layout' without changing anything and I deploy it to my server I notice that:

1° the layout is responsive with any webbrowser on my laptop

2° is not at all responsive on my smartphone (Samsung S8 edge)

give it a try   

www.ksvreunie.be

Any suggestion what the problem could be?

Paul Waegemans



Attachments: responsivelayout.jpg
Mon, Aug 14 2017 6:00 AMPermanent Link

Uli Becker

Paul,

> 2° is not at all responsive on my smartphone (Samsung S8 edge)

Unless I am missing something: the result looks as expected. What
exactly is wrong with the mobile layout?

Uli
Mon, Aug 14 2017 6:03 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Not sure what the problem is, but if it helps it works on my Samsung
Galaxy S7 Edge

Chris Holland
[Team Elevate]

On 14/08/2017 09:46, Paul Waegemans wrote:
> If I open the example application 'responsive layout' without changing anything and I deploy it to my server I notice that:
>
> 1° the layout is responsive with any webbrowser on my laptop
>
> 2° is not at all responsive on my smartphone (Samsung S8 edge)
>
> give it a try
>
> www.ksvreunie.be
>
> Any suggestion what the problem could be?
>
> Paul Waegemans
>
Mon, Aug 14 2017 10:22 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

Please start a new thread for new topics instead of appending them to the end of existing threads.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Aug 14 2017 10:27 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Paul,

<< 2° is not at all responsive on my smartphone (Samsung S8 edge) >>

The Samsung appears to be zoomed in.  Are you sure that you haven't adjusted the zoom level or messed around with the HTML that EWB generates ?  The HTML is where the mobile scaling settings are set to tell the mobile browser *not* to allow zooming of the application.

Tim Young
Elevate Software
www.elevatesoft.com
Image