GWT UI

5 views
Skip to first unread message

Tom

unread,
Jan 22, 2007, 9:11:27 AM1/22/07
to Google Web Toolkit
Hi friends,
How to implement a right click event on the TreeItem?
Can we change the stylesheet of the treeItem when the application is
running, for example, clicking on button, it will change the stylesheet
of a particular treeItem?

Please explain the procedures, as I am quite new to this field.


Thanks.

darkman97

unread,
Jan 23, 2007, 9:43:30 AM1/23/07
to Google Web Toolkit
One solution is to extend Tree to ExtendedTree and overwrite the method
onBrowserEvent() with some code like this:

public void onBrowserEvent(Event event) {

// When de button mouse is released
mouseX = DOM.eventGetClientX(event);
mouseY = DOM.eventGetClientY(event);

// When de button mouse is released
if (DOM.eventGetType(event) == Event.ONMOUSEDOWN) {
switch (DOM.eventGetButton(event)){
case Event.BUTTON_RIGHT:
// Your actions goes here
break;
}
}

super.onBrowserEvent(event);
}

I don't remember if tree captures mouse right click for default, I
think it makes, if not you ought to sink this event.

hope it could help you.

Reply all
Reply to author
Forward
0 new messages