I have a NSPopupButton that displays a drop down menu when clicked. This menu is populated from an NSArray. Now if I click on one of the items in the drop down Menu, I can select it and determine what is selected etc.
What I want to do is when the user clicks on the NSpopupbutton, update the drop down menu and then have the user pick one of the items.
I am having trouble finding how to call a IBAction method when I simply select the drop down menu ( not clicking any one item in it). The clicking of an item in the menu results in an IBAction, but I want just the clicking of the down arrow in the NSPopupButton to trigger an action. Any ideas ? Thanks.
The NSPopupButton sends an NSPopUpButtonWillPopUpNotification when clicked. Have your controller object listen for that notification and respond by updating the dropdown menu.
The accepted answer worked, though now it's called NSPopUpButton.willPopUpNotification
In Swift 4.x, my code looked like:
NotificationCenter.default.addObserver(self,
selector: #selector(dropdownMenuOpened),
name: NSPopUpButton.willPopUpNotification,
object: nil)
Related
In my main form window, I have the following menu bar which is used for traversing. Its inherited from .mmb file.
Now, when I select any form on the menu, lets suppose I selected the highlighted "Purchase Order", then I don't want the same menu to be shown. I want the Oracle Form 11g's default menu to be shown instead, picture added below for reference.
I changed form's property of Inherit menu to No and the menu from image 1 isn't shown in "Purchase Order" but I still am not getting the default&smartbar menu.
How can I achieve that?
Thank you.
So I figured out a way how to disable .mmx menu and enable DEFAULT&SMARTBAR menu when I go to another form through the menu.
From the first screenshot above, the on-click-trigger had the following code
call_form(:global.path||'pc');
I replaced it with
call_form(:global.path||'pc',hide,do_replace);
So the addition of
,hide,do_replace
worked.
Side note: Also, make sure Inherit Menu property of Window property is "YES" and Menu Module of form property is set to "DEFAULT&SMARTBAR"
I think in the properties window from the form you got the property "menu module"
If you make a new form it gets the default: DEFAULT&SMARTBAR
So I think it is now filled with your mmb filename.
I have a NSPopUpButton where I'm preselecting item in the menu and is been selected but is not showing as selected. Here is my code:
[self.categoryMenu selectItemWithTitle:#"cineRush"];
Here is how is showing:
But here is how show if I click on the NSPopUpButton:
But it show "cineRush" as selected item.
Any of you knows why this is happening or how can this fix?
Can anyone offer assistance with adding a delete button to a tableview in xcode? I can create the button but cannot get it to delete anything in the table. I'm using the default code that comes with the Master Detail Application but have changed the content of the table using an NSObject.
This should be the default behaviour of the edit button.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
This will allow you to click and delete any item in the list after it is pressed.
Unless I am misunderstanding how you are using the table item list.
the standard behaviour of a Flex dropdownlist is to disable the currently selected item from the list. Does anybody know how to override this to allow the user to re-select the selected item (if they so desire)?
NOTE: I don't want there to be a selected item in the list but I still want the selecteditem property to be set in the dropdownlist control, otherwise how will I know what has been selected. This is slighly trickier than it sounds...unless I have missed something...
Thanks
Mark
I'm not sure I understand the question but you can listen to close event of the component :
Dispatched when the drop-down list closes for any reason, such when the user: Selects an item in the drop-down list. Clicks outside of the drop-down list. Clicks the anchor button while the drop-down list is displayed.
So, you can access the component and gather the selectedIndex, selectedItem properties.
I guess what I'd like to know is that why you want to "re-select", possible to trigger something again but I'd try close event...
I have a Datawindow Grid in a window I've created and one column of this DW has as its data, different menu paths that are the same of the menus and submenus I have created. The point is that when I double-click on every DW row, I want to execute the clicked event of the different menu path that is stored as data in each row.
For example the first row is "m_epith_frame.m_parms_su.m_poi.m_poi_ergast", the second is "m_appl_frame.m_1_sb.m_2_sb" etc.
I know that when in scripts, I write m_epith_frame.m_parms_su.m_poi.m_poi_ergast.Clicked(), it triggers the Clicked event of this menu item and for example opens a form...
So how can I click each row and trigger the clicked event for every menu path of each row?
It is, I suppose, a dynamic event call problem, but I can not find any solution..
Thanks in advance
You can recurse menus to build up a string array of the menu paths. At the same time build up an array of the menu items and assign the menuitem object to this using the same array index number as for the strings. Don't use create, just assign the menuitem to the array.
When someone clicks on a row, find the index of the path in the string array, then trigger a click event on the menu item array using the same index.
The menu item array holds pointers to the real menu items in the menu, so it's the same as clicking on the menu option, e.g you can code
im_menuitems[li_menuindex].Triggerevent (Clicked!)
and if this is m_epith_frame.m_parms_su.m_poi.m_poi_ergast that is what is clicked.