• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Display selectd sub-menuItem in NSPopUpButton
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Display selectd sub-menuItem in NSPopUpButton


  • Subject: Re: Display selectd sub-menuItem in NSPopUpButton
  • From: John Joyce <email@hidden>
  • Date: Sat, 15 Feb 2014 17:35:45 +0900

On Feb 15, 2014, at 6:29 AM, Leonardo <email@hidden> wrote:

> Hi John,
> Thank you for the code. I suppose I missed something because it doesn’t work as expected.
> I did:
>
> I created a popUpMenu on IB and put it on the window and connected to the outlet popUpButton.
> I connected the popUp outlet to the delegate’s action popUpButtonAction.
>
> I created a menu with a single menuItem anc connected to “selectionMenu”.
> I created a menu with menuitems and submenus and connected it to “flyOutMenu”.
>
> What did I forget?
>
> When I select a submenu item, the popUP menu marks its sate as YES but it doesn’t display it on the closed popUp.
> When I re-click on the popUp, the only one item selected is the one under the mouse.
>
> Anyway, I succeeded as I explained on my previous email to the list.
> I click on a smple button and build a NSPopUpButtonCell and pop it up with performClickWithFrame:
> I use an NSTextField to show the latest selected item’s title.
> I would like to re-click and pre-select that meu item but I didn’t succeed yet.
>
>
> Regards
> -- Leonardo
>
Hi Leonardo

Unfortunately xib/nib files are pretty tough to describe well in a mailing list.

Posted it to Github
https://github.com/uchuugaka/Flyout
Have a look at what’s different from that.

The problem you’re going to have with getting a menu and any submenus to popup to what was selected, is that the mouse tracking will immediately ruin that behavior.
You can see something like that (what NSApplication docs call Spotlight for Help) by clicking the Help menu in almost any app, typing a partial string common to menu items in that app, and AppKit will show a list of menu items, then selecting one will open (simultaneously) the menu containing that item and then highlight the item and show a big giant pointer to it.
However, your mouse cursor is still tracking in the Help menu, and if you move your cursor to another menu or item in the menu bar, you’ll see it quickly dismiss everything.
So, basically, part 2 of your requirement is going to be really hard, really clumsy, or impossible to achieve.
I checked and did not see anything useable from NSAccessibility actions either.
As far as I can tell, your option would basically be to move the mouse cursor in code, but again, it would compete with the user and not be a great experience.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Re: Display selectd sub-menuItem in NSPopUpButton (From: Leonardo <email@hidden>)

  • Prev by Date: Re: Display selectd sub-menuItem in NSPopUpButton
  • Next by Date: Re: OpenCL Basic Programming Question
  • Previous by thread: Re: Display selectd sub-menuItem in NSPopUpButton
  • Next by thread: Re: Display selectd sub-menuItem in NSPopUpButton
  • Index(es):
    • Date
    • Thread