Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Edit Control Causing Scrolling.
Fri, Jun 25 2021 9:09 PMPermanent Link

Steve Gill

Avatar

I have a form that has is longer than the vertical screen size, ie. the whole form doesn't fit on the screen.  It has scroll bars so the user can scroll the page.

On the bottom part of the form, there is an HTML form for the user to fill in.

When the application starts, the form scrolls to the first TEdit in the form and gives it focus.

To get around this I had to add a timer, and add the following to the OnTimer event:

  Timer1.Enabled := False;
  Application.Viewport.ScrollTop := 0;

Using Self.ScrollTop or frmMain.ScrollTop doesn't work.

My question is, is there another way to do this that doesn't involve a timer?

Using this code in the Form's OnShow event doesn't work.  

It would be great if there was an event that fired when everything had finished loading.

Thanks.

= Steve
Sat, Jun 26 2021 7:22 AMPermanent Link

StewCam

To scroll the form to the top you could try calling scroll asynchonously using a procedure. Have a look at the post by Raul:
https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=10455#10455

>Steve Gill wrote:
>
>I have a form that has is longer than the vertical screen size, ie. the whole form doesn't fit on the screen.  It has scroll bars so the user can scroll the page.
>
>On the bottom part of the form, there is an HTML form for the user to fill in.
>
>When the application starts, the form scrolls to the first TEdit in the form and gives it focus...
Tue, Jun 29 2021 1:20 AMPermanent Link

Steve Gill

Avatar

<< To scroll the form to the top you could try calling scroll asynchonously using a procedure. Have a look at the post by Raul:
https://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=10455#10455 >>

Thanks Stew (and Raul).  I did a search previously and didn't find that thread.  Works great.

= Steve
Thu, Aug 5 2021 6:48 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Steve,

<< I have a form that has is longer than the vertical screen size, ie. the whole form doesn't fit on the screen.  It has scroll bars so the user can scroll the page.

On the bottom part of the form, there is an HTML form for the user to fill in.

When the application starts, the form scrolls to the first TEdit in the form and gives it focus. >>

Just use this line in your main form's AutoCreate (or in the project's .dpr code):

  Application.AutoFocus:=False;

You *will*, however, then need to set focus to whatever control you want to have focus in the form's OnShow event handler.

More information:

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

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Aug 6 2021 6:14 PMPermanent Link

Steve Gill

Avatar


<< Just use this line in your main form's AutoCreate (or in the project's .dpr code):

  Application.AutoFocus:=False;

You *will*, however, then need to set focus to whatever control you want to have focus in the form's OnShow event handler. >>

Nice.  Thanks Tim.

= Steve
Image