Clever solution. Approved. On 2011-05-02, at 19:55, Henry Minsky wrote:
> Change hqm-20110502-on8 by [email protected] on 2011-05-02 19:47:46 EDT > in /Users/hqm/openlaszlo/trunk2 > for http://svn.openlaszlo.org/openlaszlo/trunk > > Summary: fix for bidi (TLF) inputtext onchange event > > New Features: > > Bugs Fixed: LPP-9920 > > Technical Reviewer: ptw > QA Reviewer: (pending) > Doc Reviewer: (pending) > > Documentation: > > Release Notes: > > Overview: > > I found what looks like a more approved way to get onchange events for TLF > inputtext > > I had to make a custom EditManager so we can override the "doOperation" > method to discover when the > user edits text field > > > Details: > > use the EditManager.doOperation method to send a Event.CHANGE event, which is > what the old > TextField sent. > > We need to use a different mechanism in LzTextSprite to get the text > field height than we were using with TextField; we have a hack in > there now which shoves a test string into the field and measures it. > In the TLFtextField, that messes up focus. But luckily there is > a cached text height value we can use. > > > > > Tests: > > + examples/components/bidi_component_sampler.lzx > > edittext field should work properly now, no errors when entering text > > test/tlf/focus-input.lzx: > type into the RTL field, and see that each keystroke or edit command is > mirrored in the > text field below, showing that onchange/ontext events are working for TLF > text field > > > other test case: > > <canvas width="100%" height="80%" > > <view id="s1" x="20" y="20" hasdirectionallayout="true" > layout='spacing:10'> > <edittext width="200" text="disabled" enabled="false"/> > <view> > <inputtext x='4' y='4' id='i1' width='200' > bgcolor='#cccccc'>input text</inputtext> > </view> > > <edittext id='e1' width="200" text="XX YY ZZ"/> > > </view> > > > <text x='800' y='60' text="${'i1: '+i1.text}"/> > > <text id="cons" multiline="true" x="800"/> > <handler name="onidle" reference="lz.Idle"> > cons.setAttribute('text', 'focus: '+lz.Focus.getFocus()); > </handler> > > > </canvas> > <!-- * X_LZ_COPYRIGHT_BEGIN > *************************************************** > * Copyright 2001-2008, 2010, 2011 Laszlo Systems, Inc. All Rights Reserved. > * > * Use is subject to license terms. > * > * X_LZ_COPYRIGHT_END ****************************************************** > --> > <!-- @LZX_VERSION@ --> > > > Files: > M test/tlf/focus-input.lzx > M WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as > A WEB-INF/lps/lfc/kernel/swf9/LzEditManager.as > M WEB-INF/lps/lfc/kernel/swf9/LzTextContainerManager.as > M WEB-INF/lps/lfc/kernel/swf9/LzInputTextSprite.as > M WEB-INF/lps/lfc/kernel/swf9/LzTLFTextField.as > M WEB-INF/lps/lfc/kernel/swf9/Library.lzs > > Changeset: http://svn.openlaszlo.org/openlaszlo/patches/hqm-20110502-on8.tar
