I have a table that lists around 100 tanks and select data for each.
On the screen I have a “Tank Search” box that can use either the tank id or a lot id.
The functionality works to find and select the row for the found tank. What I would like to do is have the code show the selected row as well. As it stands now, the selected row may be above or below the currently displayed rows in the table.
Is there a way to have this logic “auto scroll” to display the found and selected row?
Bump. Looking for the same thing. I understand you can do it with a JTable, but I don’t know how to get a JTable from an Ignition table. At least, it doesn’t work with a List Table.
This would work if that getTable() reference worked…
myJtable = list.getTable()
rectangle = myJTable.getCellRect(rowNum,0,0)
The JList is a bit more involved to retrieve. Try this in the property event script.
if event.propertyName == "selectedIndex":
jList = event.source.getViewport().getComponent(0)
I tried that and got an error, object has no ensureIndexIsVisible. When I do a dir on the jList object, that method is not in the results. I do see it in the java docs for the JList object though.
Let’s back up a sec. I may be confused on what you’re using. Correct me if I’m wrong, but:
@MikeAllgood is using a table
@boyergary is using a list.
The first script I posted (above) is for a list.
For a table (also in the property change event):
if event.propertyName == 'selectedRow':
jTable = event.source.getTable()
rectangle = jTable.getCellRect(event.newValue,0,0)
Ah, got cha!
Yes, I’m using a table so guess I’m still in search of!
Thanks much for the jList code, Jordan…that did the job for me!!
The second bit of code I posted should work for you, Mike.
your script is scrolling the text vertically
i want to scroll the text horizontally … what change i have to make in script?
jTable.getCellRect(int row, int column, boolean includeSpacing)
so get the column you want to go to and change the second param in getCellRect()
I just want the scroll message to appear based the day or time selection or particular time only… is there any idea to do that in scripting?
like i am just scheduling a time when that time comes only i want to show message on screen
I think there is some confusion here. Are you actually wanting a marquee type of display?
@JordanCClark yes exactly i want… giving some announcement to plant when ever required
can you please help me on scripting part for this
This may be more what you’re looking for.
Here’s an update on Jordan’s marquee using system.gui.transform. It’s simpler and doesn’t need as many objects or bindings. Just set the root container’s time property to the length of time in milliseconds for the message to cross the container. It should cope with different length of container or message.
Multiple messages is left as an exercise for the reader.
Marquee updated_2017-09-07.proj (6.6 KB)
marquee type of display
thanks i will check it out