# Problem in laying out a grid and a tree inside an hbox

siamakh
39

I want to layout a tree and a grid inside an hbox so that the tree would take a fixed width and the grid would take the rest. I tried the following but a big whitespace appears between the tree and the grid and also the grid seems weird.

<window title="white space problem" border="normal">
<hbox width="100%">
<tree width="200px">
<treechildren>
<treeitem label="Item 1"/>
<treeitem label="Item 3"/>
</treechildren>
</tree>
<grid width="100%">
<rows><row>Row 1</row></rows>
</grid>
</hbox>
</window>

delete retag edit

## 4 Replies

ansancle
317 9

Specify an absolute width on the window and then divide it up between your tree and grid :

<window title="white space problem" border="normal" width="300px">
<hbox width="100%" >
<tree width="200px">
<treechildren>
<treeitem label="Item 1"/>
<treeitem label="Item 3"/>
</treechildren>
</tree>
<grid width="100px">
<rows><row>Row 1</row></rows>
</grid>
</hbox>
</window>

siamakh
39

Thanks for reply. But that doesn't solve my problem completely. The idea is to use as much of the browser's width as possible. I guess I can check the ClientInfo and read the desktop width but that has its own problems because I am using a similar pattern in many other places in my UI and I do not want to have to update the width in so many places when the desktop width changes. I rather this would be taken care of automatically.

937 2 12

hey there,

use the widths attribute of the hbox, like this:

<window title="white space problem" border="normal" width="100%">
<hbox width="100%" widths="0%,100%">
<tree width="200px">
<treechildren>
<treeitem label="Item 1"/>
<treeitem label="Item 3"/>
</treechildren>
</tree>
<grid width="100%">
<rows><row>Row 1</row></rows>
</grid>
</hbox>
</window>


siamakh
39

Thanks you! That fixed it.

[hide preview]