I’m looking at retrieving the inner viewport horizontal extents of a power table only when the horizontal scrollbar component is visible. Anyone got anything on this?
I was able to figure this out. I wanted to print out a window and make a table print entirely when it has scrollbars. I was able to get the table’s actual width and compare it to the width of the table’s viewport, which tells me if it has a scroll bar or not. If it does, then I transform the table to it’s actual size for printing, then return it to normal size afterwards. It worked like a charm.
windowName = system.nav.getCurrentWindow()
try:
rc = system.gui.getWindow(windowName).getRootContainer()
powerTable = event.source.parent.getComponent('Power Table')
t = powerTable.getTable()
actualWidth = t.getWidth()
visibleWidth = t.getVisibleRect().width
if actualWidth > visibleWidth:
system.gui.transform(powerTable, newWidth = actualWidth)
job = system.print.createPrintJob(rc)
job.setMargins(0.5)
job.showPageFormat = 1
job.orientation = 1
job.print()
def reset():
system.gui.transform(powerTable, newWidth = visibleWidth)
system.util.invokeLater(reset)
except:
# window not opened
pass
1 Like