getMethodTriggerEventName()?

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

getMethodTriggerEventName()?

Postby chartpacs » Mon Jul 24, 2006 8:40 pm

Hello,

I'm basically thinking out load here, but for a given form, we might have separate methods for onShow, onRecordSelection, onDataChange, etc., and I would imagine the amount of code in each method isn't that much, so it might help from an organization standpoint to have a single method in each form dedicated to processing these events. Maybe something like:
Code: Select all
var eventName   = application.getMethodTriggerEventName();
var elementName = application.getMethodTriggerElementName();

if (eventName == 'onShow')
{
   // do stuff
}
else if (eventName == 'onDataChange')
{
   if (elementName == 'fld_first_name')
   {
      // do more stuff
   }
}
:
:
:


Might be helpful. I don't know.

Regards,
Sean
User avatar
chartpacs
 
Posts: 188
Joined: Wed May 10, 2006 6:50 pm
Location: Cleveland, OH

Postby IT2Be » Tue Jul 25, 2006 10:46 am

Nope, just use seperate methods for seperate functions.

Combining these like you suggest will not make your code more accessible. When you are strict in your naming conventions you will benefit from it.

But ok, that's just an opinion...
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby grahamg » Tue Jul 25, 2006 8:57 pm

I agree with Marcel - well it's the safest option :)

I used to use the flexibility of Javascript to combine lots of functions in a single method. But coming back a year or two later you have to try to remember which mega-Method holds the function you are looking for - and then scroll down through a couple of screens of 'if' and 'switch' groups.

Now seperate functions and use Method name to describe whats happening - ie: onShow_focusSurname or onDataCh_Surname_checkDups. Saves a lot of time later.

Regards


Graham Greensall
Worxinfo Ltd
grahamg
 
Posts: 752
Joined: Fri Oct 03, 2003 3:15 pm
Location: Midlands UK

Postby IT2Be » Tue Jul 25, 2006 9:07 pm

Graham, what is the safest option?

Code like described or that you agree with me ;)
Marcel J.G. Trapman (IT2BE)
SAN partner - Freelance Java and Servoy
Servoy Components - IT2BE Plug-ins and Beans for Servoy
ServoyForge - Open Source Components for Servoy
User avatar
IT2Be
Servoy Expert
 
Posts: 4766
Joined: Tue Oct 14, 2003 7:09 pm
Location: Germany

Postby grahamg » Tue Jul 25, 2006 9:47 pm

Marcel - I agree with you of course.

Anyone who is sooo big that their "location" straddles two countries deserves a lot of respect.

Graham
grahamg
 
Posts: 752
Joined: Fri Oct 03, 2003 3:15 pm
Location: Midlands UK


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 11 guests