Hello, I am currently working on making a right click function on a table. So far it is working but I want to be able to make it so when the right mouse button is clicked it will select the row it is above, any suggestions on how this can be done?
First off, you will need some knowledge of Java as this task requires it. This whole script needs to fall under an if statement that checks to see if the click event was generated by a right click, so it doesn’t interfere with normal left-click operations. (Hint: right click = BUTTON3). After that, once you get the table component instance, if you call getTable() on it, it will return a JTable for you, which opens up JTable’s API for use.
You’ll want to look at the rowAtPoint() method within the JTable class. It will return a zero-indexed row selection based off of a locally-based coordinate that is passed in. That coordinate is local to the table, so you will have to account for the row margin and the height of the table header, both of which are accessible via the JTable class.
Once you get the row number, you can just call the built-in Ignition function setSelectedRow() on the table instance to change the selected row.
I know this isn’t a simple answer, but it shows how powerful Ignition can be since it uses Java Swing components.
In case anyone finds this page and needs more help, I also had this issue and the solution I used is here.