How to get combobox from handler change event method?

552 views
Skip to first unread message

CF

unread,
Aug 30, 2012, 5:48:13 PM8/30/12
to google-we...@googlegroups.com
I have several GXT SimpleComboBoxes to which I've added a ValueChangeHandler.  
        combo1.addValueChangeHandler( new ValueChangeHandler<String>() {    
            @Override
            public void onValueChange( ValueChangeEvent<String> event ) {
                ...
            }
        });

Is there a way to get the combo box (here, "combo1") that the handler is responding to from within onValueChange() ?  Basically, I'm going to be adding the same handler to many combo boxes, and I want to be able to figure out which one I have and do stuff to them after the user makes a selection.

Thanks for any suggestions.

Jens

unread,
Aug 30, 2012, 6:02:00 PM8/30/12
to google-we...@googlegroups.com
What about something like:

Object source = event.getSource();
if(source == combo1) {
.....
} else if(source == combo2) {
.....
}

-- J.

CF

unread,
Aug 30, 2012, 6:23:31 PM8/30/12
to google-we...@googlegroups.com
Perfect, thanks!
Reply all
Reply to author
Forward
0 new messages