Re: [xwt-users] How to get a sub-box in Lithium?

Charles Goodwin <[email protected]> Tue, 21 Oct 2003 08:56:47 +0000
Newsgroups gmane.comp.java.xwt.users
Organization XWT Foundation - www.xwt.org
Message-ID <[email protected]>
On Tue, 2003-10-21 at 03:21, Jeff Buhrt wrote:
> This is using Lithium...
> If a template contains a another template, how do I get the handle to a 
> sub-box (field)?
> 
> ex: [top]
> 
> ...
> <cardpane>
> <subbox id="subbox" />
> </cardpane>

There's 3 ways.

1) Make the subbox part of the templates redirect:

[subbox.xwt]

<redirect target="x" />
<template>
    <box id="x">
        <box id="subbox_wanted" />
    </box>
</template>

Now you can access $subbox_wanted in top.xwt using $subbox[0].

2) Pass a reference:

[subbox.xwt]

<template>
    wanted_proxy = $subbox_wanted;
    <box>
       <box id="subbox_wanted" />
    </box>
</template>

Now, from top.xwt, $subbox.wanted_proxy can be used to manipulate the
$subbox_wanted box.

3) A combination of the above:

Use a reference to a parent box and have the $subbox_wanted as a child
of the parent - $subbox.wanted_proxy[0]; - which can be useful if you
have lots of internal subboxen that you want to access but don't wish it
to be your redirect target.

- Charlie

-- 
Charles Goodwin <[email protected]>
XWT Foundation - www.xwt.org