Navigation:  Reference > Functions By Category >

The WITH OBJECT command & functions

Previous pageReturn to chapter overviewNext page

Description:

The WITH OBJECT ... END WITH commands and related functions allows you to perform a series of statements on a specified object without requalifying the name of the object. If the qualification path to the object is long, using WITH OBJECT ... END WITH can improve your performance. A WITH OBJECT block also reduces repetitive typing of the qualification path and the risk of mistyping one of its elements.

 

For example, to change a number of different properties on a single object, place the property assignment statements inside the WITH OBJECT ... END WITH, referring to the object only once instead of for each property assignment.

 

The WITH OBJECT ... END WITH commands and related functions have local thread scope .

 

Functions:

WithObjectStackPush( <object> ) -> NIL 

       Add <object> to the top of the withobject stack

 

WithObjectStackTop( [<nDeepLevel>] ) -> <object>

       Retrieve ( without removing) a object from the TOP of the withobject stack

       <nDeepLevel>  Default value is 0 meaning the TOP element

       increase this value to retrieve the parent (nDeepLevel = 1) and succesive ancestor

 

WithObjectStackPop() -> <object>

       Retrieve and remove the object from the TOP of the withobject stack

 

Commands:

#xcommand WITH OBJECT <o> => WithObjectStackPush(<o>)

#xcommand END WITH => WithObjectStackPop()

#xtranslate with.this =>WithObjectStackTop()

#xtranslate .:<*more*> => WithObjectStackTop():<more>

#xtranslate ..:<*more*> => WithObjectStackTop(1):<more>

#xtranslate ...:<*more*> => WithObjectStackTop(2):<more>

#xtranslate ....:<*more*> => WithObjectStackTop(3):<more>

#xtranslate .:(<n>):<*more*> => WithObjectStackTop(<n>):<more>