Pop-up in lists (Apple style)

Hello All

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?

A hint is very much appreciated!

Best regards, Robert

Robert Huber:
A hint is very much appreciated!

Here is one hint:

popup menu plugin ;)

Hi Robert

Thanks for the hint ;-) Have you got a little screenshot to see how the result would look like :-?

Thanks and best regards, Robert

ROCLASI:

Robert Huber:
A hint is very much appreciated!

Here is one hint:

popup menu plugin ;)

Hi Robert,

Here is one.

Hi Robert

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?

Thanks a lot in advance, Robert

ROCLASI:
Hi Robert,

Here is one.

Hi Robert,

I guess the small arrows up and down are a picture. When you have that the rest is easy.

attach a method to the picture with the following content:

var menu = new Array(
	plugins.popupmenu.createMenuItem('choice 1',choiceMethod),
	plugins.popupmenu.createMenuItem('choice 2',choiceMethod),
	plugins.popupmenu.createMenuItem('choice 3',choiceMethod),
	plugins.popupmenu.createMenuItem('choice 4',choiceMethod),
	plugins.popupmenu.createMenuItem('choice 5',choiceMethod),
	plugins.popupmenu.createMenuItem('-'),
	plugins.popupmenu.createMenuItem('choice 6',choiceMethod)
)

menu[0].setMethodArguments([1]);
menu[1].setMethodArguments([2]);
menu[2].setMethodArguments([3]);
menu[3].setMethodArguments([4]);
menu[4].setMethodArguments([5]);
menu[6].setMethodArguments([6]);

var elem = elements[application.getMethodTriggerElementName()]
if (elem != null) {
	plugins.popupmenu.showPopupMenu(elem, menu);
}

Now create a method choiceMethod() (can be global or not) and evaluate the arguments like```
application.output(arguments[0]);


Don't forget to name the parent button/element

Hi Robert H

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;

}

Hope this helps

Graham Greensall
Worxinfo Ltd

Graham, I have beaten you with 3 minutes :)

. . . . . and you used half as much code. Maybe I’d better sign up for your SW Javascript course instead of having a day off :)

Graham

Not really Graham, your example explains a little more… Just take a day off :)

Hi Marcel, Hi Graham

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)?

Best regards, Robert

You (can) create the popup every time over again so yes, you can of course also use table contents.

Simply a little more coding but not much more I guess…

Be aware - the popUpMenu plug-in is NOT Web Client compatible…

Thanks Bob for this Info!

Best regards, Robert

bcusick:
Be aware - the popUpMenu plug-in is NOT Web Client compatible…

Thanks Bob for this Info!

Best regards, Robert

bcusick:
Be aware - the popUpMenu plug-in is NOT Web Client compatible…