jsMethod not fired in find mode

Questions, tips and tricks and techniques for scripting in Servoy

jsMethod not fired in find mode

Postby irenem » Fri Dec 02, 2011 10:34 am

Hello,

My onFind method creates a button with a method, but it doesn't work in find mode.

Code: Select all
   
   var form = controller.getName()
   var frm = solutionModel.getForm(form)
   var ofgMeth = solutionModel.newGlobalMethod('function totRec(event){var source = event.getElementName();globals.g_search = source}')
        var x = frm.newButton('button',0,0,20,20,ofgMeth)
        x.name = 'button'
   forms[form].controller.recreateUI()
        controller.find()


If I remove controller.find() it works.
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: jsMethod not fired in find mode

Postby mboegem » Fri Dec 02, 2011 1:19 pm

did you include something like:
Code: Select all
if(false) controller.search()


in your search method?
Otherwise a method won't be triggered in find mode.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1531
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: jsMethod not fired in find mode

Postby ngervasi » Fri Dec 02, 2011 1:33 pm

In Servoy 6 you don't need that anymore, there is a JSDoc property to allow method execution in Find mode, it's called @AllowToRunInFind, check the docs to know more about it.
ngervasi
 
Posts: 1475
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: jsMethod not fired in find mode

Postby mboegem » Fri Dec 02, 2011 2:57 pm

thnkx Nicola!

with all the nice new features in 6, it's easy to forget some. :-)
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1531
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: jsMethod not fired in find mode

Postby irenem » Fri Dec 02, 2011 4:06 pm

Thank you Nicola,

I will try to find out how it works. I just read the wiki, it's a bit of a jungle. :shock:
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: jsMethod not fired in find mode

Postby irenem » Sat Dec 03, 2011 12:23 pm

Ok, @AllowToRunInFind is added, but it still doesn't work. Could it that it doesn't apply for the solutionModel?

Code: Select all
/**
* @AllowToRunInFind
*
* @properties={typeid:24,uuid:"D4C3C1A6-4266-480F-969A-16B7FDCA3E39"}
*
*/
function onFind()
{
   controller.find()
   var form = controller.getName()
   var frm = solutionModel.getForm(form)
   var ofgMeth = solutionModel.newGlobalMethod('function totRec(event){var source = event.getElementName();globals.g_search = source}')
        var x = frm.newButton('button',0,0,20,20,ofgMeth)
        x.name = 'button'
   forms[form].controller.recreateUI()

}
Irene Meyer

Version: 6.0.5
Java version 1.6.0_29
Mac OS X Version 10.7.3
User avatar
irenem
 
Posts: 279
Joined: Tue Aug 28, 2007 2:09 pm
Location: Netherlands

Re: jsMethod not fired in find mode

Postby mboegem » Sun Dec 04, 2011 11:50 am

Irene, it's the 'ofgMeth' function that should be allowed to run in find mode.

The 'onFind' function will run whenever your solution is still in browse mode.
_____________________
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance SAN Developer

Image
User avatar
mboegem
 
Posts: 1531
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam


Return to Methods

Who is online

Users browsing this forum: No registered users and 7 guests