You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by ke...@sz.murata.com.cn on 2010/06/29 06:41:23 UTC

how to set setPreferredHeightLimits for text area in the wtkx fil

Dear All,

I would like to ask how to set setPreferredHeightLimits for text area in
the wtkx file?
For example,I would like limit the max line is 5.
Thanks a lot.
<TextArea wtkx:id="TextArea1"  preferredWidth="120" preferredHeight="120"/>

Best regards,
Ken Jiang

*******************************************
Murata Electronics Trading  (Shenzhen) Co.,Ltd
Tel:86-755-82847251
E-mail:kenjiang@sz.murata.com.cn
*******************************************


RE: how to set setPreferredHeightLimits for text area in the wtkx fil

Posted by aappddeevv <aa...@verizon.net>.
That would be a nice feature. Could that be calculated using script?

 

From: Chris Bartlett [mailto:cbartlett.x@googlemail.com] 
Sent: Tuesday, June 29, 2010 6:24 AM
To: user@pivot.apache.org
Subject: Re: how to set setPreferredHeightLimits for text area in the wtkx
fil

 

I have attached some example code.

On Tue, Jun 29, 2010 at 4:36 PM, Chris Bartlett <cb...@googlemail.com>
wrote:

Ken,

 

I don't think there is a way to do this with Pivot at the moment, but it
would be a useful feature to have.  (Also for ListView rows, TableView rows
and maybe TreeView nodes)

For the moment, you could create a custom subclass of TextArea which would
have a 'maxLines' property and getMaxLines() / setMaxLines(int lines)
accessors.

 

In the setMaxLines(int lines) method, you would have to write some custom
code to calculate the correct height, and then call the setHeight(int
height) method of the parent TextArea.

(or setMinimumPreferredHeight() / setMaximumPreferredHeight() )

You would have to decide what to do if the text in the TextArea uses
multiple fonts / sizes / styles.

 

Once you have created your class (and ensured it is on the classpath), you
can alter your wtkx file.

 

<TextArea wtkx:id="TextArea1" preferredWidth="120" preferredHeight="120"/>

would become something like

<MyTextArea wtkx:id="TextArea1" preferredWidth="120" maxLines="5"
xmlns="com.mycompany.pivot.wtk" />

 

Regards,

 

Chris

 

 

On Tue, Jun 29, 2010 at 11:41 AM, <ke...@sz.murata.com.cn> wrote:


Dear All,

I would like to ask how to set setPreferredHeightLimits for text area in
the wtkx file?
For example,I would like limit the max line is 5.
Thanks a lot.
<TextArea wtkx:id="TextArea1"  preferredWidth="120" preferredHeight="120"/>

Best regards,
Ken Jiang

*******************************************
Murata Electronics Trading  (Shenzhen) Co.,Ltd
Tel:86-755-82847251
E-mail:kenjiang@sz.murata.com.cn <ma...@sz.murata.com.cn>

*******************************************

 

 


Re: how to set setPreferredHeightLimits for text area in the wtkx fil

Posted by Chris Bartlett <cb...@googlemail.com>.
I have attached some example code.

On Tue, Jun 29, 2010 at 4:36 PM, Chris Bartlett
<cb...@googlemail.com>wrote:

> Ken,
>
> I don't think there is a way to do this with Pivot at the moment, but it
> would be a useful feature to have.  (Also for ListView rows, TableView rows
> and maybe TreeView nodes)
> For the moment, you could create a custom subclass of TextArea which would
> have a 'maxLines' property and getMaxLines() / setMaxLines(int lines)
> accessors.
>
> In the setMaxLines(int lines) method, you would have to write some custom
> code to calculate the correct height, and then call the setHeight(int
> height) method of the parent TextArea.
> (or setMinimumPreferredHeight() / setMaximumPreferredHeight() )
> You would have to decide what to do if the text in the TextArea uses
> multiple fonts / sizes / styles.
>
> Once you have created your class (and ensured it is on the classpath), you
> can alter your wtkx file.
>
> <TextArea wtkx:id="TextArea1" preferredWidth="120" preferredHeight="120"/>
> would become something like
> <MyTextArea wtkx:id="TextArea1" preferredWidth="120" maxLines="5"
> xmlns="com.mycompany.pivot.wtk" />
>
> Regards,
>
> Chris
>
>
> On Tue, Jun 29, 2010 at 11:41 AM, <ke...@sz.murata.com.cn> wrote:
>
>>
>> Dear All,
>>
>> I would like to ask how to set setPreferredHeightLimits for text area in
>> the wtkx file?
>> For example,I would like limit the max line is 5.
>> Thanks a lot.
>> <TextArea wtkx:id="TextArea1"  preferredWidth="120"
>> preferredHeight="120"/>
>>
>> Best regards,
>> Ken Jiang
>>
>> *******************************************
>> Murata Electronics Trading  (Shenzhen) Co.,Ltd
>> Tel:86-755-82847251
>> E-mail:kenjiang@sz.murata.com.cn <E-...@sz.murata.com.cn>
>> *******************************************
>>
>>
>

Re: how to set setPreferredHeightLimits for text area in the wtkx fil

Posted by Chris Bartlett <cb...@googlemail.com>.
Ken,

I don't think there is a way to do this with Pivot at the moment, but it
would be a useful feature to have.  (Also for ListView rows, TableView rows
and maybe TreeView nodes)
For the moment, you could create a custom subclass of TextArea which would
have a 'maxLines' property and getMaxLines() / setMaxLines(int lines)
accessors.

In the setMaxLines(int lines) method, you would have to write some custom
code to calculate the correct height, and then call the setHeight(int
height) method of the parent TextArea.
(or setMinimumPreferredHeight() / setMaximumPreferredHeight() )
You would have to decide what to do if the text in the TextArea uses
multiple fonts / sizes / styles.

Once you have created your class (and ensured it is on the classpath), you
can alter your wtkx file.

<TextArea wtkx:id="TextArea1" preferredWidth="120" preferredHeight="120"/>
would become something like
<MyTextArea wtkx:id="TextArea1" preferredWidth="120" maxLines="5"
xmlns="com.mycompany.pivot.wtk" />

Regards,

Chris


On Tue, Jun 29, 2010 at 11:41 AM, <ke...@sz.murata.com.cn> wrote:

>
> Dear All,
>
> I would like to ask how to set setPreferredHeightLimits for text area in
> the wtkx file?
> For example,I would like limit the max line is 5.
> Thanks a lot.
> <TextArea wtkx:id="TextArea1"  preferredWidth="120" preferredHeight="120"/>
>
> Best regards,
> Ken Jiang
>
> *******************************************
> Murata Electronics Trading  (Shenzhen) Co.,Ltd
> Tel:86-755-82847251
> E-mail:kenjiang@sz.murata.com.cn <E-...@sz.murata.com.cn>
> *******************************************
>
>

Re: how to set setPreferredHeightLimits for text area in the wtkx fil

Posted by Greg Brown <gk...@mac.com>.
There is currently no way to specify a max line count. However, you can specify a maximum preferred height. If you multiple the font height by 5 and use this as the value for the maximumPreferredHeight attribute, it will produce the same result as setting the max line count to 5.

Greg

On Jun 29, 2010, at 12:41 AM, kenjiang@sz.murata.com.cn wrote:

> 
> Dear All,
> 
> I would like to ask how to set setPreferredHeightLimits for text area in
> the wtkx file?
> For example,I would like limit the max line is 5.
> Thanks a lot.
> <TextArea wtkx:id="TextArea1"  preferredWidth="120" preferredHeight="120"/>
> 
> Best regards,
> Ken Jiang
> 
> *******************************************
> Murata Electronics Trading  (Shenzhen) Co.,Ltd
> Tel:86-755-82847251
> E-mail:kenjiang@sz.murata.com.cn
> *******************************************
>