PDA

View Full Version : LabelField + ClickListener



zhyt
15 Jan 2009, 12:37 AM
Hi all. I've got a problem: cannot add a listener to a label. First I tried to use not Extjs LableField, but a just GWT-label:


Label senderLabel = new Label("sender");
senderLabel.addClickListener(new ClickListener() {

public void onClick(Widget sender) {
........
}
});
But this does not suit me, because I need to use Extjs widgets.
So can you please tell me, how to add a listener to an instance of LabelField? And what do I have to do when I use next code:


TextField<String> field = new TextField<String>();
field.setFieldLabel("field");
Can I get a label at this time and add a ClickListner to it?
PS: I found a similar topic here, but there was a resolution for main class in method onModuleLoad() and this doesn's suit mee too.
PPS: sorry for grammar mistakes, I'm not very good at writting English.

gslender
15 Jan 2009, 5:09 AM
you'll need to sink events - read the FAQ

kolli
15 Jan 2009, 11:25 AM
well as gslender was talking about check the mouse events section of the page of how to sink events.

http://extjs.com/learn/Ext_GWT_FAQ#How_do_I_explicitly_listen_for_mouse_clicks_on_a_widget.3F