Re: Submenu navigation



I actually spent some time working on this. I currently have it working so
that when the mouse cursor leaves a menu item, the menu it left stays up
for a moment before the new menu pops up. Haven't yet had any luck
cancelling the pop up of the new menu if it enters the still-up submenu,
though. 

As to whether that is how the Mac does it or not, I am not sure. There is
definitely a timeout. The only two things I could point you to are 

1) From the Apple Human Interface Guidelines, page 103: 

Hierarchical menus are menus that include a menu item from which a submenu
descends. You can offer additional menu item choices without taking up
more space in the menu bar by including a submenu in a main menu. When the
user drags the pointer through a menu and rests it on a hierarchical menu
item, a submenu appears after a brief delay. 

(You can grab this entire book in PDF on Apple's web site, it's a great
read). 

2) From David K. Every's MacKido.com
page: http://www.mackido.com/Interface/hysteresis.html

In this page, he goes into relatively deep detail about how submenu
hysteresis works. He says it is done with a delay, and nothing about a
triangle, but says that it is dependent upon the user moving his mouse
towards the menu item when it leaves. (Of course, doesn't mean it can't be
implemented with a triangle like that). 

Another idea would be to dig up the Mozilla source code. You may have
noticed that their submenus have this behavior implemented very nicely. I
haven't looked into this at all, though. 

Lemme know if you'd like to see the patch I have so far (Not anywhere near
finished, and I'm not even sure it's the right way to proceed. I was just
looking into it, and haven't had much time for exploration). 

As you can see, I'm very much looking forward to this feature. 

Also, another thing. The TODO list states the item as "Improve submenu
navigation", so another thing that frustrates me greatly in navigating
submenus currently, and maybe someone else agrees with me: currently, you
have to thread the mouse cursor through that little area between the
right(or left) edge of the menu item with the submenu in order to hit the
menu (David Every has a good diagram of this on his site). Well, GTK+
currently makes the submenu jog down a few pixels from the top of the menu
item it is born from. This makes the area even smaller. Both the
Macintosh and Windows line up the submenu flush with the menu item that 
is it's parent. I'm sure the argument could be made that once the submenu
hysteresis is in place, this problem will go away, but still, I like all
the help I can get. (Besides, it just doesn't look right to me). 

Thanks, 
   David :) 

On Tue, 23 May 2000, Nils Barth wrote:

> Hi navigators-of-deep-submenus
> 
> In pursuit of big and better ways of improving submenus, I'd like to
> Improve Submenu Navigation, as per GTK+ TODO list.
> 
> After futzing with a Mac for a while, I determined that they handle
> navigation thusly:
> (the attached picture should help)
> When the mouse pointer leaves a menu item with a submenu, a little
> triangle is drawn between the exit point (p0) and the lower left
> corner of the submenu (p1), and the respective corner (p2)
> (assuming that you exit the menuitem at the bottom and the submenu is
> to your right, otherwise the upper-left, lower right, etc.)
> 
> While the mouse is in this triangle, the submenu stays up.
> When the mouse leaves the triangle, or after a timeout (1/2 or so --
> no stopwatch, sorry), the triangle disappears and the submenu
> collapses.
> 
> This is, I think, the Right Way (SM) of doing submenu navigation:
> * If you leave the menuitem in the direction of the submenu, the
>   submenu stays up.
> * If you leave the menuitem NOT in the direction of the submenu,
>   say if you're going up or down a menu item, the submenu dies.
> * It's a very temporary arrangement, and thus only consumes resources
>   when you're actually navigating.
> 
> I'm asking for feedback on two items:
> 
> (1) Do people agree that this is the right way of doing things?
>     Concerns, suggestions?
> (2) How should I implement this?
> 
> Re: (2)
> Currently, I have modified gtkmenuitem.c:gtk_menu_shell_leave_notify()
> so that when you leave a menuitem with a submenu, it determines what
> kind of triangle should put up.
> I'm thinking of also actually making the triangle popup here.
> For the navigation triangle, I was thinking of deriving an object from
> GtkBin and just drawing it (er, transparently), then monitoring it
> for:
> cursor exits (in which case it dies);
> cursor moving across the center diagonal (i.e., outside the triangle),
> in which case it also dies;
> timeout (in which case it yet again dies).
> 
> (a) This is actually a private object, since I can't imagine it being
> useful outside submenu navigation -- is this a problem?
> (b) I'm not too familiar with how GTK draws stuff/makes
> windows/widgets internally -- is what I have described above
> reasonable?
> 
> If anyone has suggestions/guidance, I'm welcome to it.
> 
> 





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]