-
Close Context Menu
Hi,
I whould like to know if there is a way to hide the context menu, in my windows application the context menu is displayed on hover of a button but when the cursor moves away from the button or off the context menu i need to hide the context menu, i tried using the mouse leave event of the button but the button looses focus immediately when the context menu is displayed. please let me know how do i handle this...
workarounds:
tried using a timer to hide the context menu by sendkeys.send("{ESC}") for every 2 secs but unable to find if any item is selected in the contextmenu to retain the menu on selection.
Thanks in advance
dev
Last edited by dev12345; 03-12-2008 at 06:17 AM.
-
RE: Closing Context Menu
Hello,
Not sure why you are trying to do this as this is default behaviour in all applications. The context menu will go away automatically when the user gives something else focus.
-
I have 4 buttons as menu items and on hover of each button it currently displays a context menu, so when i move the mouse over one button a context menu is displayed and then i have to click some where on the screen and move the mouse over the second botton to see the context menu.
-
re: Close Context Menu
Not sure I'd recommend that pattern for a UI as it is a little off the norm and may throw off your users. Having buttons in a menubar and context menu's for buttons is not in the Vista User Experience Design Guidelines, which you may want to review to help put together a solid UI for your application.
That said, if you use the "MouseEnter" event to do a contextMenu.Show() and the "MouseLeave" event to do a contextMenu.Hide() you should be able to accomplish what you want to do.
-
I agree with John with respect to design.
Is there a particular reason why you choose contextmenus for each button?
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
there are 2 menus one with the default menu control (horizontal) and the other is leftnavigation menu which will have these buttons...
Mouseleave is fired immediately after the mousehover is done because we display a context menu on mousehover and the button looses focus.
please let me know if there a workaround to handle this...
Last edited by dev12345; 03-18-2008 at 01:17 AM.
-
I think the problem is that you are using MouseHover instead of MouseEnter. MouseEnter is the counterpart to MouseLeave. So if you show your context menu in MouseEnter and hide it in MouseLeave you should be fine.
-
It is the same case even if i show context menu in MouseEnter and hide it in MouseLeave. after mouse enter the context menu is displayed and the button looses focus and the mouse leave event is fired. so a series of events get fired, enter then leave again enter leave.....
Similar Threads
-
By David Chu in forum .NET
Replies: 0
Last Post: 09-01-2006, 12:07 PM
-
By vb_programmer in forum VB Classic
Replies: 7
Last Post: 08-15-2006, 03:21 PM
-
By CFPSoft in forum VB Classic
Replies: 1
Last Post: 05-15-2006, 05:34 AM
-
Replies: 0
Last Post: 07-27-2005, 07:42 AM
-
By JetserKing in forum VB Classic
Replies: 0
Last Post: 02-15-2005, 02:12 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks