BB___CHECKBOX

=CHECKBOX= toc

Description
> A CHECKBOX is a //control// on a Graphical User Interface (GUI) window that gives a user a choice of one or more options that are not mutually exclusive. >> See, also, RADIOBUTTONS.

Checkbox Features

 * //**Set and Reset.**// A checkbox can be set or cleared either by mouse-click or programmatically with the **"set"** and **"reset"** commands.
 * //**Changing Label.**// A checkbox "label" cannot be changed after the window is opened.
 * //**Grouping Checkboxes.**// Checkboxes are often grouped within a GROUPBOX in order to keep like choices together. Whether grouped or ungrouped, checkboxes are individually set or reset. Any or all can be set at the same time.

Checkbox Commands
The following commands (Methods) can be used with checkboxes. See the individual pages for discussion. print #handle.ext, "disable" print #handle.ext, "enable" print #handle.ext, "font facename pointSize" print #handle.ext, "setfocus" print #handle.ext, "set" print #handle.ext, "reset" print #handle.ext, "value? status$"

Example
This code demonstrates how to use checkboxes in Just BASIC programs with branch label handlers code format="lb" nomainwin button #1, "&Ok", [quit], UL, 120, 90, 40, 25 checkbox #1.cb, "I am a checkbox", [set], [reset], 10, 10, 130, 20 button #1, "Set", [set], UL, 10, 50 button #1, "Reset", [reset], UL, 50, 50 textbox #1.text, 10, 90, 100, 24

WindowWidth = 180 WindowHeight = 160

open "Checkbox test" for dialog as #1 print #1, "trapclose [quit]"

[inputLoop] input r$

[set] print #1.cb, "set" goto [readCb]

[reset] print #1.cb, "reset" goto [readCb] end

[readCb] print #1.cb, "value?" input #1.cb, t$   print #1.text, "I am "; t$    goto [inputLoop]

[quit] close #1 : end code

This code demonstrates how to use checkboxes in Just BASIC programs with subroutine handlers code format="lb" nomainwin

button #1, "&Ok", [quit], UL, 120, 90, 40, 25 checkbox #1.cb, "I am a checkbox", checkSet, checkReSet, 10, 10, 130, 20 textbox #1.text, 10, 90, 100, 24

WindowWidth = 180 WindowHeight = 160 open "Checkbox test" for dialog as #1 print #1, "trapclose [quit]"

[inputLoop] input r$

sub checkSet cbHandle$ print #cbHandle$, "value? v$" print #1.text, "I am ";v$ end Sub

sub checkReSet cbHandle$ print #cbHandle$, "value? v$"

print #1.text, "I am ";v$ end Sub [quit] close #1 : end code

Useful Functions
code format="lb" Place a useful function using this command here code