PDA

View Full Version : Radiobox/group layout horizontal and vertical



stiptkevin
11 May 2010, 1:26 AM
Hello guys,

I'm working on some kind of questionlist in GXT. I have a question with around 20 answeroptions.
I wish to put these options (radioboxes in a group) in a horizantal and vertical position like illustrated below:

A B C D E
F G H I J
K L M N O
P Q R S T

Is this possible in 1 radiogroup?

Thanks,
Kevin

diwakar.kuruba
12 Nov 2010, 12:20 AM
I guess group.setOrientation(Orientation.VERTICAL); might help here if i understood your question correctly!

stiptkevin
15 Nov 2010, 1:30 AM
Thanks, but that is not exactly what i ment.

It's been a while so I already made a fix myself.
I created my own SetOrientationBlockSize method for the MultieField widget

I you make a vertical group with 8 checkboxes it goes like:
1 2 3 4 5 6 7 8
When i make a vertical group, set with my blocksize to 5, it goes:
1 2 3 4 5
6 7 8
So it ends the vertical line after 5 checkboxes and then continues on a new line.

Angelgab82
15 Nov 2010, 2:08 AM
The radioGroup creates a table with tr and td.. if you check it on firebug you will see in your case:

<table>
<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>
<tr><td>6</td><td>7</td><td>8</td></tr>
</table>

Can u show the output of the html?

stiptkevin
15 Nov 2010, 2:57 AM
I checked the html as you asked, it's a bit odd.
But there is some logic in it; it creates 5 vertical blocks and then goes filling it
First block gets 1
...
Fifth block gets 5
First block gets 6
...
Third block gets 8

I hope you understand what i mean :)



<table>
<tr> //the whole table
<td> //the first column
<table>
<tr> <td>1</td> </tr>
<tr> <td>6</td> </tr>
</table>
</td>
<td> // the second column
<table>
<tr> <td>2</td> </tr>
<tr> <td>8</td> </tr>
</table>
</td>
and so on...

sven
15 Nov 2010, 5:58 AM
Nothing like this is implemented. You will need to subclass RadioGroup and change the Layout of the used container to a layout that supports this. TableLayout for example does support it

stiptkevin
15 Nov 2010, 7:05 AM
I know it isn't implemented, I've created the function myself.
I made a subclass of MultiField (which a custom RadioGroup en CheckBoxGroup extends) and made the blocksize part in there myself.