Page tree
Skip to end of metadata
Go to start of metadata

Introduction

Checkboxes are a collection of clickable text fields, ordered by rows and columns.
Unlike the Dialogs Toolbox more than one button can become active.

Usage

All defined buttons will be fit into the size defined by w & h.
The only way to read the status of a toolbox control is via the VBS User Interface Event Handlers.

In VBS V1.x the current selection is indicated by a border (whose color can be controlled via miscellaneous properties); in V2.x+ the selection is indicated by a while background (whose color cannot be changed, and also doesn't change when the control is disabled).


Properties

Only properties unique to this control type are listed. For general properties, see the Properties page.

Properties
Name Type Remark Script
type Integer must be 7 (or CT_CHECKBOXES, if using constants) -
style Integer (constant) Display options:
  • 0 (ST_LEFT)  : Text is left-aligned.
  • 1 (ST_RIGHT)  : Text is right-aligned.
  • 2 (ST_CENTER)  : Text is centered.
-
colorText Color Color of text, if not activated. ctrlSetTextColor
colorTextSelect Color Color of text, if activated. ctrlSetActiveColor
colorTextDisable Color No effect, but must be present. -
color Color Color of selection box border, if not activated.
No effect in 2.x+
-
colorSelect Color Color of selection box border, if activated.
No effect in 2.x+
-
colorDisable Color Color of selection box border, if control is ctrlEnable.
No effect in 2.x+
-
rows Integer Number of rows to use. -
columns Integer Number of columns to use. -
strings Array of String Label string for each checkbox entry.
Labels that are too long will be cut off.
-

Example

Will create example as shown at top of this page.

Open with createDialog "Dlg"

class Dlg {
  idd = 20000;
  movingEnable = 1;

  class controls {
    class CHKBOXES {
      idc = 20000;
      type = 7;  // CT_CHECKBOXES
      style = 0; // ST_LEFT
      x = .70; y = .20;
      w = .25; h = .15;
      colorText[] = {1, 0, 0, 1};        // red, unselected text
      colorTextSelect[] = {0, 1, 0, 1};  // green, selected text
      color[] = {0, 0, 1, 1};            // blue, initial box frame
      colorSelect[] = {1, 1, 0, 1};      // yellow, box frame
      colorDisable[] = {0, 0, 0, 1};     // black, frame if disabled
      colorTextDisable[] = {0, 0, 0, 0}; // no function
      font = "TahomaB"; 
      sizeEx = 0.03; 
      rows = 2;                          // arrange in 2 rows
      columns = 3;                       // and 3 columns
      strings[] = {"Entry 0","Entry 1","Entry 2","Entry 3","Entry 4","Entry 5"};
      onCheckBoxesSelChanged = "hint format['Checkbox changed:\n%1\nEntry: #%2\nNewState: %3',(_this select 0),(_this select 1),(_this select 2)];"
    };
  };
};