Opened 13 years ago

Closed 12 years ago

#953 closed bug (fixed)

BMenuField not starting in sticky mode (easy)

Reported by: wkornewald Owned by: jackburton
Priority: high Milestone: R1
Component: Kits/Interface Kit Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

We used trackTime to work around this, but it wasn't very reliable (see #615).

The BMenuField menu now opens directly under your mouse pointer, so when you release the mouse button the menu closes directly because it started in non-sticky mode.

We should probably always start BMenuField menus in sticky mode and only switch to non-sticky mode if the mouse was moved a minimum distance.

Change History (14)

comment:1 by jackburton, 13 years ago

There's a (unused, for now) fTrackNewBounds member in BMenu. Maybe we can use/abuse it in some way to fix this problem ?

comment:2 by wkornewald, 13 years ago

I'm not sure. I think we should use Track()'s clickToOpenRect (fExtraRect). I have problems understanding BMenuBar::TrackTask:

In BMenuField::MouseDown we call BMenuBar::StartMenuBar with a rect (specialRect=Bounds()), but in BMenuBar::TrackTask and BMenuBar::Track we seem to never use that rect. I think that with the rect it might work correctly, but the BMenuField's BMenuBar must propagate the rect one level down to the submenu which opens immediately when clicked on the BMenuField, so the specialRect is never taken into account. Is that right?

Originally, I had thought that BMenuField uses a simple BPopUpMenu instead of a BMenuBar. That way, we could easily specify the specialRect directly. Why do we not use a BPopUpMenu?

in reply to:  2 comment:3 by jackburton, 13 years ago

Replying to wkornewald:

I'm not sure. I think we should use Track()'s clickToOpenRect (fExtraRect). I have problems understanding BMenuBar::TrackTask:

In BMenuField::MouseDown we call BMenuBar::StartMenuBar with a rect (specialRect=Bounds()), but in BMenuBar::TrackTask and BMenuBar::Track we seem to never use that rect. I think that with the rect it might work correctly, but the BMenuField's BMenuBar must propagate the rect one level down to the submenu which opens immediately when clicked on the BMenuField, so the specialRect is never taken into account. Is that right?

Originally, I had thought that BMenuField uses a simple BPopUpMenu instead of a BMenuBar. That way, we could easily specify the specialRect directly. Why do we not use a BPopUpMenu?

Because BMenuField _accepts_ a BPopUpMenu (or any other kind of menu). It's only a container. How would you use a BPopUpMenu to track a menu ? Can you elaborate on that ? Beside this, the BMenuField api exposes the internal BMenuBar so I can't see how we would change this without possibly breaking some apps.

comment:4 by wkornewald, 13 years ago

Sorry, I wasn't really thinking in therm of API compatibility. I just thought that a menu field does nothing more than open a pop-up menu on mouse press and send a message if an item was clicked.

If the BMenuField is actually needed we probably have to find a way to pass the clickToOpenRect/specialRect to the first menu which opens when you invoke the BMenuBar.

comment:5 by jackburton, 13 years ago

Status: newassigned

comment:6 by jackburton, 13 years ago

Resolution: fixed
Status: assignedclosed

fixed in hrev19827

comment:7 by wkornewald, 13 years ago

Cool, thanks!

comment:8 by leavengood, 13 years ago

The problem is now when you click-and-hold on a BMenuField and then release the mouse over an item, the item is not selected and the menu stays open. I should probably open another bug for this. I'd try to fix it myself but that code is hairy!!!

comment:9 by wkornewald, 13 years ago

Resolution: fixed
Status: closedreopened

Stefano, could you please have a look?

in reply to:  9 comment:10 by jackburton, 13 years ago

Replying to wkornewald:

Stefano, could you please have a look?

Yes but not right now.

comment:11 by wkornewald, 13 years ago

Thanks! When I have the time I'll try to find the problem, too.

in reply to:  11 comment:12 by jackburton, 13 years ago

Replying to wkornewald:

Thanks! When I have the time I'll try to find the problem, too.

Actually I'm pretty sure I know where the problem is. The problem is how to implement it without breaking everything else :) And the code is that bad also because of the design of the class. I'm pretty sure be's code was ugly too.

comment:13 by wkornewald, 13 years ago

Summary: BMenuField not starting in sticky modeBMenuField not starting in sticky mode (easy)

Maybe we can tag easy tickets this way...

comment:14 by jackburton, 12 years ago

Resolution: fixed
Status: reopenedclosed

it's fixed in hrev21330.

Note: See TracTickets for help on using tickets.