How to programatically close a user opened NSPopUpButton...

  • I have situation in which I have asynchronous network events (pumped
    to the main thread via performSelectorOnMainThread:) that result in
    the contents of a popup button's menu changing.

    If the user has the menu open (user either single-clicked or is
    click-holding the control) items will update in the menu however the
    sizing of the menu wont change which results in the appearance of a
    partially populated menu and/or other related visual inconsistencies.

    Any suggestions / opinions on the "right way" to either close an open
    NSPopUpButton or otherwise get it to fully display itself?

    I could defer the menu update until the menu is closed but I would
    prefer to inform the user as soon as possible since a selection they
    are about to make may not exist any more.

    -Shawn
  • On Aug 30, 2007, at 6:10 PM, Shawn Erickson wrote:

    > I have situation in which I have asynchronous network events (pumped
    > to the main thread via performSelectorOnMainThread:) that result in
    > the contents of a popup button's menu changing.
    >
    > If the user has the menu open (user either single-clicked or is
    > click-holding the control) items will update in the menu however the
    > sizing of the menu wont change which results in the appearance of a
    > partially populated menu and/or other related visual inconsistencies.
    >
    > Any suggestions / opinions on the "right way" to either close an open
    > NSPopUpButton or otherwise get it to fully display itself?
    >
    > I could defer the menu update until the menu is closed but I would
    > prefer to inform the user as soon as possible since a selection they
    > are about to make may not exist any more.

    While it was a different situation that yours, I had to decide how to
    handle control-tracking in general when dealing with game AI running
    on another thread.  I chose to always "enqueue" the thread's result
    and wait until control-tracking finished before processing said result.

    My take on this was that control-tracking is often done in a short
    window of time.  Although, I could see keyboard driven access to a
    menu may take few to several seconds.  Still, I would lean towards
    not updating the menu while it was being tracked.
    ___________________________________________________________
    Ricky A. Sharp        mailto:<rsharp...>
    Instant Interactive(tm)  http://www.instantinteractive.com
previous month august 2007 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today