Issue Details (XML | Word | Printable)

Key: LPP-10260
Type: Bug Bug
Status: Verified Verified
Resolution: Fixed
Priority: P1 P1
Assignee: Max Carlson
Reporter: Daniel Ju
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

DHTML - <scrolledittext/> - The scorll bar can't be appeared when input enough text

Created: 11/Sep/12 01:27 AM   Updated: 06/Dec/12 12:41 AM
Component/s: Kernel - DHTML
Affects Version/s: 5.0b1
Fix Version/s: 5.0b3

Time Tracking:
Not Specified

Severity: Major
Runtime: N/A
Flags: SDK
Fix in hand: False


 Description  « Hide
Test case:
----------------------------------------
<canvas>
    <include href="incubator/scrolledittext.lzx"/>
    <scrolledittext name="_inp" x="160" y="20" width="100" height="100">
     </scrolledittext>
</canvas>
----------------------------------------

Steps:
Input enough text (more than 10 lines)

Expected:
The scroll bar should be appeared just like swf10

Got:
The scroll bar can't be appeared

Comments:
Build number: 19763
It occurs on dhtml runtime for all supported browsers
For Chrome21, it occurs more worse.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
gary liu added a comment - 28/Nov/12 07:02 PM - edited

The reason is that the attribute scroll and scrollheight of _newinternalinputtext(name is inp) in class scrolledittext can not be updated when entering the text. But if use code inp.setAttribute("text", "ds\n\sd\ndf\nfgn\ndf\n\dfsd\n\ndfsd\nfsd"), the scrollbar will work well. Because that setAttribute("text",) will call method __updatefieldsize, this method will update attribute scroll and scrollheight.

The resolution is call __updatefieldsize to update attribute scroll and scrollheight when ontext of inp or onchange of LzInputText.lzs. There are two ways to fix this as below.

a. add below code in line 127 under node _newinternalinputtext of file incubator/scrolledittext.lzx
<handler name="ontext">
            if ($dhtml) this.sprite.__updatefieldsize();
        </handler>
b. add below code in line 202 in function inputtextevent of file lps/views/LzInputText.lzx
if (changed && $dhtml) this.isprite.__updatefieldsize();

The way a is a little change only effect class scrolledittext. But b will resolve all input scroll issue when input with attribute scrollevents="true" multiline="true" .

gary liu added a comment - 28/Nov/12 07:30 PM
The way b will cause build error because that JavaScriptEngine.java not allow to call private method __updatefieldsize(); in LzInputText.lzs.

Philip Romanik added a comment - 30/Nov/12 08:40 AM
(b) can still work; you just have to rewrite the code slightly. This is what I did to verify this change:

         // LPP-10260
        if ($dhtml) {
            if (changed) this.tsprite.__updatefieldsize();
        }

- I added a comment to label the jira task.
- I split your conditional into two lines. The compiler can parse the build type, and everything else should go into a separate conditional.
- I changed isprite to tsprite because __updatefieldsize is defined in LzTextSprite. This will work fine using isprite, but it indicates where __updatefieldsize() can be found.


Looks good. WIth these changes you should check it in.

gary liu added a comment - 04/Dec/12 07:48 PM - edited
r19886 | gliu | 2012-12-05 11:46:55 +0800 (Wed, 05 Dec 2012) | 28 lines
Changed paths:
   M /openlaszlo/trunk/WEB-INF/lps/lfc/views/LzInputText.lzs

Change Gary-20121205-qbR by Gary@LASZLO-THINK on 2012-12-05 11:22:28 CST
    in /cygdrive/c/d/olcode/src/svn/openlaszlo/trunk/WEB-INF/lps/lfc/views
    for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc/views

Summary: bug fixing LPP-10260

New Features:

Bugs Fixed: LPP-10260

Technical Reviewer: Phil
QA Reviewer: dju
Doc Reviewer: (pending)

Documentation:

Release Notes:

Overview:


Details:
call method __updatefieldsize to update scrollHeight to make scroll work for DHTML

Tests:
JIRA test case

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/Gary-20121205-qbR.tar

Daniel Ju added a comment - 06/Dec/12 12:31 AM
Build number: 19886
It works on all supported combinations

Daniel Ju added a comment - 06/Dec/12 12:41 AM
Another issue relates it which is LPP-10306