0

text wrapping in a listcell?

asked 2012-01-11 18:07:35 +0800

jwolfsho gravatar image jwolfsho
57

I have seen some threads regarding this problem, but no definitive answer that works for me, so I thought I would post this question again.

Is there a way to get a long text to wrap within a listcell?

I have tried using the multiline property on the textbox but that does not cause the text to wrap.

Here is my zul code. The long text is in the Comment column.

 <listbox id="lbComments" rows="0" multiple="true">
                            <listhead>
                                <listheader label="ID" visible="false"/>
                                <listheader label="Comment" />
                                <listheader label="Date/Time" width="150px"/>
                                <listheader label="User ID" width="150"/>
                            </listhead>
                </listbox>

Here is my composer code:

 new Listcell(com.id.toString()).setParent(listItem)

                 Listcell lc1 = new Listcell()
                 Textbox comTextBox = new Textbox()
                 comTextBox.width = 1000
                 comTextBox.value = com.pwricmt_comment
                 comTextBox.inplace = true
                 comTextBox.multiline = true
                 comTextBox.setParent(lc1)
                 lc1.setParent(listItem)

Thanks for any help!

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2012-01-12 02:15:37 +0800

RichardL gravatar image RichardL
768 4

It seems that it's not wrapping of text that you're dealing with, it's fitting a textbox component with a fixed width into a listcell. Maybe you could just set the width of the comment column to accommodate the textbox.

link publish delete flag offensive edit

answered 2012-01-12 17:43:52 +0800

jwolfsho gravatar image jwolfsho
57

Richard,

Thanks for your response!

Since some of these texts are quite long, I have decided to try a textarea in place of the fixed width textbox since the textarea will wrap automatically.

Now I have a simpler problem. I need to widen the textarea but I do not see a width attribute on the textarea as there was on the textbox. Any ideas as to how to expand the width of the textarea?

Thanks!

link publish delete flag offensive edit

answered 2012-01-12 19:50:25 +0800

twiegand gravatar image twiegand
1807 3

jwolfsho,

To set the size of a textarea via Java, use setDynamicProperty().  Something like this:

myTextarea.setDynamicProperty("rows", 10);
myTextarea.setDynamicProperty("cols", 50);

Hope that helps,

Todd

link publish delete flag offensive edit

answered 2012-01-12 20:44:15 +0800

jwolfsho gravatar image jwolfsho
57

Todd,

That's exactly what I needed.

Thanks again for your help!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-11 18:07:35 +0800

Seen: 303 times

Last updated: Jan 12 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More