In CompositePanel expose a getter for your texbox and then invoke
getValue() on it?

Best regards,

Alfredo

On Sat, Apr 14, 2012 at 10:17 AM, tong123123 <[email protected]> wrote:

> as shown in the attached image, if I want to access the value of the
> textbox with value "value2" (the textbox in the second row after the "add"
> button"), how to do it as seem there is no a specific name to access it.
>
> the code is as follow:
>
>> package com.mycompany.project.client;
>>
>> import com.google.gwt.event.dom.client.ClickEvent;
>> import com.google.gwt.event.dom.client.ClickHandler;
>> import com.google.gwt.user.client.ui.Button;
>> import com.google.gwt.user.client.ui.FlowPanel;
>> import com.google.gwt.user.client.ui.Widget;
>>
>> public class HATestPanel extends FlowPanel{
>>
>>  Button btnAdd = new Button("Add");
>>  Button btnListWidget = new Button("List Widget");
>>
>>  public void onLoad(){
>>
>>   this.add(btnAdd);
>>   btnAdd.addClickHandler(new ClickHandler(){
>>
>>    @Override
>>    public void onClick(ClickEvent event) {
>>     // TODO Auto-generated method stub
>>     CompositePanel compositePanel = new CompositePanel();
>>     ((HATestPanel)((Button)
>> event.getSource()).getParent()).add(compositePanel);
>>    }
>>
>>   });
>>
>>   }
>> }
>>
>
> and the implementation of  CompositePanel is as follow:
>
>> package com.mycompany.project.client;
>>
>> import com.google.gwt.user.client.ui.FlowPanel;
>> import com.google.gwt.user.client.ui.HorizontalPanel;
>> import com.google.gwt.user.client.ui.Label;
>> import com.google.gwt.user.client.ui.ListBox;
>> import com.google.gwt.user.client.ui.TextBox;
>>
>> public class CompositePanel  extends HorizontalPanel{
>>
>>  protected void onLoad(){
>>   ListBox lb = new ListBox();
>>   TextBox txt2 = new TextBox();
>>   lb.addItem("field1");
>>   lb.addItem("field2");
>>   lb.addItem("field3");
>>   this.add(lb);
>>   this.add(txt2);
>>  }
>>
>> }
>>
>
> maybe my design is poor, any better method suggested?
> in reality, the listbox is used for user select "searc field", and the
> textbox is for user enter search value for that search field.
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/Rc2QBu_9m6MJ.
> 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.
>



-- 
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM:  lawwton

-- 
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