Hi Robert, Could you please tell me:
1. what is the purpose behind overriding updateToModel() method? Is it just to do formatting? If so you can use one of the existing IDataType implementations of ULC or implement your own. 2. What exactly are you doing in the reformat() method? When you call UITextComponent#setText() directly (as against getBasicTextComponent().setText()), ULC first removes the document listener, sets the text, and sets the document listener again. This is the reason why: 1. valueChanged event is not generated 2. no formatting is done because it is the document listener which in turn invokes the formatter (i.e. the data type). Kindly provide more details so that we can find an appropriate solution. Thanks and regards, Janak -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of ulc rbeeger Sent: Wednesday, July 12, 2006 3:08 PM To: [EMAIL PROTECTED] Subject: [ULC-developer] UITextField.updateToModel problems Hi! We have an extension that extends ULC/UITextField. We have overridden updateToModel to reformat the typed string after the typing is finished: protected void updateToModel(final boolean displayFormattedValue) { super.updateToModel(displayFormattedValue); if (displayFormattedValue) { getBasicTextComponent().setText(reformat(getBasicTextComponent ().getText())); } } The problem with this is that it sometimes an extra valueChangedEvent after leaving the textfield.An alternative looks like this protected void updateToModel(final boolean displayFormattedValue) { super.updateToModel(displayFormattedValue); if (displayFormattedValue) { setText(reformat(getBasicTextComponent().getText())); } } Now the extra event isn't created, but the text changes to the originally typed in text when the textfield gets the cursor again. For example if I typed in "1020", it is displayed as "10:20" after the reformatting and again as"1020" once I click into the textfield. Is there some way to reformat the text and make it stay reformatted without the extra valueChangedEvent? Cheers and thanks in advance, Robert _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
