As the normal pop-up (drop-down) menues are not so well suited for lists I would like to use the ones Apple uses in its applications (Mail, iCal, …) where a pop-up in a list shows only the two flat (up/down) arrows (not the usual three dimensional aqua blue pop-up). Does anybody use them for lists and how can they be achieved?
Looks good! I would like it to use in lists instead of the normal popup but can’t figure out how to program it. The sample code looks quite complicate. Is it (quite) easily to use as a replacement for lists and would you lend me a programming example?
Drop down menus are very useful - some quick code follows to get you started:
First method sets up the Items that will show in the popMenu list and methods they will trigger. This method is called from a Search icon on Contacts Form.
*-----------------
CP_Search_popMenu
create popup menu array
display popup menu
-----------------*
var menu = new Array(
plugins.popupmenu.createMenuItem(‘Detailed Search’, CP_Search_popActions),
plugins.popupmenu.createMenuItem(‘Clients’, CP_Search_popActions),
plugins.popupmenu.createMenuItem(‘Suppliers’, CP_Search_popActions),
plugins.popupmenu.createMenuItem(‘Admin’, CP_Search_popActions),
plugins.popupmenu.createMenuItem(‘Hotlist’, CP_Search_popActions)
)
//create arguments for the method calls
var x = 0
while (menu)
{
menu.setMethodArguments(x)
x ++
}
//pop up the menu
plugins.popupmenu.showPopupMenu(elements.PopMenu, menu);
You could call individual Methods directly but for ease of reading/debugging later I use a seperate Method to group everythying together. As you will see you can either set fields/variable or call a new method.
*-----------------
CP_Search_popActions
get Action selected from CP_Search_popMenu
-----------------*
var vAction = arguments[0] // arg from popupMenu plugin
switch( vAction )
{
case 0: globals.g_NotAvailable(); break;
case 1: globals.gText01 = ‘Client’; break;
case 2: globals.gText01 = ‘Supplier’; break;
case 3: globals.gText01 = ‘Admin’; break;
case 4: forms.wx_j_cont_hotlist.loadHotlist(globals.gcurr_Staff_ID); break;
Thanks a lot for your examples, I will try them in my application
is it also possible to show values from a table or is it intended for fixed menu items (only)?