-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have a textbox where the contents can be quite huge. Does anyone know of some way to avoid storing the entire contents in a String? I need to be able to scroll the entire content, so I don't see maxlength as an option.
Any ideas would be welcome.
Thanks
hi Meh,
do you mean you want the textbox show a very long string as multi line?
try the simple sample below.
<window title="My First Window" border="normal" width="400px"> <textbox id="tb" multiline="true" rows="6" width="350px" /> <button label="set content"> <attribute name="onClick"> StringBuilder sb = new StringBuilder(""); for (int i = 0;i != 200;i ++) { sb.append("a very long content, "); } tb.setValue(sb.toString()); </attribute> </button> </window>
Hi Benbai,
Thanks for the tip, but I think I will have to put a limit on the size of an uploaded text file that a user is allowed to edit. From both the application's and the user's point-of-view, it is probably not practical to try to edit large text files in a textbox...
Best Regards,
meh
Hi Meh,
maybe you can check the length of a string directly by length() API before set it into the value of textbox,
or check the size of a file directly by length() API before process it.
Asked: 2011-07-13 06:41:41 +0800
Seen: 188 times
Last updated: Jul 14 '11