Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread TForm Constraints Not Working
Tue, Feb 23 2016 2:15 AMPermanent Link

Frederick Chin

I have a form with a height of 500 and width of 600 and I set the form's contraint.min.height to 500 and constraint.min.width to 600.

What I would like to do is to prevent the browser's viewport from being smaller than the form's dimensions.

I can't get the browser to respect my settings.

Frederick
Tue, Feb 23 2016 1:35 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< I have a form with a height of 500 and width of 600 and I set the form's contraint.min.height to 500 and constraint.min.width to 600.

What I would like to do is to prevent the browser's viewport from being smaller than the form's dimensions.

I can't get the browser to respect my settings. >>

You can't do what you're wanting to do.  There is no way to reject or cancel a browser resize event in any browser.  All you can do is have the viewport scroll, or have it resize to fit the browser window.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Feb 23 2016 9:08 PMPermanent Link

Frederick Chin

Tim,

/*
You can't do what you're wanting to do.  There is no way to reject or cancel a browser resize event in any browser.  All you can do is have the viewport scroll, or have it resize to fit the browser window.
*/

So, the constraints for controls are for design purposes while the Application's Surface constraints are to control the display of vertical and horizontal scrollbars?

Would it be possible to hide the browser's toolbars, resizing handles, URL bar, etc. so that all the user sees is the application itself? This is when the application is run from a phone or tablet.

Frederick
Wed, Feb 24 2016 12:01 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< So, the constraints for controls are for design purposes while the Application's Surface constraints are to control the display of vertical and horizontal scrollbars? >>

Kind of (you're close).  The Surface constraints act just like any other form/control constraint, and the Application.ViewPort.Overflow* properties control the browser's native scrollbars.  For example, you'll see in some of the example projects that we ship with EWB this code:

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

What we're doing here is saying: set the surface height constraint to slightly larger than the main form, and then make sure that the browser's vertical scrollbar is enabled in situations where the height of the surface exceeds the vertical size of the browser viewport.

<< Would it be possible to hide the browser's toolbars, resizing handles, URL bar, etc. so that all the user sees is the application itself? This is when the application is run from a phone or tablet. >>

It *is* possible in certain mobile environments like iOS, but EWB doesn't surface those meta tags at the present time.  I'll be doing some additions in this area (also, things like specifying the output file name for the HTML/JS files) by late spring/early summer, so they will be there soon.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Feb 25 2016 1:47 PMPermanent Link

Matthew Jones

Tim Young [Elevate Software] <timothyjamesyoung@gmail.com> wrote:
>
> << Would it be possible to hide the browser's toolbars, resizing handles,
> URL bar, etc. so that all the user sees is the application itself? This
> is when the application is run from a phone or tablet. >>
>
> It *is* possible in certain mobile environments like iOS, but EWB doesn't
> surface those meta tags at the present time.  I'll be doing some
> additions in this area (also, things like specifying the output file name
> for the HTML/JS files) by late spring/early summer, so they will be there soon.
>

If you are happy to make a custom browser, you can do it on the desktop
too. I took the Chromium libraries and did this. The EWB application can
have hidden text too, which the Delphi code can then see and auto-size
using, or otherwise pick up cues. Rather a special case though.


--
Matthew Jones
Image