XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 May 26日 10:52

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2017年 Apr 25日 06:14 
Offline
User avatar

Joined: 2013年 Jul 29日 09:13
Posts: 448
This is a how-to showing how to make text in a text box scroll continuously.

There already exists the capability to cause text boxes to scroll:
Code:
    playListText0.enabledHorzScroll="true";
    playListText0.enabledHorzScroll="false";


The text then scrolls but only if the text is longer than its container field. This is a limitation. Other javascript engines allow the text to be scrolled regardless of its length. It can just be set to scroll, the direction can be set and it can be turned on/off as above.

So, some code is needed to overcome XW's inability to scroll text in a text field that is shorter than the field length.

Code:
   
    playListText0.constraints.maxWidth="206"
    // in addition to the following a constraint needs to be set on the field itself, setting the maxwidth in the
    // IDE because any changes to playListText0.text.length are dynamic.
    textLength = playListText0.text.length; // count track name length
    playListText0.width = textLength * 6.5; // set the text field length for the text itself
    playListText0.enabledHorzScroll="true"; //start the scrolling


This shortens the text field dynamically so that it is slightly shorter than the text itself. Therefore any text that is placed into the field with scroll regardless of the initial length of the field or the text length.

A small problem is that any text field background styling displays a foreshortened field. The solution to this is to have another text field below it that is full width which displays the same styling characteristics.

If you have a better method of making text scroll in a text box then post it here as your own how-to.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group