PDA

View Full Version : Stop Selection Changed Event on right click



sgolla
29 Jul 2009, 3:48 AM
Hi All

In GXT using TreePanel, upon right click also, it fires SelectionChangedListener and i do not desire such behavior.

If user is right clicking any way my context menu event fires and i show up the context menu and user shall select appropriate action from there.

Thus during such event, i do not want the logic of SelectionChangedListener to start getting executed.

Hope some one can help by giving hints on which way i can accomplish this?

Thank you
Sreekanth

jadrake75
29 Jul 2009, 2:50 PM
Do you already have a SelectionChangeListener registered? The reason I ask is I do in my case, and I merely short-circuited the selection change event when I detected it was the right-mouse button clicked.

sgolla
30 Jul 2009, 10:36 PM
Is there a way to understand that right click has happened from SelectionChangedListener of TreePanel? If yes, could you give the sample code for the same?

jadrake75
31 Jul 2009, 7:43 PM
This is a partial piece of code I use for selection in the TreePanel..... In this case I only want to filter if it is NOT the right click.....




protectedclass TreeSelectionListener implements Listener<TreePanelEvent<ModelData>> {



publicvoid handleEvent(TreePanelEvent<ModelData> be) {

if( be.getType() == Events.OnClick && !be.isRightClick() && be.getItem() != null ) {
// do you stuff, right click detected for a click event

}
}
}