objective c - cocoa: How do I suppress NSPopUpButton automatic selection/synchronization? NSArrayController and NSMenu do not work -
i have nspopupbutton
. whenever add or remove items it, first item gets automatically selected. want inhibit this; want nspopupbutton
appear nothing selected, , not select until user selects something.
everything being constructed in code. (this backend; gui layout comes elsewhere.)
nscombobox
already.
with nstableview
, used nsarraycontroller
, cocoa bindings, do:
[ac setselectsinsertedobjects:no]; // insertions [ac setavoidsemptyselection:no]; // deletions
i tried nspopupbutton
, however, , did not change behavior: first item still automatically selected.
i have tried accessing backing nsmenu
@ on irc's suggestion , adding that; behavior did not change.
i noticed there's method on nspopupbutton
, synchronizetitleandselecteditem
, seems said nspopupbutton
itself, don't see way disable it, either in nspopupbutton
or nspopupbuttoncell
. going have subclass nspopupbutton
make method nothing? i'm not particularly attracted idea.
is there else i'm doing wrong? thanks.
speculation, possible answer:
if using arraycontroller, , have bound content not selectionindex, popup going keep selection index zero, if object @ index gets bumped elsewhere.
so bind selection index array controller well.
Comments
Post a Comment