Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Focus
Wed, Feb 26 2020 9:53 AMPermanent Link

Matthew Jones

EWB sets the focus to the first edit box on opening the page. Is there a way to stop this?

--

Matthew Jones
Wed, Feb 26 2020 10:52 AMPermanent Link

Walter Matte

Tactical Business Corporation

Each control you can set AllowFocus or not  - and you can select in code which control to focus on.

edit7.SetFocus;

Walter
Wed, Feb 26 2020 11:38 AMPermanent Link

Matthew Jones

Walter Matte wrote:

> Each control you can set AllowFocus or not  - and you can select in code which control to focus on.

Indeed, but the edit boxes are at the bottom of my page, and I want them to read the top first. The browser opens, and then jumps to show the edit box which got focus. I need to stop that happening.

--

Matthew Jones
Wed, Feb 26 2020 1:11 PMPermanent Link

Walter Matte

Tactical Business Corporation

Are you saying that the control with the first Tab Stop enabled is not getting Focus?

If you don;t set it yourself the the first Z-Order control with tab stop will get focus.

Walter
Thu, Feb 27 2020 4:18 AMPermanent Link

Matthew Jones

Walter Matte wrote:

> Are you saying that the control with the first Tab Stop enabled is not getting Focus?

No, I'm saying it is, and I don't want it to. The only controls with focus are at the bottom of the page. The page opens, and is scrolled to the first control with focus. Having focus is fine, moving to it not. It is important that the top of the page is read first.

--

Matthew Jones
Fri, Feb 28 2020 4:17 AMPermanent Link

Michael Dreher

"Matthew Jones" wrote:

Walter Matte wrote:

   // The only controls with focus are at the bottom of the page. The page opens, and
   // is scrolled to the first control with focus. Having focus is fine, moving to it not.

Try this: in the OnShow event handler disable the edit control.

edText.Enablesd := false;

This will (tested in the IDE, FF, Chrome) prevent the form from scrolling down to the
edit control. Start a timer in the OnShow procedure (1000ms for example) and in the
OnTimer event handler enable the input control.

edText.Enablesd := true;

The focus is set, but scrolling down should be prevented.

Michael Dreher
Fri, Feb 28 2020 4:39 AMPermanent Link

Matthew Jones

Michael Dreher wrote:

> Try this: in the OnShow event handler

Thanks - I will do so.

--

Matthew Jones
Fri, Feb 28 2020 11:12 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< EWB sets the focus to the first edit box on opening the page. Is there a way to stop this? >>

Yes, turn off this property in your main forms' OnCreate event handler, and that should fix the issue:

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

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 28 2020 12:06 PMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> turn off this property

Even better! Thank you.

--

Matthew Jones
Image