but for the life of me I cant find anything that demonstrates this using ASOBJC in Xcode.
So the question is, am I understanding this incorrectly?, and can it be done?, if it can be done
could someone kindly point me in the right direction to some code, or demonstrate how this is
done,
I suggest using DialogToolkitPlus, from Shane Stanley. Not only does it let you add a popup menu to a dialog, but you can inspect the code and see how its done.
@estockly
I believe the op is asking about using pop-up buttons within an Xcode project, and not dialog box’s.
Shane’s dialog tool kit is used for displaying and customising dialog boxes, and not specifically for using pop-up buttons.
I have a popup button, and have no problems populating it with information using something similar as below
property slugType : missing value
on awakeFromNib()
set listOfSlugs to {"BLACK","SPOT","CMYK"}
slugType's removeAllItems()
slugType's addItemsWithTitles:listOfSlugs
end awakeFromNib
this demonstrates exactly what I am trying to achieve, add extra submenu or contextual menu
terminology is the real secret to finding information, my lack of how to translate
though is my flaw with ASOBJC, id appreciate some guidance with this please, if any one has the time.
Ok I’ll see what i can do when I have time.
I last used it in Objective-C context.
I started in AppleScript, then into AsOBJc and there was lots
Of learning curves, but it helped me into Objective-C which
Is where most of my programming happens, with some AppleScript and
scripting bridge.
Also when I last used contextual menu item it was also
Done on a NSTextView so that it would respond and show a menu
For selected text items.
That was a little bit more complicated as it involved many of the
NSTextEditor protocols and I think I also had to add my menu items to the already existing
Contextual Text menu items.
So it seems like you know how to connect an IBOutlet from your AsOBJc code to a menu.
What is it exactly you trying to accomplish?
change/add a menu in a PopUpButton?
(just connect your IBOutlet to the menu of the Button)
add a general anywhere context Pop Up Menu to your view?
==============================================================================
Few things I suggest:
You seem to know how to remove and add items to an existing menu:
learn to create your own menu.
- learn the various ways to create menuItems and it’s properties:
- Title, Tag, Target, Action, Identifier, Represented Object, keyEquivalent
- learn how to add, remove menuItems to a menu
- learn how to add dividers and subMenus to a menu
Learn how to programatically select menu items, enable them and access whats selected
Learn how to set your menu as the menu for an item (PopUpButton a NSView etc)
Learn how to programatically select the Button/Views’s menu’s items and how to access what’s selected
Learn how to programatically set the target/action
on a menuItem itself
on a menu as a whole (do you need to set separate actions for each menu?)
on the button/NSViews
Learn how to set up an appropriate IBAction and receive the action from the sender
and how to decode it.
Learn how to customize the appearance of your Button, Menu, MenuItems.
Learn some shortCuts for the above.
==============================================================================
But again before we can help you it needs. to be clear what your after.
technomorph, thanks for the pointers and suggestions, I have not been able to achieve exactly what I am trying to do, and it’s not for the lack of trying.
Basically, I am trying to progmatically or manually through bindings, have a NSPopUpButton, and then add to the NSMenu’s NSmenuItem another NSMenu, which is a subMenu, I cando this manually, but I cant seem to get the result of the selected items in the added NSMenu
I have tried the below
set theItemArray to menuOne's itemArray
log theItemArray
which returns
so when I select Item 1 it only shows that a submenu exists, but I cannot select anything in menItem
so I am not even sure I can do this.