-
Senior Member
how to find number of lines of dynamic text...and how many lines in textfield [DONE]
is there any way of finding out how many characters will fit in a dynamic textfield?
I have a textfield that is dynamically loaded with text. Sometimes the text is long and i need scroll buttons, but when the text is short i would like not display the scroll buttons.
How can i figure out if text is short enough not to display the scroll buttons?
oh..to make it even more complicated; the font of the text is not always the same. I use textformatting to display header-like lines in the textfield.
Last edited by k/smaert; 05-07-2004 at 12:46 PM.
-
Registered User
hi,
Take a look at TextField.scroll and TextField.maxscroll.
-
Senior Member
maxscroll shows me only how many lines there is in a textfield not how many lines can fit in the height of the textfield.
i need to know how many lines will be visible without scrolling and then compare with the text and see how many lines it is filling
maxscroll is only usuful for the last of these two tasks
-
If you useTextField.autoSize your textfield will increase in size to accomidate more text. You can check to see if _height is greated than you want and add your scroll bars then.
That worked for me.
-
Senior Member
i have a limited space to work on so the textfields have a fixed height....just think it looks stupid to have scrollbars there the times they are not needed...it will only confuse the user
-
The textfield doesn't need to stay big, just test to see if it grew then resize it and add the scroll bars. If it all happens on one frame it is seamless.
-
Also, if you use the scrollPane component that is included with MX and 2004 it will do all of this for you. If the textfield get to big you will get scrollbars.
-
Senior Member
ok...i see what you mean, but i just found the easy way now:
textField.bottomScroll gives me exactly what i need
-
Senior Member
actually i was wrong about bottomScroll i thougth i could use it and compare it with maxscroll.
i wrongly thought that maxscroll would tell me how many lines, but actually what it does is this:
The maxscroll property tells us how far a field can be scrolled (i.e., how far it must be scrolled until the last line becomes visible). It is always the index of the field's last line minus the number of lines that can be displayed in the viewable region at once, plus one.
wich i found at http://skaiste.elekta.lt/Books/O'Rei...on/ch18_04.htm
with this information i figured out that if maxscroll>1 the textfield will need scrolling bars
thanks for your inputs though..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|