ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Check Box control
  • Overview
  • Initializing the different options of a Check Box control
  • Retrieving the value of an option of a Check Box control
  • In WINDEV and WINDEV Mobile
  • Modifying the colors of a Check Box control row by row
  • Modifying the caption characteristics
  • Properties specific to Check Box controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
WINDEV, WINDEV Mobile and WEBDEV allow you to handle a Check Box control through programming. To do so, use the variable of the Check Box control in the code.
The variable of the Check Box control corresponds to the name of the Check Box control. This variable is an integer.
WINDEV Remark: Several WLanguage functions are used to add, insert or delete options in a Check Box control. For more details, see Check Box control management functions.
Initializing the different options of a Check Box control
By default, no option is checked when a Check Box control is displayed.
To check an option of a Check Box control, you can use:
  • the direct assignment:
    <Check Box control>[Option index] = 1

    <Check Box control>[Option index] = True
  • the Value property:
    <Check Box control>[Option index].Value = True


    <Check Box control>[Option index].Value = 1
To clear an option of a Check Box control control, you can use:
  • the direct assignment:
    <Check Box control>[Option index] = 0

    <Check Box control>[Option index] = False
  • the Value property.
    <Check Box control>[Option index].Value = 0

    <Check Box control>[Option index].Value = False
Remark: If the control is associated with a data file item, the assignment is automatically performed via:
WINDEV If the undefined status of an option is supported ("Details" screen of the control description or TriState), the following syntax is used to initialize the option in the undefined status:
<Check Box control>[Option index] = -1
Retrieving the value of an option of a Check Box control
WINDEVUniversal Windows 10 AppJava

In WINDEV and WINDEV Mobile

To retrieve the value of an option, use the following syntax:
<Option_Value> = <Check Box control>[Option index]

In this case, <Option_Value> is a boolean set to:
  • True (1) if the box is checked,
  • False (0) if the box is unchecked.
  • WINDEVWindows -1 if the box is undefined (if this state is supported by the option).
Remark: If the control is bound to a data file item, the value entered in the control is automatically updated in the data source using ScreenToFile. For more details, see Linking a Check Box control to an item.
WINDEV
Modifying the colors of a Check Box control row by row
To modify the colors of a Check Box control row by row, use the following syntax:
<Check Box control>.Caption = gPen(<Color option 1>) + <Caption option 1> + TAB + ...
gPen(<Color of option N>) + <Caption of option N>

<Color of option> corresponds to:
Modifying the caption characteristics
The Caption property allows you to:
  • change the caption of the Check Box control:
    <Check Box control>.Caption = <Control caption>
  • change the caption for all the options of the Check Box control:
    The options must be separated by the TAB character. You can specify the first options only.
    <Check Box control>.Caption = <Option 1> + TAB + <Option 2> + TAB + <Option 3> ...
  • change the caption of an option:
    <Check Box control>[Option index].Caption = <New option caption>
  • retrieve the caption of an option:
    <Option caption> = <Check Box control>[Option index].Caption
WINDEV If the Check Box control is using a display mode with images and/or sub-captions, you can:
  • get and set the image of the option with the Image property:
    <Check Box control>[Option index].Image = <New image>
  • get and set the sub-caption of the option with the SubCaption property:
    <Check Box control>[Option index].SubCaption = <New sub-caption>
  • get and set the height of the option with the Height property:
    <Check Box control>[Option index].Height = <New height in pixels>
Properties specific to Check Box controls
The following properties are used to manage the characteristics of a Check Box control by programming.
BackgroundColorGets and sets the background color of the Check Box control.
CaptionGets and sets the caption of Check Box control or the caption of an option in the Check Box control.
ColorGets and sets the color of options in the Check Box control.
CountGets the number of options in a Check Box control.
HeightGets and sets the option height (for the Check Box controls that are using a display mode with an image and/or a sub-caption).
HorizontalAlignmentGets and sets the horizontal alignment of a control.
ImageGets and sets the image associated with an option (if the Check Box control uses a display mode with an image).
InitialValueGets the initial value of a Check Box control.
NumberColumnGets the number of columns in the Check Box control.
SubCaptionGets and sets the sub-caption of an option (if the Check Box control uses a display mode with sub-captions).
TriStateAllows you to manage the three states of an option in a Check Box control (checked, unchecked, undefined).
VerticalAlignmentGets and sets the vertical alignment of a control.

For a complete list of WLanguage properties that can be used with a Check box control, see Properties associated with a Check Box control.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help