"web-style" menus?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nil
Earned a small fee
Earned a small fee
Posts: 12
Joined: Wed Mar 09, 2005 4:01 am

"web-style" menus?

Post by nil » Wed Mar 09, 2005 4:24 am

Hi there.

I am currently developping an app using wxWidgets. So far it's been a pleasant experience. For this app I am going for a custom look and have already coded a couple of buttons. At the moment I have a menubar and that works, but ideally I'd like to create "web-style" menus. What I mean by that is a) no need to click to pop up the menus, just going over a menu pops it open and b) if you move the mouse off of the menu, it will close itself automatically after a small delay.

It looks very doable, but on the other hand life is short, so if anyone either knows that it's been done before and can point me to code, or has suggestions on how to write it, I'm all ears.

Thanks in advance.

davewood
Experienced Solver
Experienced Solver
Posts: 74
Joined: Tue Feb 08, 2005 2:05 pm

Post by davewood » Wed Mar 09, 2005 8:40 am

derive a new button from wxButton
use this event macros then

EVT_LEAVE_WINDOW(mouse_left)
EVT_ENTER_WINDOW(mouse_enter)

dave

nil
Earned a small fee
Earned a small fee
Posts: 12
Joined: Wed Mar 09, 2005 4:01 am

Post by nil » Wed Mar 09, 2005 1:34 pm

Dave,

Thanks for your suggestion. I had already made a quick try for something like this (a button with a wxMenu that would pop on a mouse enter event). Unfortunately wxWindow::PopupMenu (on windows at least) ends up calling ::TrackPopupMenu which just eats all events until I either pick a menu item or click outside the window. Not the behaviour I'm after.

I can easily see how to get this to work by basically reimplementing menu/menu bar classes. The buttons would need to be aware of a parent menubar window, so that if the mouse wanders off to other menus, the current menu is dismissed and the new one pops up; I'd have to track mouse moves; handle menu item selection; use timer... all doable, but I'm trying to avoid having to reimplement menus just for a small behaviour change. There must be a better way. Create new menubar/menu style flags and use them to handle events differently?

vsp
Knows some wx things
Knows some wx things
Posts: 35
Joined: Mon Feb 21, 2005 12:52 pm

Post by vsp » Thu Mar 24, 2005 9:35 am

look at similar implementation in //www.iftools.com

awx has similar implemntation

nil
Earned a small fee
Earned a small fee
Posts: 12
Joined: Wed Mar 09, 2005 4:01 am

Post by nil » Fri Apr 29, 2005 3:09 am

Hi vsp.

Thanks for the pointer to awx. Looks like useful classes. Had I known earlier I could have saved myself the trouble of creating multi-states buttons! I don't see anything about menu bars, though...

Post Reply