I assume you are using Pivot 1.4? The problem is that the Label instances are
not direct descendants of the Form.Section. In Pivot 1.4 and earlier, this
throws an exception. In Pivot 1.5+, an exception is not thrown, but you still
won't see the labels attached to your Label elements - forms only recognize
labels attached to section children.
Also, a Border can only have one content element. You'll need to nest a layout
container in the Border instance if you want to display multiple child elements.
On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
> I am trying to use Label along with Form such as
> <BoxPane
> styles="{horizontalAlignment:'left'}">
> <Form
> wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
> <sections>
>
> <Form.Section>
>
> <Border styles="{backgroundColor:null, padding:2}">
>
> <content>
>
> <Label Form.label="name" textKey="name" styles="{font:{size:12,
> bold:true}}"/>
>
> </content>
>
> </Border>
>
> </Form.Section>
>
> <Form.Section>
>
> <Border styles="{backgroundColor:null, padding:2}">
>
> <content>
>
> <Label Form.label="symbol" textKey="symbol"
> styles="{horizontalAlignment:'right'}"/>
>
> <Label Form.label="bid" textKey="bid"
> styles="{horizontalAlignment:'right'}"/>
>
> <Label Form.label="ask" textKey="ask"
> styles="{horizontalAlignment:'right'}"/>
>
> <Label wtkx:id="changeLabel" Form.label="change" textKey="change"
> styles="{horizontalAlignment:'right'}"/>
>
> <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed"
> styles="{horizontalAlignment:'right'}"/>
>
> </content>
>
> </Border>
>
> </Form.Section>
> ...
>
>
> But I am getting following error:
> Caused by: java.lang.reflect.InvocationTargetException at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused
> by: java.lang.IllegalStateException at
> org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
>
>
> Looking at the source, this happens when the attributes of component are
> null. Any idea how to fix it?
>
> Thanks.
>
>
> ______________________________________________
>
> See http://www.peak6.com/email_disclaimer.php
> for terms and conditions related to this email