« MBS FileMaker Plugin … | Home | .fmp[x]Berlin 2015 Lo… »

QuickMenu function

Here is a nice custom function for showing a menu right away:

Let ( [
/* Create a menu */
menu = MBS( "Menu.CreateMenu" );
/* add items from our parameter */
m2 = MBS( "Menu.AddItems"; menu; Items );
/* show menu at mouse position */
m3 = MBS( "Menu.PopUp"; menu; "mouse"; 0; 0 );
/* query selected item */
selectedItem = MBS( "Menu.SelectedItem"; menu );
/* if something is selected, query its text */
result = If( Length(selectedItem )>0; MBS( "MenuItem.GetTitle"; selectedItem ); "");
/* Cleanup menu */
m5 = MBS( "Menu.Release"; menu; 1 )

];

/* return selection */
result )


You can just call it anywhere, pass a list of items and get back the selected item from the list. Feel free to copy and modify it. Like adding more options to it. For next plugin, we already added option for Menu.AddItems to create separators for lines containing only a minus. FileMaker Plugin
01 12 14 - 00:18

Start Chat