This section describes how you can add an integer entry field to your interface.
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.
This section explains the arguments used in the various integer entry field macros
(cx-create-integer-entry parent label row column)
Argument | Type | Description |
---|---|---|
parent | object | The name of the table that you are adding the integer entry field to |
label | string | The name of the integer entry field to be displayed on the GUI |
row | symbol/int | When added to a table, signifies the row that the integer entry field is added to |
column | symbol/int | When 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.
(cx-set-integer-entry intentry value)
Argument | Type | Description |
---|---|---|
intentry | object | The variable you used to create the integer entry field |
value | integer | The value you want to set the integer entry field to |
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 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.