We will almost certainly support horizontal alignment in the future. Vertical 
alignment is less likely.

Note that Label supports both vertical and horizontal alignment, and wrapping 
text. Maybe Label would suit your needs?

On Feb 13, 2010, at 6:05 PM, Rostislav Krasny wrote:

> I think the main problem here is that we can align a BoxPane but not
> the text in the TextArea itself. It produces many strange behaviors.
> For example this is how horizontal alignment to right side looks like:
> 
> http://i49.tinypic.com/sytr1v.png  (Pivot application)
> http://i50.tinypic.com/t6z9g6.png (WordPad)
> 
>               TextArea textArea = new TextArea();
>               textArea.setEditable(true);
> 
>               BoxPane pane1 = new BoxPane(Orientation.VERTICAL);
>               pane1.add(textArea);
> 
>               StyleDictionary dict = pane1.getStyles();
> //            dict.put("verticalAlignment", VerticalAlignment.BOTTOM);
>               dict.put("horizontalAlignment", HorizontalAlignment.RIGHT);
> //            dict.put("fill", Boolean.TRUE); // disables horizontal alignment
> 
>               ScrollPane pane2 = new 
> ScrollPane(ScrollBarPolicy.FILL_TO_CAPACITY,
> ScrollBarPolicy.FILL_TO_CAPACITY);
>               pane2.setView(pane1);
> 
>               window = new Window(pane2);
>               window.setTitle("Test application");
>               window.setMaximized(true);
>               window.open(display);
> 
> Is it possible, in some future version of Pivot, to add a support of
> text alignments (horizontal and vertical) into the TextArea?
> 
> 
> On Sun, Feb 14, 2010 at 12:05 AM, Greg Brown <[email protected]> wrote:
>> It is not a bug. ScrollPane only introduces scroll bars as needed, based on 
>> the preferred size of the view component. When you set scroll policy to 
>> "always", the view is always given its preferred size. That means there will 
>> be no extra vertical space in which to align the content, to bottom, top, or 
>> otherwise.
>> 
>> I doubt the app in the screen shot is implemented as a text area in a scroll 
>> pane. As I recall, Win32 does not have a dedicated "scroll pane" class - it 
>> only has scroll bars, so it is up to the app to decide how to handle 
>> scrolling. Pivot's ScrollPane class allows an application to implement most 
>> common scrolling scenarios very easily, but it may not handle all scenarios. 
>> In those cases, you can use ScrollBar directly.
>> 
>> 
>> On Feb 13, 2010, at 4:56 PM, Rostislav Krasny wrote:
>> 
>>> Yes, with ScrollBarPolicy.FILL_TO_CAPACITY as the vertical
>>> ScrollBarPolicy it works correctly. Thank you.
>>> 
>>> But why can't one use ScrollBarPolicy.ALWAYS vertical ScrollBarPolicy
>>> with VerticalAlignment.BOTTOM? Isn't it a bug? I've seen a Win32
>>> native application (mIRC IRC client) that behaves that way.
>>> http://i45.tinypic.com/21eaqm1.png
>>> 
>>> On Sat, Feb 13, 2010 at 11:17 PM, Greg Brown <[email protected]> wrote:
>>>> Ah, that is correct. You can't use a scroll policy of "always" to get this 
>>>> behavior. You need to use "fill_to_capacity".
>>>> 
>>>> On Feb 13, 2010, at 3:48 PM, Rostislav Krasny wrote:
>>>> 
>>>>> Unfortunatelly it doesn't work:
>>>>> 
>>>>>               TextArea textArea = new TextArea();
>>>>>               textArea.setEditable(true);
>>>>> 
>>>>>               BoxPane pane1 = new BoxPane(Orientation.VERTICAL);
>>>>>               pane1.add(textArea);
>>>>> 
>>>>>               StyleDictionary dict = pane1.getStyles();
>>>>>               dict.put("fill", Boolean.TRUE);
>>>>>               dict.put("verticalAlignment", VerticalAlignment.BOTTOM);
>>>>> 
>>>>>               ScrollPane pane2 = new ScrollPane(ScrollBarPolicy.ALWAYS,
>>>>> ScrollBarPolicy.ALWAYS);
>>>>>               pane2.setView(pane1);
>>>>> 
>>>>>               window = new Window(pane2);
>>>>>               window.setTitle("Test application");
>>>>>               window.setMaximized(true);
>>>>>               window.open(display);
>>>>> 
>>>>> 
>>>>> On Sat, Feb 13, 2010 at 10:11 PM, Greg Brown <[email protected]> wrote:
>>>>>> You'll need to put the text area in a container that is capable of 
>>>>>> aligning its content to bottom. Try using a vertical BoxPane will the 
>>>>>> "fill" style set to true and the "verticalAlignment" style set to 
>>>>>> "bottom". You can then use that as your scroll pane's view.
>>>>>> 
>>>>>> On Feb 13, 2010, at 3:07 PM, Rostislav Krasny wrote:
>>>>>> 
>>>>>>> It works. Thank you very much.
>>>>>>> 
>>>>>>> I've yet another question. How can I align the text vertically? I want
>>>>>>> it to be aligned to the bottom side.
>>>>>>> 
>>>>>>> On Sat, Feb 13, 2010 at 9:55 PM, Greg Brown <[email protected]> wrote:
>>>>>>>> Try replacing this:
>>>>>>>> 
>>>>>>>>> pane.add(textArea);
>>>>>>>> 
>>>>>>>> with this:
>>>>>>>> 
>>>>>>>>  pane.setView(textArea)
>>>>>>>> 
>>>>>>>> G
>>>>>>>> 
>>>>>>>> On Feb 13, 2010, at 2:41 PM, Rostislav Krasny wrote:
>>>>>>>> 
>>>>>>>>> Hi,
>>>>>>>>> 
>>>>>>>>> I use Pivot 1.4. I'm trying to make a window with a scroll pane and a
>>>>>>>>> text area within it. Following is code of my startup() method.
>>>>>>>>> 
>>>>>>>>>               TextArea textArea = new TextArea();
>>>>>>>>>               textArea.setEditable(true);
>>>>>>>>> 
>>>>>>>>>               ScrollPane pane = new ScrollPane(ScrollBarPolicy.ALWAYS,
>>>>>>>>> ScrollBarPolicy.ALWAYS);
>>>>>>>>>               pane.add(textArea);
>>>>>>>>> 
>>>>>>>>>               window = new Window(pane);
>>>>>>>>>               window.setTitle("Test application");
>>>>>>>>>               window.setMaximized(true);
>>>>>>>>>               window.open(display);
>>>>>>>>> 
>>>>>>>>> However the text area has zero size dimensions and cannot be used. How
>>>>>>>>> can I layout the text area according to the scroll pane dimensions
>>>>>>>>> automatically?
>>>>>>>>> 
>>>>>>>>> Thank you
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>> 
>> 

Reply via email to