Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter NineDialog Functions (continued)

9.12 Checkbox and Radio Controls

9.12.1 Introduction

There are three types of ‘checkbox’ or button controls. These functions address: the check box, the radio control, and the group box. If a resource statement such as AUTOCHECKBOX or RADIOBUTTON is used, the style is automatically set to define the type of control. When the generic CONTROL statement is employed, the appropriate BS_ style must be set such as BS_CHECKBOX or BS_AUTORADIOBUTTON.

When a button is defined as a checkbox, it operates independently of other controls. Checkboxes typically are used to indicate or set a specific condition. Depending on the style, it is either on (checked), off (unchecked) or undefined (tri-state). Control behavior may be automatic or manual. If the BS_AUTOCHECKBOX or BS_AUTO3STATE are not set, then it is expected that the script will check and uncheck the box in response to BN_CLICKED action messages. A common mistake is to fail to set the automatic mode and then expecting the button to check without any supporting code. In many cases, the tri-state behavior is performed manually, depending on context.

Radio buttons, on the other hand, generally operate in context with other radio buttons. Typical usage is to select one item of many, for example, ‘male’ or ‘female’. In such a case when one option is clicked and selected, another radio button will be deselected. When in auto mode, the operating system will automatically deselect other buttons in the group. Therefore, it is critical to group the buttons correctly.

The radio button controls are grouped by controls marked the WS_GROUP window style. All radio controls, in the order of the resource, are grouped. For example:

Control with WS_GROUP
   RadioA
   RadioB
Control with WS_GROUP
   RadioC
   RadioD

When clicked, A and B will interact as well as C and D. The AB group will not affect the CD group. A common problem when multiple groups are used with the auto function is the failure to add WS_GROUP styles in the correct order. An actual group box control is not required, only that a control with WS_GROUP bit style set divides each group of radio controls. The style can be set on any control including the first radio button of a series.

9.12.2 Checkbox Specific Styles

This table has the control styles that directly relate to checkboxes.

  Constant   Description  
  BS_3STATE   Creates a button that is the same as a check box, except that the box can be grayed as well as checked or cleared. Use the grayed state to show that the state of the check box is not determined.  
  BS_AUTO3STATE   Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, indeterminate, and cleared.  
  BS_AUTOCHECKBOX   Creates a button that is the same as a check box, except that the check state automatically toggles between checked and cleared each time the user selects the check box.  
  BS_BITMAP   Specifies that the button displays a bitmap.  
  BS_CHECKBOX   Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).  
  BS_ICON   Specifies that the button displays an icon.  
  BS_PUSHLIKE   Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn’t pushed or checked, and sunken when it is pushed or checked.  

 

9.12.3 Radio Button Styles

This table has the control styles that directly relate to radio controls, other general styles can also be used.

  Constant   Description  
  BS_AUTORADIOBUTTON   Creates a button that is the same as a radio button, except that when the user selects it, the system automatically sets the button’s check state to checked and automatically sets the check state for all other buttons in the same group to cleared.  
  BS_BITMAP   Specifies that the button displays a bitmap.  
  BS_ICON   Specifies that the button displays an icon.  
  BS_PUSHLIKE   Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn’t pushed or checked, and sunken when it is pushed or checked.  
  BS_RADIOBUTTON   Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.  

 

9.12.4 Notifications

See the previous Section 9.11 Button Controls for notification.

9.12.5 Checkbox/Radio Button Functions