Next Previous Up Top Contents Index

8.11 DUIM-Gadgets Module

<text-gadget>

Open abstract class

Summary

The class of all text gadgets.

Superclasses

<value-gadget> <action-gadget>

Init-keywords

text:
An instance of type <string>. Default value: "".

value-type:
An instance of type <type>. Default value: <string>.

value-changing-callback:

An instance of type false-or(<function>).

Library

duim-gadgets

Module

duim-gadgets

Description

The class of all text gadgets. You should not create a direct instance of this class.

The text: init-keyword specifies a text value for the combo box.

The value-type: init-keyword specifies the type of the gadget value of the text gadget, which by default is <string>. Other supported types are <integer> and <symbol>. The string entered in the text gadget is parsed, and converted to the appropriate type automatically.

Text gadgets have a method on gadget-value that converts the gadget-text based on the gadget-value-type, for example converting the string to an integer for value-type: <integer>.

The gadget-text generic function always returns the exact text typed into a text gadget. However, gadget-value always returns a "parsed" value of the appropriate type, depending on the value of gadget-value-type. If the string contains any characters that are not appropriate to the gadget-value-type (for example, if the string contains any non-integers, and the gadget-value-type is <integer>), then gadget-value returns #f.

Setting the gadget value "prints" the value and inserts the appropriate text into the text field.

The value-changing-callback: init-keyword allows you to specify a callback that is invoked as the value of the text gadget is changing during the course of "casual" typing. Generally, this means when the user is typing text, but before the text is committed (usually by pressing the RETURN key).

Conversely, the value-changed callback of a text gadget is invoked when the change to the gadget value is committed (again, usually by pressing the RETURN key).

The action required to "commit" a text change is defined by the back-end for the platform that you are writing for, and is not configurable.

Operations

gadget-text

Example

contain(make(<text-field>, value-type: <integer>
             text: "1234"));

See also

<combo-box>, page 544

gadget-value-type, page 593

<password-field>, page 624

<text-editor>, page 673

<text-field>, page 674


Functional Developer Library Reference: DUIM - 3 Dec 1998

Next Previous Up Top Contents Index