Retrieving a Pointer to a Control

There are several ways to get the <CONTROL> 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 <CONTROL> pointer. The next example uses the <CONTROL> pointer to read the .TEXT property of the button.

Note : 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: [Picture]