| Did you know ... | Search Documentation: |
| Instance variables |
->enter.
Values are:
Defaults: The initial value is next.
->advance|function->restore’d.->alert
on the text_item.
Defaults: @on
->layout.
The item will be extended towards the item at its right or the
right-side of the dialog window.<-value_font’s ex
units (see font<-ex).
See also text_item->value_width.<-selection
converted to text. It is used to detect if the user has modified the
selection.
<-modified->selection
and text_item<-selection
if the text has been edited by the user.Defaults: @on
<-value_set
or do completion on the basis of their associated text_item<-type.
In both cases, visualisation by means of a combo box
provides useful feedback to the user as well as a commonly found user
interface style.
text_item<-style
combo_box is automatically selected after text_item->value_set
or
text_item->type
with a suitable type. It may be switched afterwards.
A text item showing as a combo-box both supports completion and opening the combo-box.
Style stepper shows a small up/down arrow at the right
of the text-entry-field. Pressing this field invokes text_item->increment
and
text_item->decrement,
holding the mouse-button down repeats this message. This style is used
by class int_item.
Applications may use it to implement -for example- an ordinal scale.
<->type
slot describes the value-type represented by the text_item. When a value
is displayed, it is translated into a string using
object<-print_name.
After editing, it is translated into a PCE
object of the specified type using type<-check.
Slot text_item<-type
is set by text_item->default,
where it is deduced from the initial value. When the value is an
integer, the type is int. Otherwise the type describes the
class the selection belongs to.
If the type can generate a value_set (see type<-value_set
and
text_item<->value_set,
the text_item->style
will automatically be changed to
combo_box.
EXAMPLE
?- new(P, picture),
send(P, display, new(B, box(100,100))),
send(new(D, dialog), below, P),
send(D, append,
text_item(size, B?size,
message(B, size, @arg1))),
send(P, open).
<-check <-print_name|function]*->complete
and text_item<-completions.
The interpretation of this slot is:
<-completions
fails (no completion).<-completions
activates type<-value_set
on the associated
text_item<-type.<-completions
answers with this chain.<-completions
invokes the function and returns the result. During execution of the
function @arg1
is bound to the file return of text_item<-split_completions.
If this function is invoked to generate all values for opening a
combo-box, @arg1
is bound to the empty name (” ). The function is supposed to
return a chain of possible values whose textual description starts with @arg1.
Note that text_item->complete
will not consider elements of the chain whose object<-print_name
does not start with
text_item<-displayed_value.
Using @arg1 to
select candidates is only useful if this speeds up the selection
process.
<-completions ->complete->right_side
is often a comfortable for helping allignment. See also
text_item<-hor_stretch.