We will see what is a checkbox and how to use it.
Definition: A checkbox is useful if we want to use a control that has two state. When clicked the event will receive the new state of the control so it is possible to specify the behavior based on the state of the checkbox.
For example, consider a checkbox control, as follows:
How to create it?
This is specified using the following code
It is possible to apply the following events to a checkbox
- Visible: The condition requires to show the control
- Enable: The condition requires to enable the control
- Action: Define the action that will be done when the control is clicked
- Pressed: Define the initial state of the checkbox (checked or not)
Let’s add the following events to the checkbox:
- When the user click on the checkbox to check it then display a message box saying “Check-box pressed”
- When the user click on the checkbox to un-check it then display a message box saying “Check-box NOT pressed”
- Define the initial state of the checkbox as checked