Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread EWB 2.XX TMenu in Popup Scenario
Tue, Sep 1 2015 9:25 AMPermanent Link

Mark Brooks

Slikware

Avatar

Hi

Just wondered if anybody had experience using the TMenu component as a popup menu? I can certainly make it popup by calling "Show" when an associated UI element is clicked and I can make it disappear by calling "Hide" when an item is clicked. However, I can't make it disappear when it loses focus i.e. when the user decides not to click any of the menu options but click elsewhere to dismiss it.

Mark
Tue, Sep 1 2015 3:22 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Mark,

<< Just wondered if anybody had experience using the TMenu component as a popup menu? I can certainly make it popup by calling "Show" when an associated UI element is clicked and I can make it disappear by calling "Hide" when an item is clicked. However, I can't make it disappear when it loses focus i.e. when the user decides not to click any of the menu options but click elsewhere to dismiss it. >>

This is going to be hard to do without an OnExit event handler for the entire menu.  The menu is a weird control because the menu items themselves obtain focus, not the menu.  So, there isn't an OnExit for the menu, and without it, you can't really do what you want.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Nov 9 2015 10:30 AMPermanent Link

Uli Becker

Mark,

> Just wondered if anybody had experience using the TMenu component as a popup menu? I can certainly make it popup by calling "Show" when an associated UI element is clicked and I can make it disappear by calling "Hide" when an item is clicked. However, I can't make it disappear when it loses focus i.e. when the user decides not to click any of the menu options but click elsewhere to dismiss it.

Maybe this is similar to what you asked:

http://www.beckersoft-online.de/demos/menutest.html

Uli

Mon, Nov 9 2015 11:49 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Could you check when a menu item loses focus whether any of the other menu items have focus? If not, assume "something else" does and close it.
Mon, Nov 9 2015 11:58 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Could you check when a menu item loses focus whether any of the other menu items have focus? If not, assume "something else" does and close it. >>

EWB now (2.02) has menu-wide OnEnter/OnExit events, so this isn't an issue anymore:

http://www.elevatesoft.com/manual?action=viewcomp&id=ewb2&comp=TMenu

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Nov 9 2015 12:01 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

Tim Young [Elevate Software] wrote:



You beat me to it SmileI just noticed that and got it working fine.

Just need to ensure you set one of the menu items to have focus when you show the menu, then the onexit event fires.
Mon, Nov 9 2015 12:11 PMPermanent Link

Uli Becker

Tim,

> EWB now (2.02) has menu-wide OnEnter/OnExit events, so this isn't an issue anymore:

I tried that, but nothing happens when I add code to the OnExit event of
a TMenu. Anything obvious that I am overlooking?

Uli
Mon, Nov 9 2015 12:30 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< I tried that, but nothing happens when I add code to the OnExit event of a TMenu. Anything obvious that I am overlooking? >>

Did you set focus to the menu, or one of the menu items ?

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Nov 9 2015 12:39 PMPermanent Link

Uli Becker

Tim,

> Did you set focus to the menu, or one of the menu items ?

Yes, I did.

Uli
Mon, Nov 9 2015 12:56 PMPermanent Link

Uli Becker

Tim,

> Did you set focus to the menu, or one of the menu items ?

OK, I got it: I have to click outside the menu, then the OnExit event is
fired. What I realized in the demo, is hiding the menu just when moving
the mouse out of the menu's bounds.

Uli
Page 1 of 2Next Page
Jump to Page:  1 2
Image