montnaro@spyder.crd.ge.com (Skip Montanaro) (12/14/90)
I'm using Motif 1.0.3 from ICS on a Sun-4. A very simple application
displays two XmText widgets in an XmRowColumn widget, one editable, the
other not. Pardon the fact that the following code is not C. I think it can
be followed. (It's from an interpreted object-oriented system developed here
called LYMB.) Motif_text is the class. The @ message sets the current
resource name of the object (text_1 or text_2), while the : message sets the
value of the resource. The various *_action= messages set the name of an
LYMB "actions" object to be invoked from the corresponding callback
function.
motif_row_column new: rc
parent= motif
create!
;
motif_text new: text_1
parent= rc
@ `columns' : 40
@ `rows' : 1
@ `resizeWidth' : false
@ `resizeHeight' : false
@ `editable' : false
@ `value' : `Hello World (cannot edit)'
activate_action= `activate_text1'
value_changed_action= `value_changed_text1'
modify_verify_action= `modify_verify_text1'
losing_focus_action= `losing_focus_text1'
focus_action= `focus_text1'
create!
;
motif_text new: text_2
parent= rc
@ `columns' : 40
@ `rows' : 1
@ `resizeWidth' : false
@ `resizeHeight' : false
@ `editable' : true
@ `value' : `Hello World (edit this)'
activate_action= `activate_text2'
value_changed_action= `value_changed_text2'
modify_verify_action= `modify_verify_text2'
losing_focus_action= `losing_focus_text2'
focus_action= `focus_text2'
create!
;
Both widgets display correctly, and text_1's value cannot be changed.
Unfortunately, text_1's value_changed action (XmNvalueChangedCallback) still
gets invoked if the user tries to change the value of the widget.
I presume this is a bug in 1.0.3. If the documentation is correct, the
XmvalueChangedCallback should only be invoked after text is actually
inserted or deleted from the widget.
Thx,
--
Skip (montanaro@crdgw1.ge.com)