Gadgets

Gadgets are retrieved using the Window class gadget method.

This returns a generic Gadget C++ class instance. If anything but the most generic of methods or properties are used it then needs to be cast to the subclass of Gadget for the type of gadget retrieved.

Example 4.6. Getting a WritableField from a window

 // main_window is a tbx::Window
 tbx::WritableField name_field = main_window.gadget(1);
 name_field.text("Hi there"); // Update the fields text

Like the Object class, the Gadget can sometimes be in a state where it does not refer to a gadget. To check for this call the null() method.