drag-removing nsstatusitems from menubar
drag-removing nsstatusitems from menubar
- Subject: drag-removing nsstatusitems from menubar
- From: Chase <email@hidden>
- Date: Sun, 7 Aug 2005 11:16:28 -0500
Okay, so Menu Extras have that nice drag/poof removal mechanism,
which works nicely and everyone in userland has sort of accepted that
this is how something that sits in the right side of the menu bar
should/can be removed.
The problem is when we non-Apple folks try to use NSStatusItem, which
doesn't have that functionality built right in.
Now, I've got the code that starts a drag and when the mouse cursor
falls below the menu bar the length of the status item is set to 0
and any status items that may be sitting to the left scoot to the
right to fill the hole. If I -- while still dragging -- move the
cursor back into the menu bar area, the length is reset to its
previous length and all status items to my left scoot left again to
make room.
This is about as close as I can get to the Menu Extras drag-removal
behavior.
There are two exceptions:
(1) The user cannot drag my status item into a new position in
the menubar, as can be done
with Menu Extras. This I have already accepted and I'm not
too worried about it.
(2) Menu Tracking for all StatusItems and Menu Extras is enabled
and cannot be disabled
without messing up the drag operation (at least not the way
I'm currently doing it).
This second point is the one I need help with today.
To understand what I'm talking about:
Put a couple of Menu Extras (at least 2) in the menu bar.
Click (and release) one and its menu will pop open if it has one.
Then roll the mouse over the other Menu Extra. Its menu will
pop open too.
Click again to stop menu tracking.
Note that this is the same scenario if you were to click and drag.
Now command+click the same menu item and hold the mouse button
down.
No menu appears, because menu tracking has not been enabled.
We're in drag mode.
Move -- while still dragging -- your cursor over the other Menu
Extra. Still no menu appears.
Now imagine how annoying that would be to do the dragging WITH menu
tracking enabled. Menus are poping open everywhere you go, getting
in the way of what you're actually trying to do.
Creating a stray mouseUp elsewhere on the menubar (at 0,0 for
example) does kill menu tracking, but it also preemtively kills my
drag operation, since dragging technically ends when the mouse button
comes back up:
CGPostMouseEvent((CGPoint){0,0}, FALSE, 1, FALSE); // fake mouseUp
What's another way to stop menu tracking that doesn't involve faking
a mouseUp?
- Chase
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden