[Top][All Lists]

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

Re: NSPopUpButton issue (possible patch)

From: Nicola Pero
Subject: Re: NSPopUpButton issue (possible patch)
Date: Wed, 13 Feb 2002 12:00:01 +0000 (GMT)

> Howdy,
> NSPopUpButton and co. does some weird things while drawing.  The most obvious
> in my mind is the strange changes in NSOffState and NSOnState.  On a slow
> machine, like mine, when you change the selection in an NSPopUpButton you
> actually see the menuview scramble to redraw the view to show the change in
> state (i.e. a checkmark) before it finishs and orders out.

I noticed that too ... very ugly ... but I think setting the On/Off state
of the menu item is in accordance with the doc ...

my solution is that we call setOnStateImage: nil on each item
automatically generated by the popupbutton.  That makes sure that we
change the menu item state according to the doc, but that the default menu
items don't show their state with the ugly tick marks - they always appear
the same regardless of their state.

That would also allow us to remove the 'setChangesState: NO' call just
after setting the state of the menu item, which in my opinion shouldn't be
there anyway.

I also think that in all menuitem drawing/sizing methods, whenever
setChangesState is YES, and stateImageWidth is used, if that width is
zero, it should behave as if setChangesState is NO (in other words, the
horizontalEdgePadding should not be added).  That is another bug in my

This is all rough and sketchy and it's just my comments at reading quickly
the code at a first sight (without actually trying anything) - so I might
be wrong.

But if you want to examine my suggestions, think about them (fixing
eventual missing/incorrect bits) and work them out into a final patch, and
test it, if that works we can then apply it.

> Also, the trackWithEvent method in NSMenuView goes through alot of work even 
> if
> we are a popupbutton.  Thus, knowing that we don't need the extra handling we
> can bail out of the loop and speed things up a bit -- I think.

Did you notice any measurable speed improvement in doing that ?
<I wonder if it is possible to add a submenu to a popup menu ?>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]