Retrieving a Pointer to a Control

Description

There are several ways to get the pointer to the control. The first way is to use the .CHILD() method and name the control. These examples refer to a button control, but other types of controls work the same way.

dim ptr as P
dim fld as P
ptr = form.load("Customer Information")
ptr.show()
fld = ptr.child("BUTTON3")
fld.BUTTON_METHOD(arguments) ' now do something with the pointer

If you are writing code to respond to a button event, such as OnPush, you can use the this.this technique to retrieve the pointer. The next example uses the pointer to read the .TEXT property of the button.

The first this says "me" or "my". The second this says "pointer". The result is "my pointer".
dim ctrl as P
ctrl = this.this
ui_msg_box("Button4", "The caption of Button4 is " + ctrl.text)

The result is:

images/Button_4_Pointer_Demo.gif