Neale
1
Servoy 2.2rc3, java 1.5 on Linux…
I have occasions to show a list or records in a dialogue, for the operator to choose one (which is referencable as the current record on that form).
Or, the operator can cancel the operation. In this case, we want there to be no current record so run a method:
foundset.clearFoundSet();
application.closeFormDialog();
This works just fine if the method is local to the form in the dialogue. But, making this method a global method causes it to fail:
“foundset” is not defined.
Is there any reason this shouldn’t work?
Thanks,
Neale.
Backer
2
Hi Neale,
In global method you have to specify the form name, like
forms[formName].foundset.clearFoundSet();
Backer
Pilot Simple Software
Neale
3
But… the purpose of it being a global method was so that several different forms could share the one method.
Unless you are saying I can programatically determine the form name and use a construct literally like:
forms[formName].foundset.clearFoundSet();
But that doesn’t seem to stack up, as if it’s the case then Servoy surely should associate “foundset” with that formname?
Thanks,
Neale.
Neale:
But… the purpose of it being a global method was so that several different forms could share the one method.
Correct but on what foundset whould you be working?
Tip: check “currentform” in manual
Neale
5
Jan Blok:
Neale:
But… the purpose of it being a global method was so that several different forms could share the one method.
Correct but on what foundset whould you be working?
Hmmm… what else but the foundset of the form from which the global method was run?
Jan Blok:
Tip: check “currentform” in manual
Did you mean “currentcontroller”?
Ah… Nope: using “currentcontroller.foundset…” gets me “The undefined value has no properties.”.
Any more pointers?
Thanks,
Neale.
IT2Be
6
Ah… Nope: using “currentcontroller.foundset…” gets me “The undefined value has no properties.”.
From what form are you using the current controller? If it is not the main form e.g. the form is in a tabpanel you can’t use it.
What you could do is call the method with a variable (being the form name) with:
globals.methodname(formname);
or
Then in the global method you would do:
var formname=arguments[0];
or you can do:
var formname=application.getMethodTriggerFormName();
Hope this helps (a little)
Neale
7
IT2BE:
Ah… Nope: using “currentcontroller.foundset…” gets me “The undefined value has no properties.”.
From what form are you using the current controller? If it is not the main form e.g. the form is in a tabpanel you can’t use it.
The form is displayed in a dialogue (no tab-panels implicated).
IT2BE:
[snip]
or you can do:
var formname=application.getMethodTriggerFormName();
Hope this helps (a little)
Eureka! The working result is:
var formname = application.getMethodTriggerFormName();
forms[formname].foundset.clearFoundSet();
application.closeFormDialog();
Thanks to all who contributed,
Neale.