I have a power table that a user wants to be able to double right click on a cell to trigger opening up a window related to the record.
Right now I can't seem to catch the right click at all, but left clicks come through fine.
All I am trying right now is print event.button
on the extension functions onMouseClick
and onMouseDoubleClick
and all I can get is a 1
for left clicking. Nothing comes through for right clicking.
I tried onMouseclick
under the mouse functions but nothing comes through at all for that, I assume because I am using configureCell/configureEditor/isCellEditable/onCellEdited
extension functions something is overriding it but I can't get that to print at all.
This does work in another part of the project but its with a simple table, not a power table, and using the mouse event handler mouseClicked on the table, not the power table extension functions.
How can I catch right clicks (and double right clicks) on a cell in a power table?
You will use mouseReleased
event handler for right clicks, which has a clickCount
object property.
Edit: I missed the cell part, not sure mouseReleased will work on an individual cell
I am having the same issue. I tried both -

the mouse.onMouseRelease is the same issue - nothing comes through at all. Extension function onMouseRelease works for left clicks but not right clicks again.
I wonder if it ignores right clicks because you can right click on the header to get a built-in popup menu to configure the table?
1 Like
I did notice that when trying and accidentally clicked the header, I never even knew that menu was there before lol. But yea I am wondering if that is the cause.
You could just use a modifier, like shift + left click
for editing instead of right clicking. The way I usually handle it is having an edit button to toggle a flag that allows/disallows any editing.
java.awt.event.MouseEvent[MOUSE_RELEASED,(296,232),absolute(-1314,439),button=1,modifiers=Ctrl+Button1,extModifiers=Ctrl,clickCount=1] on historyTable->view
This isn't for editing, just to open a popup window related to the specified record. I am going to ask if double left clicks are fine. Not sure how tied they are to having the right click work, though maybe they are given that the other part of the application does do it this way. That's not a bad idea though maybe some other modification.
onMousePressed works
#def onMousePress(self, rowIndex, colIndex, colName, value, event):
if event.button == 3:
print 'pressed'
4 Likes
Extension function onMousePress is the winner. Thank you! No table initialization is required either.
3 Likes