PDA

View Full Version : Mouse Events for FormPanel



user4
26 Jan 2009, 5:32 AM
Hi, I am trying to implement MouseDown, MouseOver and MouseOut Events for FormPanel. I understand that broweser events are received on Component object, but i am only able to receive the MouseDown event, MouseOver and MouseOut events are never executed.
What am i doing wrong? Here is the code:



FormPanel simple = new FormPanel();
simple.setFrame(true);
simple.setWidth(350);
simple.setBorders(false);
simple.setBodyBorder(false);
simple.setStyleAttribute("border", "0px");
simple.setFrame(false);
simple.setHeaderVisible(false);
Draggable d = new Draggable(simple);

simple.addListener(Events.OnMouseDown, new Listener<ComponentEvent>() {
publicvoid handleEvent(ComponentEvent be) {
FormPanel fp = (FormPanel)be.component;
fp.setStyleAttribute("border", "1px solid blue");
GWT.log("[Events.OnMouseDown]" , null);

}
});
simple.addListener(Events.OnMouseOver, new Listener<ComponentEvent>() {
publicvoid handleEvent(ComponentEvent be) {
FormPanel fp = (FormPanel)be.component;
fp.setStyleAttribute("border", "1px dotted blue");
GWT.log("[Events.OnMouseOver] Listener<ComponentEvent>" , null);

}
});
simple.addListener(Events.OnMouseOut, new Listener<ComponentEvent>() {
publicvoid handleEvent(ComponentEvent be) {
FormPanel fp = (FormPanel)be.component;
fp.setStyleAttribute("border", "0px");
GWT.log("[Events.OnMouseOut] " , null);

}
});


TextField<String> inputField = new TextField<String>();
inputField.setFieldLabel("Label");
simple.add(inputField);


thanks...

sven
26 Jan 2009, 5:34 AM
You need to sink the events.

user4
26 Jan 2009, 5:49 AM
Thanks a lot - it worked