Problem: Getting error "An error occurred when setting the property named 'Font.Color' of the object named '<>' of type
'Field'."
When using ObjectPAL to set the Font.Color from a changeValue() event.
Date: 7 July 1997
Versions: All
Solution to error by: Bertil Isberg
Some operations are not accepted during changeValue() and newValue() event, so you have better to do them later on. The technique is to post an
action to execute when everything has calmed down a little. I did it this way.
method changeValue(var eventInfo ValueEvent)
dodefault
IF self.value = "GO" then
self.postAction(UserAction)
ENDIF
endMethod
method action(var eventInfo ActionEvent)
if eventInfo.id()=UserAction then
self.action(EditEnterFieldView)
self.action(SelectSelectAll)
self.Font.Color = Red
disableDefault ; prevent userAction from bubbling
endif
endMethod
Code is not guaranteed to change the font.color property of the current text, though., but it does not trigger the error.
For some reason, changing Font.Size does not trigger the error, even when done directly in the changeValue() event.