Drawback of calling a form method from another form?

Questions, tips and tricks and techniques for scripting in Servoy

Drawback of calling a form method from another form?

Postby Kaptan » Thu Jun 30, 2011 2:26 pm

I was wondering if there is any performance difference in the following 2 scenarios:

1. calling a form method from a method on another form
2. calling a global method

I have a couple of methods on forms that call a method on another form. Some methods are logically grouped under a specific form. But in all of the methods I always avoid using form.x.controller stuff because of the UI updating that isn't needed.
It keeps bugging me that I still have 'forms.x.method()' stuff in my methods, it doesn't feel right because whenever I start lines with 'forms.' I always assume that this has a UI consequence. But is that the case when calling methods? Should I put those methods in globals? (and accept the memory usage in globals, and loose the logical grouping) Am I overseeing something obvious or is this already the best practise?
Sem
Kaptan
 
Posts: 124
Joined: Mon Aug 04, 2008 11:17 pm
Location: Amsterdam

Re: Drawback of calling a form method from another form?

Postby patrick » Thu Jun 30, 2011 2:38 pm

I'd say that calling forms. has the overhead of the form being loaded. So yes, that should be (slightly) slower the first time you call a method on form.x. I can't imagine you will notice any difference though.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Drawback of calling a form method from another form?

Postby Kaptan » Thu Jun 30, 2011 3:03 pm

Ah yes of course :)
That being the case, then it's a pity that you can't call a form method without loading that form. Would love to have something like 'script.' next to 'form.'.

Thanks for the reply!
Sem
Kaptan
 
Posts: 124
Joined: Mon Aug 04, 2008 11:17 pm
Location: Amsterdam


Return to Methods

Who is online

Users browsing this forum: No registered users and 20 guests