You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Edvin Syse <ed...@sysedata.no> on 2011/06/06 20:48:19 UTC

TextInput won't strech to fill it's parent

I have a Form where I want the TextInputs to fill the space horizontally.

 From looking at the code in TerraTextInputSkin, it seems like it only 
cares about textSize, and not the surrounding container's layout 
(Judging from getPreferredSize). I tried putting it in both a GridPane 
and a TablePane, but still it will only stretch when I set the textSize. 
Is this as expected, and is there a workaround?

If I set a large textSize, the TextInput behaves kind of like 
overflow:hidden in CSS.

-- Edvin

Re: TextInput won't strech to fill it's parent

Posted by Edvin Syse <ed...@sysedata.no>.
Den 06.06.2011 20:58, skrev Greg Brown:
>> I have a Form where I want the TextInputs to fill the space horizontally.
>>
>>  From looking at the code in TerraTextInputSkin, it seems like it only cares about textSize, and not the surrounding container's layout (Judging from getPreferredSize).
>
> No components look to their parents for sizing information. It is up to the parent to ask the component how it would like to be sized. textSize simply specifies the text input's preferred width, in characters. To stretch a text input beyond this, you'll need to use a container that will disregard the text input's preferred width. Either Form or a vertical BoxPane with fill=true will do this.

Nice! For some reason I though I had to encapsulate each TextInput in 
something to apply the Form.label, but this worked like a charm:

<TextInput Form.label="Title"/>

.. so now I saved TONS of markup, and fill:true solved my other problem 
as well :))

-- Edvin

Re: TextInput won't strech to fill it's parent

Posted by Greg Brown <gk...@verizon.net>.
> I have a Form where I want the TextInputs to fill the space horizontally.
> 
> From looking at the code in TerraTextInputSkin, it seems like it only cares about textSize, and not the surrounding container's layout (Judging from getPreferredSize).

No components look to their parents for sizing information. It is up to the parent to ask the component how it would like to be sized. textSize simply specifies the text input's preferred width, in characters. To stretch a text input beyond this, you'll need to use a container that will disregard the text input's preferred width. Either Form or a vertical BoxPane with fill=true will do this.

G