Working with Embedded Wizard: Creating new components
In Embedded Wizard, every GUI component (be it a simple push button or a complex screen) is implemented as an individual class, descended from the Mosaic class Core::Group. This Mosaic class provides all the basic functionality essential for each GUI component. In particular it takes care of the screen update process and the touchscreen event dispatching. By deriving a new class from Core::Group this class inherits implicitly all its functionality. Thus, in the derived class the functionality can be accessed and, if necessary, even overridden (enhanced or modified) retrospectively.
According to the object-oriented concept, all buttons, sliders, menus, screens, ... you see at the runtime on the display, are just instances of the respective GUI component classes. At the runtime of the application, the instances are created, used and disposed again. Even several instances of one and the same class can co-exist simultaneously, so the user can e.g. interact with several buttons.
Please note the difference between the class and its instances. You can consider the class as a kind of template describing how the corresponding instances should appear and behave at the runtime. The class itself is static and lifeless. Creating an instance of a class brings it finally to life.
Add a new empty GUI component
★First switch to the Composer page for the respective unit member, where you want to add the new GUI component.
★Then, in the Gallery window, ensure that the folder Component Templates is opened.
★Look in the folder for the template named Component.
★With the mouse, select the template and drag it into the Composer.
★Drop the template within the Composer.
As explained in Basic concepts, Embedded Wizard Studio follows a visual programming approach. In this approach the project members are represented by so-called bricks. When you click on a brick, the corresponding member is selected. Thereupon you can move and resize the member within the Composer area. In this manner you can arrange and group the members together.
Name the component
The new created component receives per default a name identifying it uniquely within the current unit e.g. Component6. Thus it is recommended, that after being created you rename the component explicitly according to its later function. For example, if you intend to implement a slider widget, you can name the component Slider.
How components are renamed is described in Name the class.