QT Class RadCheckBox

 

Overview

The RadCheckBox class implements a checkbox with a text label.

A RadCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an application that can be enabled or disabled without affecting others, but different types of behavior can be implemented depending upon the check box manager Lambda (see the setMgr method).

Check Boxes in the IDE Debugger Tab

The Debugger tab contains three check boxes with labels of JitON, ErrorON, and TriceOnClick. These are used to set the state of the Debugger in the IDE. The Lisp source file Ais/Tutorial_IDE/ideMgr.sl contain the code which creates these three check box controls.

IDE Debugger Tab

new

Overview

The new function creates a new RadCheckBox object and returns a pointer to the newly created object. The RadCheckBox is one of the class key words accepted by the qt new: function. There can be many RadCheckBox objects.

 

Syntax

(qt new: RadCheckBox: checkboxlabel CheckBoxMgr)

Arguments

checkboxlabelA string describing the checkbox.
CheckBoxMgr(Optional)The checkbox manager lambda to manage the RadCheckBox object.
ReturnsAlways returns a pointer to the newly created RadCheckBox object.

The RadCheckBox responds to only one event - the KeyPress event. The RadCheckBox manager, if present, is invoked when the KeyPress event occurs. If the RadCheckBox manager Lambda contains a member Lambda named "press", then the press Lambda will be invoked when the KeyPress event occurs; otherwise the RadCheckBox manager Lambda itself will be invoked when the KeyPress event occurs. For example:

        ;; The RadCheckBox manager may contain a press member and it may return a value to the calling program.
        (lambda (...) (defun press(...) (writeln "If I exist, I will be invoked on a KeyPress event") 0))
        ;; The RadCheckBox manager may contain no press member and it may return a value to the calling program.
        (lambda (...) (writeln "There is no press member, So I will be invoked on a KeyPress event") 1)
        

 

Example1

(defun tabMgr(...) true) ;; Perform noop tab managment
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "caps") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "CAPS") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "caps" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "CAPS"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window
(qt mainWindow: maximize:) ;; Display the main window

delete

Overview

The delete function destroys a RadCheckBox object and returns a null pointer.

 

Syntax

(qt delete: RadCheckBoxPtr)

Arguments

radCheckBoxPtrThe pointer to the RadCheckBox object to be destroyed.
ReturnsAlways returns a null pointer.

 

Example1

(setq radCheckBoxPtr (qt new: RadCheckBox: "BLUE" Bluetextmgr)) ;; Create a RadCheckBox object.
(setq radCheckBoxPtr (qt delete: radCheckBoxPtr)) ;; Destroy the RadCheckBox object.

getCheckState

Overview

The RadCheckBox getCheckState function returns the state of the checkbox. It can either be unchecked (0), partially checked (1), or checked (2).

 

Syntax

(setq myCheckState (qt radCheckBoxPtr getCheckState:))

Arguments

myCheckStateReturns 0 if unchecked, Returns 1 if partially checked or Returns 2 if checked.

 

Example1

(defun tabMgr(...) true) ;; Perform nothing if Tab is clicked -- tab managment
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "caps") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "CAPS") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "caps" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "caps"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window
(qt mainWindow: maximize:) ;; Display the main window

setCheckState

Overview

The RadCheckBox setCheckState function sets the state of the checkbox. It can either be set to unchecked (0), partially checked (1), or checked (2).

 

Syntax

(qt radCheckBoxPtr setCheckState: state)

Arguments

stateThe state can either be a 0 to indicate unchecked or 1 to indicate partially checked or 2 to indicate checked.
trueAlways returns true

 

Example1

(defun tabMgr(...) true) ;; Perform nothing if Tab is clicked -- tab managment
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "caps") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "CAPS") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "caps" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "caps"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window
(qt mainWindow: maximize:) ;; Display the main window
(sleep 10000.0) ;; Wait
(qt radCheckBoxCAPPtr setCheckState: 2) ;; Set the checkbox labeled "CAPS" to "checked" (checkBoxCAPSMgr) ;; Set the checkbox labeled "CAPS" to "checked"

getText

Overview

The RadCheckBox setText function gets the text contents of the display pane next to the checkbox.

 

Syntax

(setq myTextPtr (qt radCheckBoxPtr getText:))

Arguments

myTextPtr Always returns check box text pointer

 

Example1

(defun tabMgr(...) true) ;; Perform nothing if Tab is clicked -- tab management
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; If checkbox is unchecked, then leave as is
(qt radCheckBoxCAPPtr setText: "caps") ;; leave the checkbox label as is "caps"
(qt radCheckBoxCAPPtr setText: "CAPS") ;; else change the checkbox label to "CAPS:
) ;;
true) ;; Return true
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "Original" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "original"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window labeled "original"
(qt mainWindow: maximize:) ;; Display the main window
(sleep 10000.0) ;; Wait
(setq myText (qt radCheckBoxCAPPtr getText:)) ;; get the checkbox label (qt radCheckBoxCAPPtr setCheckState: (integer (= myText "Original"))) ;; get the checkbox label

setMgr

Overview

The RadCheckBox setMgr function sets a lisp function name to manage the behavior of a checked box.

The RadCheckBox responds to only one event - the KeyPress event. The RadCheckBox manager, if present, is invoked when the KeyPress event occurs. If the RadCheckBox manager Lambda contains a member Lambda named "press", then the press Lambda will be invoked when the KeyPress event occurs; otherwise the RadCheckBox manager Lambda itself will be invoked when the KeyPress event occurs. For example:

        ;; The RadCheckBox manager may contain a press member and it may return a value to the calling program.
        (lambda (...) (defun press(...) (writeln "If I exist, I will be invoked on a KeyPress event") 0))
        ;; The RadCheckBox manager may contain no press member and it may return a value to the calling program.
        (lambda (...) (writeln "There is no press member, So I will be invoked on a KeyPress event") 1)
        

 

Syntax

(qt setMgr: mgrLambda)

Arguments

mgrLambda A name of a lambda function
true Always returns true

 

Example1

(defun tabMgr(...) true) ;; Perform nothing if Tab is clicked -- tab managment
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "caps") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "CAPS") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "caps" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "caps"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window
(qt mainWindow: maximize:) ;; Display the main window
(sleep 10000.0) ;; Wait
;;
(defun checkBoxCAPSMgr2(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "new mgr") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "NEW MGR") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt radCheckBoxCAPPtr setMgr: checkBoxCAPSMgr2) ;; Set the checkbox labeled "CAPS" to "checked"

setText

Overview

The RadCheckBox setText function sets a descriptive Text next to the checkbox.

 

Syntax

(qt radCheckBoxPtr setText: text)

Arguments

text A string describing the checkbox
true Always returns true

 

Example1

(defun tabMgr(...) true) ;; Perform nothing if Tab is clicked -- tab managment
(defun checkBoxCAPSMgr(...) ;; Perform CAPS checkbox requests
(if (= (qt radCheckBoxCAPPtr getCheckState:) 0) ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "caps") ;; Perform CAPS checkbox requests
(qt radCheckBoxCAPPtr setText: "CAPS") ;; Perform CAPS checkbox requests
) ;; Perform CAPS checkbox requests
true) ;; Perform CAPS checkbox requests
;;
(qt mainWindow: setTitle: (append "My QT CheckBox Demo")) ;; Set the main window title
(setq radCheckBoxCAPPtr (qt new: RadCheckBox: "caps" checkBoxCAPSMgr)) ;; Create a new RadCheckBox object labeled "caps"
(setq tabIndex (qt mainWindow: addTab: radCheckBoxCAPPtr "CheckBox" tabMgr)) ;; Add a new checkbox to the main window
(qt mainWindow: maximize:) ;; Display the main window
(sleep 10000.0) ;; Wait
(qt radCheckBoxCAPPtr setCheckState: 2) ;; Set the checkbox labeled "CAPS" to "checked" (checkBoxCAPSMgr) ;; Set the checkbox labeled "CAPS" to "checked"