You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Michael Allman <ms...@allman.ms> on 2010/07/01 14:53:46 UTC
setting properties on includes
Hi,
I'd like to set some properties on the root element of an included wtkx.
A classic case is setting width and height. How might I go about doing
this?
<wtkx:include src="whatever.wtkx" width="100" height="100"/>
does not work.
Cheers,
Michael
Re: setting properties on includes
Posted by Greg Brown <gk...@mac.com>.
OK, this is fixed. The fix will go in with my next commit.
Thanks for identifying this issue. Major oversight on my part. :-(
On Jul 1, 2010, at 7:28 PM, Greg Brown wrote:
>> I want box1 to have a preferred height of 20 and box2 to have a preferred height of 50. Make sense?
>
> Yup. Great example. I will make this change.
>
Re: setting properties on includes
Posted by Michael Allman <ms...@allman.ms>.
Cool, thanks!
Michael
On Thu, 1 Jul 2010, Greg Brown wrote:
>> I want box1 to have a preferred height of 20 and box2 to have a preferred height of 50. Make sense?
>
> Yup. Great example. I will make this change.
>
Re: setting properties on includes
Posted by Greg Brown <gk...@mac.com>.
> I want box1 to have a preferred height of 20 and box2 to have a preferred height of 50. Make sense?
Yup. Great example. I will make this change.
Re: setting properties on includes
Posted by Michael Allman <ms...@allman.ms>.
Sure. Here's a totally contrived example, but it illustrates a simple use
case---setting the size of an included component.
Suppose my_box.wtkx is
<BoxPane xmlns="org.apache.pivot.wtk">
<Label text="Hey!" />
</BoxPane>
Suppose main_window.wtkx is
<Frame xmlns="org.apache.pivot.wtk" xmlns:wtkx="http://pivot.apache.org/wtkx">
<content>
<BoxPane orientation="vertical">
<wtkx:include wtkx:id="box1" src="my_box.wtkx" />
<wtkx:include wtkx:id="box2" src="my_box.wtkx" />
</BoxPane>
</content>
</Frame>
I want box1 to have a preferred height of 20 and box2 to have a preferred
height of 50. Make sense?
Michael
On Thu, 1 Jul 2010, Greg Brown wrote:
> That's right. We support static setters (attached properties) on
> includes because you don't necessarily know what container the included
> component might be placed in. But we don't support instance setters
> because we assume that you will simply set them within the include
> itself.
>
> It is possible to change this behavior such that instance setters are
> supported on an include - but is there any reason you can't put the
> attributes on the root element of the include instead?
>
> Greg
>
> On Jul 1, 2010, at 5:47 PM, Michael Allman wrote:
>
>> Oh, yeah. I got confused with width and height. It's a flex thing.
>>
>> So I just tried
>>
>> <wtkx:include src="whatever.wtkx" preferredWidth="100" preferredHeight="100"/>
>>
>> and that doesn't work either. I get a message saying "Instance property setters are not supported for wtkx:include tag."
>>
>> What do you think?
>>
>> Cheers,
>>
>> Michael
>>
>> On Thu, 1 Jul 2010, Greg Brown wrote:
>>
>>> Setting properties on an include should work fine. However, if you want to specify the size of a component, you should generally use preferredWidth and preferredHeight rather than width and height. It is up to the container to determine if/how the preferred values should be applied.
>>>
>>> On Jul 1, 2010, at 8:53 AM, Michael Allman wrote:
>>>
>>>> Hi,
>>>>
>>>> I'd like to set some properties on the root element of an included wtkx. A classic case is setting width and height. How might I go about doing this?
>>>>
>>>> <wtkx:include src="whatever.wtkx" width="100" height="100"/>
>>>>
>>>> does not work.
>>>>
>>>> Cheers,
>>>>
>>>> Michael
>>>>
>>>
>
Re: setting properties on includes
Posted by Greg Brown <gk...@mac.com>.
That's right. We support static setters (attached properties) on includes because you don't necessarily know what container the included component might be placed in. But we don't support instance setters because we assume that you will simply set them within the include itself.
It is possible to change this behavior such that instance setters are supported on an include - but is there any reason you can't put the attributes on the root element of the include instead?
Greg
On Jul 1, 2010, at 5:47 PM, Michael Allman wrote:
> Oh, yeah. I got confused with width and height. It's a flex thing.
>
> So I just tried
>
> <wtkx:include src="whatever.wtkx" preferredWidth="100" preferredHeight="100"/>
>
> and that doesn't work either. I get a message saying "Instance property setters are not supported for wtkx:include tag."
>
> What do you think?
>
> Cheers,
>
> Michael
>
> On Thu, 1 Jul 2010, Greg Brown wrote:
>
>> Setting properties on an include should work fine. However, if you want to specify the size of a component, you should generally use preferredWidth and preferredHeight rather than width and height. It is up to the container to determine if/how the preferred values should be applied.
>>
>> On Jul 1, 2010, at 8:53 AM, Michael Allman wrote:
>>
>>> Hi,
>>>
>>> I'd like to set some properties on the root element of an included wtkx. A classic case is setting width and height. How might I go about doing this?
>>>
>>> <wtkx:include src="whatever.wtkx" width="100" height="100"/>
>>>
>>> does not work.
>>>
>>> Cheers,
>>>
>>> Michael
>>>
>>
Re: setting properties on includes
Posted by Michael Allman <ms...@allman.ms>.
Oh, yeah. I got confused with width and height. It's a flex thing.
So I just tried
<wtkx:include src="whatever.wtkx" preferredWidth="100"
preferredHeight="100"/>
and that doesn't work either. I get a message saying "Instance property
setters are not supported for wtkx:include tag."
What do you think?
Cheers,
Michael
On Thu, 1 Jul 2010, Greg Brown wrote:
> Setting properties on an include should work fine. However, if you want to specify the size of a component, you should generally use preferredWidth and preferredHeight rather than width and height. It is up to the container to determine if/how the preferred values should be applied.
>
> On Jul 1, 2010, at 8:53 AM, Michael Allman wrote:
>
>> Hi,
>>
>> I'd like to set some properties on the root element of an included wtkx. A classic case is setting width and height. How might I go about doing this?
>>
>> <wtkx:include src="whatever.wtkx" width="100" height="100"/>
>>
>> does not work.
>>
>> Cheers,
>>
>> Michael
>>
>
Re: setting properties on includes
Posted by Greg Brown <gk...@mac.com>.
Setting properties on an include should work fine. However, if you want to specify the size of a component, you should generally use preferredWidth and preferredHeight rather than width and height. It is up to the container to determine if/how the preferred values should be applied.
On Jul 1, 2010, at 8:53 AM, Michael Allman wrote:
> Hi,
>
> I'd like to set some properties on the root element of an included wtkx. A classic case is setting width and height. How might I go about doing this?
>
> <wtkx:include src="whatever.wtkx" width="100" height="100"/>
>
> does not work.
>
> Cheers,
>
> Michael
>