This section describes how you can add a real number entry field to your interface.
This section discusses the ability to add a real number input
field to your dialog box. A real number field is created using the cx-create-real-entry
macro. The value of the real number
field can be set using the cx-set-real-entry
macro, and the value of a real number field can be obtained using
the cx-show-real-entry
macro.
This section explains the arguments used in the various real number entry field macros
(cx-create-real-entry parent label row column)
Argument | Type | Description |
---|---|---|
parent | object | The name of the table that you are adding the real number entry field to |
label | string | The name of the real number entry field to be displayed on the GUI |
row | symbol/int | When added to a table, signifies the row that the real number entry field is added to |
column | symbol/int | When added to a table, signifies the column that the real number entry field is added to |
Note: The row and column attributes are optional. If you leave out one or both of these attributes the real number 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-real-entry realentry value)
Argument | Type | Description |
---|---|---|
realentry | object | The variable used to create the real number entry field |
value | real | The value that you want to set the real number entry field to |
This example shows how the cx-create-real-entry
, cx-set-real-entry
and cx-show-real-entry
macros work. Once the real number entry field has been created,
the initial value of the field is set to 0.7
via the statement (cx-set-real-entry realField 0.7)
. Next, the value of that integer entry field is increased to 1.2
using another cx-set-real-entry
statement. This statement also has a cx-show-real-entry
statement nested in it in order to get the value already in the
integer entry field and add 0.5
.
By the time the cx-show-panel
statement
is read, the value of realField
is now 1.2
, so the number 1.2
appears
in the real number 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 realField) (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! realField (cx-create-real-entry table "Real Entry Field")) (cx-set-real-entry realField 0.7) (cx-set-real-entry realField (+ 0.5 (cx-show-real-entry realField))) (cx-show-panel my-dialog-box)
To view additional examples of real number entry fields, see Comprehensive Examples.