Giving a try to popup menus I went a little in trouble on the first parameter of the call:
plugins.popupmenu.showPopupMenu(element, menu);
Documentation manual reports:
Description: Displays a popup menu for a specfied element with a specified array of menu items.
Syntax: plugins.popupmenu(element,itemArray)
Parameters: Element - the specified element to display the popup menu for
itemArray - the specified array of menu items for the popup menu
What does it means that first parameter?
Could I create the popup menu when initially a form is shown (onShow method) binding it to the
desidered element and expecting later on Servoy to take care of shoing it only on the element
I defined?
A quick test on my developer platform (WinXp SP2 with Java 1.6 and Servoy 3.5.7) confirmed it
does NOT work! The question raised again:
What does it means that first parameter?
I decided to try to implement popup menu generation and presentation in the onFocusGained of
the PK of my example table.
The example reported on the documentation is:
//pop up the menu
var elem = elements[application.getMethodTriggerElementName()]
if (elem != null)
{
plugins.popupmenu.showPopupMenu(elem, menu);
}
If I do NOT give a name to the field I am using the popup menu does not show up; the field
used is called sott_id and I named it in the proper field sott_id again. Now if I put a
dialog in the middle:
//pop up the menu
var elem = elements[application.getMethodTriggerElementName()];
plugin.dialog.showInfoDialog(‘INFO’, elem, ‘OK’);
if (elem != null)
{
plugins.popupmenu.showPopupMenu(elem, menu);
}
I got on the dialog at runtime:
DataField[sott_id:sott_id:1]
where
sott_id is the name of the field on the database
sott_id is the name I have given to the field in Servoy
1 is the value of the field in the current record
After digging this way I am back to my question:
What does it means that first parameter?
Should just be passed like in the example or is giving to the programmer some choice?
Could anyone give me a hint?
Tnks,
Gianni