[messages] [Technical Support & Bugs] Re: Numeric characters truncated during editing
Joel Uckelman
uckelman at nomic.net
Tue Jan 31 23:04:18 MST 2012
Thus spake irishwulf:
> I think I have this reproducible, and I think I know why it happens.
> StringConfigurer fires a propertychangeevent on key release, which then
> updates propertychangelisteners, (I think) including the actual source
> attribute. However, when I am making a lot of edits I am often typing
> very fast - so say I am changing a marker 'Cost_1' with value '6' to
> marker 'Cost_2' with value '5', I will backspace the '1', type '2', hit
> TAB _immediately_, such that the key release is (I imagine) fired for
> the TAB, and not the 2, and change the marker value. Clicking 'OK'
> probably only helps because it forces me to pause long enough in the
> field for the key release event to fire appropriately and update the
> propertychangelisteners. So, to reproduce:
> (1) Create a marker trait
> (2) Start to type for the name of the marker 'MyProp_y'. As quickly as
> possible after hitting the 'y', tab to the next field.
> (3) Reenter the marker, observe, hopefully, 'MyProp_'.
>
> Supposedly the correct design for listening to changes to JTextFields is
> by using either TextEvents or DocumentEvents, not KeyEvents. Sorry it
> took so long to come up with a reproducible pattern, but I hope that
> helps.
I switched StringConfigurer to use DocumentEvents in the svn8054 build:
http://www.vassalengine.org/~uckelman/builds/
1) Does this resolve the problem for you?
2) Does this break anything else? Spend some time checking places where
there are text fields.
--
J.
More information about the messages
mailing list