Sure - see below:

<ScrollPane>
    <TextArea bxml:id="textArea"/>
    <rowHeader>
        <NumberRuler ruled="$textArea"/>
    </rowHeader>
</ScrollPane>

On Jun 29, 2010, at 9:26 AM, aappddeevv wrote:

> Can you show me what you are saying in bxml? Yes, these things are plopped 
> into a scrollpane, but I am not sure how you would declare it first since it 
> needs to be to the left of the textarea.
>  
> From: Greg Brown [mailto:[email protected]] 
> Sent: Tuesday, June 29, 2010 8:54 AM
> To: [email protected]
> Subject: Re: design help on a skin: how should I reference another component
>  
> You need to declare the TextArea before the ruler - otherwise, the "text" 
> variable will not have been initialized (the same applies to local variables 
> used in a procedural language - you have to define them before you can refer 
> to them). 
>  
> In practice, this generally isn't an issue because you would put the text 
> area (view) and ruler (column or row header) in a scroll pane and declare the 
> view first. 
>  
>  
> On Jun 29, 2010, at 8:29 AM, aappddeevv wrote:
> 
> 
> I attached a line numbering component and its skin. At the moment, I have to 
> tell the line number component which component to “number” by setting the 
> “ruled” property. I would like to have that automatically detected or set via 
> a object reference in bxml.
>  
> Right now, the way to use this is:
>  
> <BoxPane orientation=”horizontal”>
> <NumbersRuler />
> <TextArea bxml:id=”text”/>
> </BoxPane>
>  
> I have tried unsuccessfully to have <NumbersRuler ruled=”$text”/> but I keep 
> getting a bxml error about text not being a component. Should this reference 
> have worked?
>  
> Here’s the error:
> An error occurred while processing  atest.NumbersRuler starting at line 
> number 61:
> java.lang.IllegalArgumentException: Unable to coerce java.lang.String to 
> class org.apache.pivot.wtk.Component.
>  
> There are two other approaches to automatically have this done.
>  
> a)      Be notified once BoxPane is completely loaded. Then numbers ruler 
> could find any text area peers and use that as the ruled component. But I 
> have not found a reliable way to detect when BoxPane has finished being fully 
> loaded. I like this approach but I do not see any way to know when the 
> BoxPane has fully loaded.
> b)      Make the text area a child of the numbers ruler. Use containment to 
> make it easier to set. But then I have to manage the text area child in 
> layout and perhaps the ruler would want to be separated from the text area by 
> another line ruler/decorator. So this is not a great solution future-use wise.
>  
> Is there a better way?
> <pivot-numbersruler.zip>
>  

Reply via email to