4D v13.4

OBJECT Get pointer

Home

 
4D v13.4
OBJECT Get pointer

OBJECT Get pointer 


 

OBJECT Get pointer ( {selector }{;}{ objectName {; subformName}} ) -> Function result 
Parameter Type   Description
selector  Longint in Object category
objectName  Text in Object name
subformName  Text in Subform object name
Function result  Pointer in Pointer to object variable

The OBJECT Get pointer command returns a pointer to the variable of a form object. 

This command can be used to designate different objects according to the value of the selector parameter. You can pass one of the following constants (found in the "Form objects" theme) in this parameter:

  • Object current or selector omitted: If you omit the selector parameter or pass this selector, the command returns a pointer to the variable associated with the current object (object whose method is executing).
    Note: This is strictly equivalent to the previous functioning of the Self command. This command is only kept for compatibility reasons.
  • Object with focus: If you pass this selector, the command returns a pointer to the variable associated with the object that has the focus in the form. The last two optional parameters are ignored if they are passed.
    Note: This is strictly equivalent to the functioning of the Focus object command. This command is now obsolete beginning with 4D v12.
  • Object subform container: If you pass this selector, the command returns a pointer to the variable bound with the subform container. The last two optional parameters are ignored if they are passed. This selector can therefore only be used in the context of a form used as a subform, so as to access the variable bound with the container object.
  • Object named: If you pass this selector, you must also pass the second parameter, objectName. In this case, the command returns a pointer to the variable associated with the object whose name was passed in this parameter.
    Note: If objectName corresponds to a subform and the "Output subform" option is checked, the command returns a pointer to the table of the subform if a source table is specified; otherwise it returns Nil.

The optional subformName parameter lets you retrieve a pointer to an objectName object that does not belong to the current context, in other words, in the parent form. To be able to use this parameter, you must have passed the Object named selector.
When the subformName parameter is passed, the OBJECT Get pointer command first looks for the subform object named subformName in the current form, then looks inside this subform for an object named objectName. If this object is found, it returns a pointer to the variable of this object.

Example  

Given a form "SF" used twice as a subform in the same parent form. The subform objects are named "SF1" and "SF2". The "SF" form contains an object named CurrentValue. In the "On Load" form event of the form method of the parent form, we want to initialize the CurrentValue object of SF1 to "January" and that of SF2 to "February": 

 C_POINTER($Ptr)
 $Ptr:=OBJECT Get pointer(Object named;"CurrentValue";"SF1")
 $Ptr->:="January"
 $Ptr:=OBJECT Get pointer(Object named;"CurrentValue";"SF2")
 $Ptr->:="February"

 
PROPERTIES 

Product: 4D
Theme: User Interface
Number: 1124

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v12

 
SEE ALSO 

Focus object
Form objects
OBJECT Get name
Object Properties
Self

 
TAGS 

Subform, focus***