Table Properties - Mouseover

I have been partially successful in getting this done but I need a little help to make it complete.

I have a table. One column has a very long string in it. I enabled “Editable” in the table customizer so I could select the cell with the long string and read it in it’s entirety. Now I want to just be able to move my mouse over a cell, and based on the coordinates, I want to populate the mouseover text. I currently have it working on the selection of row/column and binding the dataset value of that row and column to the mouseover but it doesn’t display correctly. So, I guess what I’m asking is this:

  1. How do I get the mouseover text to display properly
  2. How would I go about creating a dynamic property, and based on mouse coordinates, get the row and column.

Also, I know Kyle Chase did something similar as far as getting column and row with a right click.

Anything? :scratch:

This is pretty crude stuff, but I think it does what you want it to. Maybe it could be used as a starting point? Basically I took Kyle’s code you linked to and placed a container on top of the table, since containers have a “mouseMoved” event. I then just changed Kyle’s code to point to the table in event.source.parent.getComponent.

It changes the mouseover text as you drag over it, although I can rarely get the actual tooltip to show up!

Anyway, maybe this is a start, albeit a crude one.

Good luck,

testwindow.vwin (8.55 KB)

Below is how I implemented mouseover text displays on table cells. It has worked really well for me.
It displays different mouseover text when mousing over different table cells.

About point number 1:
I abandoned using the Mouseover Text property on the table and instead used a label component - making it dynamically appear in the right place, at the right time with the right text when mousing over a specific table cell.

About point number 2:
When called the following function will return the column and row of where your mouse pointer currently is if it is on the passed in table component. If the mouse pointer is not on the table then (-1, -1) is returned.

def getCellFromPoint(table): from java.awt import MouseInfo, Point p = MouseInfo.getPointerInfo().getLocation() mousex = p.x - table.getTable().getLocationOnScreen().x mousey = p.y - table.getTable().getLocationOnScreen().y mousep = Point(mousex,mousey) cellCol = table.getTable().columnAtPoint(mousep) cellRow = table.getTable().rowAtPoint(mousep) return (cellRow, cellCol)

So, if you called this function in a client timer script every second then you would know which cell your mouse pointer is on (with a possible one second lag, which is good for displaying mouseover text).

Next to each visible cell in the table I have a hidden cell that contains an ID number that identifies the visible cell. When a user mouses over a cell I use the ID in the next cell to lookup the mouseover text in a database. Then I display the mouseover text near the mouse pointer in a label component.

Here is the function that I call that does this work. I call this function in a client event timer script and it runs every second:

def displayMouseoverText(): from java.awt import MouseInfo, Point from org.python.core import PyInteger try: win = system.gui.getWindow("Timesheet") except ValueError: return root = win.rootContainer timeTable = root.getComponent("Time") cellRow, cellCol = app.util.getCellFromPoint(timeTable) label = root.getComponent("Label") if cellCol == -1 or cellRow == -1: label.visible = 0 return cellCol += 1 #to get the adjacent column id =,cellCol) if id == -1 or type(id) != PyInteger: label.visible = 0 return desc = system.db.runScalarQuery("SELECT description from Timesheets WHERE id=%s"% id) if desc == None: label.visible = 0 return if desc == '': label.text = "No Client Description" else: label.text = "<html>" + desc #getting the mouse coordinates in the Ignition application p = MouseInfo.getPointerInfo().getLocation() mousex = p.x - root.getLocationOnScreen().x mousey = p.y - root.getLocationOnScreen().y #displaying the label at the right location def setloc(label=label, mousex=mousex, mousey=mousey): system.gui.moveComponent(label, mousex + 10, mousey) label.visible = 1 system.util.invokeLater(setloc)