Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread ButtonComboBox focus issue
Wed, Oct 4 2017 5:49 AMPermanent Link

Matthew Jones

If the ButtonComboBox is dropped down, it technically doesn't have the focus. If you put an OnEnter/OnExit you can see that the drop down causes the "combo" to lose focus. The drop down event shows this fine.

However, if you then call combo.SetFocus, or otherwise cause the focus to shift and then back, this causes the dropdown list to disappear.

Hmm, I've done a load of digging, and it falls back to my complex code that is creating/showing/hiding forms as list items. The core code is hiding drop downs as part of the restoration of the active focus, and I can't see that it makes sense to put special cases for this. So I've added a timer, and it waits until a while after the last change in the combo before triggering my lookup. From the user perspective, it is fine this way.
I'll post this for when I come back wondering how to solve this problem in the future...

--

Matthew Jones
Wed, Oct 4 2017 12:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< If the ButtonComboBox is dropped down, it technically doesn't have the focus. If you put an OnEnter/OnExit you can see that the drop down causes the "combo" to lose focus. The drop down event shows this fine.

However, if you then call combo.SetFocus, or otherwise cause the focus to shift and then back, this causes the dropdown list to disappear. >>

Yes, this is how combo controls work.  They're two separate controls, and any time the drop-down loses focus, it should automatically close.

<< Hmm, I've done a load of digging, and it falls back to my complex code that is creating/showing/hiding forms as list items. The core code is hiding drop downs as part of the restoration of the active focus, >>

Why are you manually hiding the drop-down lists ?  EWB should take care of this for you.

Tim Young
Elevate Software
www.elevatesoft.com
Wed, Oct 4 2017 12:17 PMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Why are you manually hiding the drop-down lists ?

I'm not! I've just been doing a lot of experimenting. For instance, if you set up a timer on the OnDropDown happening, and then in the timer do Combo1.SetFocus, the combo will hide the drop down. Yet it is actually "focussed" in theory - the drop down actually has it, but perhaps the combo should "know" and set the focus to that instead.

But the real issue is that creating child forms on the same parent form is causing the drop down to disappear, when I really want it to stay. The idea is/was to allow the user to select items from the combo and see the results of the searches happen as it changes. The results are causing the combo to disappear though.

--

Matthew Jones
Wed, Oct 4 2017 12:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< I'm not! >>

Smile Ahhh, so you're describing a side effect.

<<I've just been doing a lot of experimenting. For instance, if you set up a timer on the OnDropDown happening, and then in the timer do Combo1.SetFocus, the combo will hide the drop down. Yet it is actually "focussed" in theory - the drop down actually has it, but perhaps the combo should "know" and set the focus to that instead. >>

I'll have to look into this, but it's not a huge priority right now.  In general, any time the drop-down control loses focus, it will automatically close.

<< But the real issue is that creating child forms on the same parent form is causing the drop down to disappear, when I really want it to stay. The idea is/was to allow the user to select items from the combo and see the results of the searches happen as it changes. The results are causing the combo to disappear though. >>

Child forms should act like panels in terms of auto-focusing child controls.  There is specific code in the WebForms unit that checks to see if a form is parented to the application surface, or some other control, and it conditionally handles the focusing based upon that.  If you can demonstrate something to the contrary in an example that you can send me, I'll certainly take a look and see what's going on.

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Oct 5 2017 4:30 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> In general, any time the drop-down control loses focus, it will automatically close.

Just had a silly thought - can I actually see what the status of the dropdown is using a property, and can I tell it to drop down programmatically too? That would solve my problems.

--

Matthew Jones
Thu, Oct 5 2017 5:28 AMPermanent Link

Walter Matte

Tactical Business Corporation


Try ShowDropDown method...

 ButtonComboBox.ShowDropDown;

Walter
Thu, Oct 5 2017 6:57 AMPermanent Link

Matthew Jones

Walter Matte wrote:

> ShowDropDown

Thanks - and with the events to tell me if it is down or not, I have what I need. Will play.

--

Matthew Jones
Image