CDP Widgets Introduction
The CDP Widget
The above example shows a GUI application containing CDP widgets configured with a light cdp theme. There are also other themes containing a more modern/flat look and feel.
Please, have a look at the Design Mode Manual before starting to create GUI applications. It explains the below and other features in more detail, and provides an overview that is likely to save time later on.
Global features
The widgets included in the CDP widgets package are based on a framework that enables some features to be changed globally for all widgets while the application is running:
- Theme - Set the visual look of all widgets. The feature is commonly used to select between night and day colors to make the screen easy to view both in direct sunlight and in the dark.
- Font - Set the application font to be used by all widgets.
- In Command - Globally enable/disable widgets. This is often used when having multiple GUI applications and only wanting one to operate at the time. The logic for controlling this should be created in CDP.
- Smooth Pixmap - This feature is used to make graphics look good during rotations and other transformations. Turning the feature off might increase performance on systems with limited resources. Note however, that without pixmap smoothing, animated graphics like needles will get pixelated.
- Style - Most users are satisfied with switching themes, but we also support changing styles globally. Note that the current themes do not include styles for all widgets.
In addition to the above features the framework also supports reusing cached dialogs and use of global num/key pads. This is worth noting as it could save a lot of memory in your application.
How to connect GUI to CDP communication objects
The different widgets usually support communication with CDP:
- Properties related to CDP communication are prefixed with cdp.
- Use the filter above the property panel and type cdp, to list all properties related to communication.
- Be aware that most input widgets will both read and write data to the routed communication object. Usually, when you insert a new value, data is sent to the remote object and a timer is started. Then, a few moments later, the remote value is read to ensure that the remote value was actually changed. This ensures that the widget is always in the correct state.
Connecting a line edit widget to a CDP input signal
The following steps describes how to connect a CDPBaseLineEdit to a CDP signal object:
- Locate cdpRouting in the property panel by typing cdp in the filter.
- Type in the full routing to the cdp object, "App.Comp.Signal".
- Changing the value in the line edit, by key pad or keyboard, will update the routed signal value. The widget will update to show new values if the signal is changed externally.
- Note that there are also other routing properties for changing style and toggling the widget hidden and visible state.
Styling by SVG and by widget properties
Some widget properties are set in the SVG that styles the widget, while some are only available in the widget. Some properties can even be changed both by SVG and in the widget properties. Check out the chapter about CDP Widgets Themes (SVG) for more information about SVG properties and how to make new widgets based on SVG (without having to write a single line of code).
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.