3.1. Integer Entry (cx-create-integer-entry)

This section describes how you can add an integer entry field to your interface.

3.1.1. Description

This section discusses the ability to add an integer input field to your dialog box. An integer field is created using the cx-create-integer-entry macro. The value of the integer field can be set using the cx-set-integer-entry macro, and the value of an integer field can be obtained using the cx-show-integer-entry macro.

3.1.2. Usage

This section explains the arguments used in the various integer entry field macros

3.1.2.1. cx-create-integer-entry

(cx-create-integer-entry parent label row column)

ArgumentTypeDescription
parentobjectThe name of the table that you are adding the integer entry field to
labelstringThe name of the integer entry field to be displayed on the GUI
rowsymbol/intWhen added to a table, signifies the row that the integer entry field is added to
columnsymbol/intWhen added to a table, signifies the column that the integer entry field is added to

Note:  The row and column attributes are optional. If you leave out one or both of these attributes the integer entry field will be added to the first row/column of the parent attribute and overwrite anything that is already in that spot.


3.1.2.2. cx-set-integer-entry

(cx-set-integer-entry intentry value)

ArgumentTypeDescription
intentryobjectThe variable you used to create the integer entry field
valueintegerThe value you want to set the integer entry field to

3.1.2.3. cx-show-integer-entry

(cx-show-integer-entry intentry)

ArgumentTypeDescription
intentryobjectThe variable you used to create the integer entry field

3.1.3. Integer Entry Example

This example shows how the cx-create-integer-entry, cx-set-integer-entry and cx-show-integer-entry macros work. Once the integer entry field has been created, the initial value of the field is set to 1 via the statement (cx-set-integer-entry intField 1). Next, the value of that integer entry field is incremented to 2 using another cx-set-integer-entry statement. This statement also has a cx-show-integer-entry statement nested in it in order to get the value already in the integer entry field and increment it by 1.

By the time the cx-show-panel statement is read, the value of intField is now 2, so the number 2 appears in the integer entry field when the dialog box is opened. This dialog box does not do anything when the OK button is clicked because we have substituted Boolean values for the apply-cb and update-cb arguments, which would normally be function calls. For more information on the apply-cb and update-cb functions, see cx-create-panel.

(define (apply-cb) #t)
(define update-cb #f)

(define table)
(define intField)

(define my-dialog-box (cx-create-panel "My Dialog Box" apply-cb update-cb))

(set! table (cx-create-table my-dialog-box "This is an example Dialog Box"))

(set! intField (cx-create-integer-entry table "Integer Entry Field"))

(cx-set-integer-entry intField 1)

(cx-set-integer-entry intField (+ 1 (cx-show-integer-entry intField)))

(cx-show-panel my-dialog-box)

To view additional examples of integer entry fields, see Comprehensive Examples.