Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

value

Arguments: standard-object

Returns the value of the value property of the argument. The value property holds the value of a control or component. The format of the value depends on the type of component (it might be a number, a string, a boolean (t or nil), etc.) Often the value is changed by user action, usually in a dialog displayed precisely to get user input.

(setf value) may be called to change the value of a control programmatically. The appearance of the control will update to reflect the new value, just as if the user had specified the new value interactively. If the control has an on-change event handler function, and the on-change-test function of the control determines that the new value is considered to be different from the previous value, then the on-change function is called. (To change the value without invoking the on-change function, call initialize-value instead.)

For controls with a range (such as a trackbar or a combo-box), it is an error to specify a value, either initially with the :value init argument or with setf of value, outside the range.

See also fetch-control-value, which forces the operating system to update the value of a control. There are cases (discussed in the description of that generic function) where the value returned by value might be out of date.

A troubleshooting note: if (setf value) does not update a widget

If you call (setf value) and notice that the widget is not redrawn to display the new value as expected, the problem may be that the widget's on-change-test function regarded the new value as being equivalent to the old one, and therefore that no updating was needed. This problem can be remedied by changing the on-change-test to a function that properly returns nil for any two values that should be considered distinct. In particular, if you destructively modify the object that is the current value of a widget, and then set the value of the widget to be that same modified object, then the default on-change-test function (widget-value-equal) will return true because the new and old values are eq, and the widget's appearance will not be updated. Specifying nil as the on-change-test will avoid the problem in special cases such as this, by causing the new and old values never to be regarded as equivalent.

recursive-p optional argument to (setf value)

(setf value) takes an additional optional argument called recursive-p. This argument will be true if (setf value) is being called due to the user modifying a widget interactively, such as by typing into a text widget. An application should not pass this value as true, but it might be informative in a wrapper method.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version