System Functions
TCB( FILE | OBJECT | WINDOW | CONTROL ) Return active elements
 

This is a +PxPlus Exclusive feature

Format
1. Return open (and accessible) files: TCB( FILE index [,ERR=stmtref ] )
2. Return existing objects: TCB( OBJECT index [,ERR=stmtref ] )
3. Return open windows: TCB( WINDOW index [,ERR=stmtref ] )
4. Return existing controls: TCB( CONTROL index [,ERR=stmtref ] )

Where:

index A numeric value containing either zero (to retrieve the count of elements) or the index of the desired element
stmtref Program line number or statement label to which to transfer control.
   
Description The TCB( FILE | OBJECT | WINDOW | CONTROL index ) function is designed to allow the programmer an easy method to determine which elements are currently in existence/active in the syste,.

In all cases when using this function, if the value in index is zero (0) the function will return the number of currently active elements. For example, TCB(OBJECT 0) will return the total number of objects currently active in the system.

If the value of index is non-zero, it is considered the relative number of the specified element. For example, TCB(WINDOW 2) will return the window number of the second relative window (the window directly behind the current one).

If the value of index is < zero or greater than the number of elements, an Error 41 (Invalid integer encountered) will be generated and an error exception will occur.

   
Format 1 Return open/accessible files

TCB( FILE index [,ERR=stmtref] )

This function will return the count and channel number for open and currently accessible files.

Files that are opened exclusively by objects and thus may not be accessible are not included. If this function is invoked from within an object that does have access to the file, it will be included in the count.

The return value for a non-zero index will be the file channel number. TCB(FILE 1) will always return zero.

   
Format 2 Return objects handles

TCB( OBJECT index [,ERR=stmtref] )

This function will return the count and handle numbers for the ProvideX objects that currently exist in the system.

The return value for a non-zero index will be the object number (handle).

   
Format 3 Return open windows

TCB( WINDOW index [,ERR=stmtref] )

This function will return the count and window numbers for all the windows currently in existence. The values return will reflect the display order of the windows thus, TCB(WINDOW 1) will return current window number.

The return value for a non-zero index will be the window number.

   
Format 4 Return control handles

TCB( CONTROL index [,ERR=stmtref] )

This function will return the count and CTL value associated with all the controls currently in use. This will include all controls in the current window (whether hidden or disable) and controls in any concurrent windows.

Global controls are not accessible.

The return value for a non-zero index will be the CTL value associate with the control.



* Note * When using the TCB( CONTROL index ) function under WINDX the system will have to send the request to the workstation in order to get the value. This can result in performance problems when used repeatedly. It is suggested that if you want to access the list of active controls you should use the FIN (0, "CTLLIST") function which will return a comma separated list of CTL numbers.