Chapter 11: Creating the User Interface
109
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
11.4.2. Dialog Fields
A dialog box consists of one or more fields. For a static dialog box these fields
are defined in a structure which is compiled by the resource compiler into a
DIALOG structure. There are some differences between the fields added with
DialogAdd
and those created with the resource compiler.
•
Precede each of the field types listed below with “D_” to use as the dialog
type to pass to
DialogAdd
. For an example, see the
DialogNew
function.
•
HPOPUP can only be passed to
DialogAdd
, since resources cannot specify
handles.
•
DYNHEADER is only available on the resource compiler, since the header
text can be specified at the time the header is created.
For a dynamic dialog box, each field is added to the dialog box by calling the
DialogAdd
function. The fields are defined in the following paragraphs. Every
field has an associated x and y coordinate which is relative to the dialog box (not
the screen) and a flag byte. The flag byte values are explained after all of the
dialog fields.
11.4.2.1. Field Index
Each dialog field is assigned a field index starting with zero. For static dialogs
this is based on the order they are defined in the resource file. For dynamic
dialogs, it is the order they are added with the
DialogAdd
function. This field
index is passed through the dialog’s call-back function as explained in this
section and the call-back section.
11.4.2.2. DYNPOPUP
char *
TextPtr
, HANDLE (*
GetPopup
) (WORD),
WORD
OptionListIndex
The
TextPtr
and
OptionListIndex
parameters are the same as for a normal
POPUP field. Instead of using the name/address of a statically created pop-up,
the address of a function that returns the address of a dynamically created
pop-up is used. The pop-up may still be statically created but this allows for the
possibility of passing one of several different pop-ups. The
GetPopup
routine is
called with a single value which is the DYNPOPUP’s field index.
11.4.2.3. EDIT_FIELD
char *
TextPtr
, WORD
bOffset
, WORD
Flen
, WORD
Dlen
An EDIT_FIELD is drawn as a box with an optional title. An empty string,
""
, is
used to indicate no title. The field is defined by a string which labels the box, an
offset into the
FieldBuf
array passed to
Dialog
(
bOffset
), the total length of the
field in the Buffer array (
Flen
), and a display length in characters, not pixels
(
Dlen
). The data in the Buffer array is copied to the display when
Dialog
is first