May 05, 2024 02:07 Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients SampleSupported Clients
SmartClient
WebClient
NGClient
MobileClient
Property Summary
String
code
The full source code of this method (including doc and function declaration).
Boolean
showInMenu
Flag that tells if the method appears or not in the "Methods" menu of Servoy Client.
Methods Summary
Array
getArguments()
Gets the argument array for this method if that is set for the specific action this method is taken from.
String
getName()
The name of the method.
String
getScopeName()
Get scope name
UUID
getUUID()
Returns the UUID of the method object
Property Details
code
var method = form.newMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
showInMenu
var method = form.newMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
Methods Details
getArguments()
var frm = solutionModel.getForm("myForm");
var button = frm.getButton("button");
// get the arguments from the button.
// NOTE: string arguments will be returned with quotes (comp.onAction.getArguments()[0] == '\'foo\' evals to true)
var arguments = button.onAction.getArguments();
if (arguments && arguments.length > 1 && arguments[1] == 10) {
// change the value and assign it back to the onAction.
arguments[1] = 50;
button.onAction = solutionModel.wrapMethodWithArguments(button.onAction,arguments);
}
getName()
var method = form.newMethod('function original() { application.output("Original function."); }');
application.output('original method name: ' + method.getName());
application.output('original method code: ' + method.code);
method.code = 'function changed() { application.output("This is another function."); }';
method.showInMenu = false;
var button = form.newButton('Click me!', 10, 10, 100, 30, method);
getScopeName()
var methods = solutionModel.getGlobalMethods();
for (var x in methods)
application.output(methods[x].getName() + ' is defined in scope ' + methods[x].getScopeName());
getUUID()
var method = form.newMethod('function original() { application.output("Original function."); }');
application.output(method.getUUID().toString());