On 5/20/2011 11:03 PM, Craig Mitchell wrote:
> Putting in a 8px right padding for every TextBox is getting annoying.
>  Has anyone got a better fix for this?
>
> <table width="100%">
> <tr>
> <td>
> Title 
> </td>
> <td>
> <g:ListBox ui:field="titleListBox" width="100%" />
> </td>
> </tr>
> <tr>
> <td>
> Name
> </td>
> <td style="padding-right:8px;">
> <g:TextBox ui:field="nameTextBox" width="100%" />
> </td>
> </tr>
> </table>

It sounds like this is a common pattern for you. Create a @UiConstructor
annotated ctor that generates the table, and manages the
instance-specific values of the instantiated controls. You'll have to
track instances of this widget to references to each instantiated
control. You'll also need to declare the namespace in the ui.xml file.

See
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_a_widget

I had a similar use case. I created a custom widget that instantiated
the control pair, and handled the READ case (load a new form using
existing data) by settingthe associated ListBox selected value to match
the current TextBox value.

If I was starting from scratch, I'd probably use Cell widgets.
See http://code.google.com/webtoolkit/doc/latest/DevGuideUiCellWidgets.html

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to