OUI_Object_Callback()
See also: OpenObjects API
Return to Introduction  Previous page  Next page

This function (in your module) is called by the OpenUI when an object instance of an object that is created with your module's module id # is specified to have specific "actions". The available actions are:

·+   Constructor   This action is called prior to the object's code being executed  
·-   Destructor   This action is called at the end of the screen where this object is executed  
·P   Parser      This action is called "instead" of the normal OUI_Token_Replace().  
 
You specify these actions in the object's flags parameter. For example, to specify all 3 actions above, use the string: actions:+p- in the flags parameter.

You can also call special actions that are not listed above by adding the 3rd parameter to the %OBJ% token. For example:

%OBJ(CHKOUT_LINK|{instance}|FUNCTION)%

would call the OUI_Object_Callback() with FUNCTION for the l.action parameter.

Keep in mind also, that if you specify the instance of an object, no matter how many times you execute that object in your token strings, the CONSTRUCTOR, and DESTRUCTOR will only be called ocne for each object instance.

Example Usage

The example usage for this function is:

<MvFUNCTION NAME = "OUI_Object_Callback" PARAMETERS = "instance VAR, action" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax,expression">  
    <MvASSIGN NAME = "l.retval" VALUE = "{ 1 }">  
 
    <MvCOMMENT>*** For example, we have an object created called 'CHKOUT_LINK' ***</MvCOMMENT>  
    <MvIF EXPR = "{ l.instance:Type EQ 'CHKOUT_LINK' }">  
        <MvIF EXPR = "{ l.action EQ 'CONSTRUCTOR' }">  
             <MvCOMMENT>*** When the object instance is created, this function is called. ***</MvCOMMENT>  
            <MvASSIGN NAME = "l.retval" VALUE = "{ My_CHKOUT_LINK(l.instance) }">  
        </MvIF>  
        <MvIF EXPR = "{ l.action EQ 'PARSE' }">  
             <MvCOMMENT>*** When it's time to parse the OpenTokens, INSTEAD, call this function. ***</MvCOMMENT>  
            <MvASSIGN NAME = "l.retval" VALUE = "{ My_CHKOUT_LINK_Parse(l.instance) }">  
        </MvIF>  
        <MvIF EXPR = "{ l.action EQ 'DESTRUCTOR' }">  
             <MvCOMMENT>*** When the object instance is destroyed, and the end of the screen, this function is called. ***</MvCOMMENT>  
            <MvASSIGN NAME = "l.retval" VALUE = "{ My_CHKOUT_LINK_Destructor(l.instance) }">  
        </MvIF>  
    </MvIF>  
 
    <MvFUNCRETURN VALUE = "{ l.retval }">  
</MvFUNCTION>  

The function above calls these local "example" functions below. The actual functionality in these functions, and inside the function above is completely under your control and doesn't HAVE to follow this example.

<MvFUNCTION NAME = "My_CHKOUT_LINK" PARAMETERS = "instance VAR" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax,expression">  
      <MvCOMMENT>*** Just display a trace HTML tag. ***</MvCOMMENT>  
    <MvEVAL EXPR = "{ asciichar(60) $ 'OUI_Object_CHKOUT_LINK' $ asciichar(62) }">  
    <MvFUNCRETURN VALUE = "{ 1 }">  
</MvFUNCTION>  
 
<MvFUNCTION NAME = "My_CHKOUT_LINK_Parse" PARAMETERS = "instance VAR" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax,expression">  
      <MvCOMMENT>*** Just call the normal OpenUI OUI_Token_Replace() function. ***</MvCOMMENT>  
    <MvDO FILE = "../ui/oui.mvc" NAME = "l.retval" VALUE = "{ OUI_Token_Replace(l.instance:Object) }">  
    <MvFUNCRETURN VALUE = "{ l.retval }">  
</MvFUNCTION>  
 
<MvFUNCTION NAME = "My_CHKOUT_LINK_Destructor" PARAMETERS = "instance VAR" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "syntax,expression">  
      <MvCOMMENT>*** Just display a trace HTML tag. ***</MvCOMMENT>  
    <MvEVAL EXPR = "{ asciichar(60) $ 'OUI_Object_CHKOUT_LINK_Destructor' $ asciichar(62) }">  
    <MvFUNCRETURN VALUE = "{ 1 }">  
</MvFUNCTION>  

 


Send feedback on this documentation.
© 2004 - 2000 Darren Ehlers & OpenUI Developer Consortium