Object Functions

Discuss any general programming issues here
Post Reply
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Object Functions

Post by djrikki »

Hi,

Having a little issue here, thought I'd create some object functions rather than my usual approach of prefix naming. Just having a little problem with the InstallEventHandler() command. I have found the solution, but I didn't think that this was necessary.

Code: Select all

p_objMan = {}

Function p_objman:CloseWindow()
 ....    
EndFunction

InstallEventHandler({CloseWindow = p_objman_CloseWindow})

Function p_objman_CloseWindow() p_objman:CloseWindow(False) EndFunction
If I specify InstallEventHandler({CloseWindow = p_objman:CloseWindow}) - program doesn't flow into the object function, I have to call p_objman_CloseWindow() instead which then points to the object function.

I have also generally noticed that I cannot pass parameters to the function through InstallEventHandler().
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
jalih
Posts: 281
Joined: Fri Jun 18, 2010 8:08 pm
Location: Finland

Re: Object Functions

Post by jalih »

Hi, If you insist on using method style semicolon callback calls instead of a basic table based colon notation calls, you can simplify your code to this:

Code: Select all

InstallEventHandler( { CloseWindow = Function () p_objMan:CloseWindow EndFunction  } )
What comes to passing parameters to callback functions, you can pass optional user data to the callback procedure.
Post Reply