I remember that one. Rather than developing individual scripts for every component in Vision, I imagine it would be better to simply make a generic script for modifying vertical scroll bars that will work on any given component.
Here's an example of a script that could be tossed into the project library and used for any component that requires vertical scrollbar width adjustment:
# Function to set all vertical scrollbars within a given component to a given width
def setVerticalScrollbarWidths(component, width):
# Check to see if the given component has a vertical scroll bar
if hasattr(component, 'verticalScrollBar'):
# Simply modify the existing preferred size using the given width and set it back to the scrollbar
# (This could also done by importing Dimension at top level and creating a new one using the existing preferred height with the given width)
verticalScrollBar = component.verticalScrollBar
preferredSize = verticalScrollBar.getPreferredSize()
preferredSize.width = width
verticalScrollBar.setPreferredSize(preferredSize)
verticalScrollBar.revalidate() # Has to be done to make the change visibly take effect instantly
# Recursively pass all subcomponents back into the function to check them for vertical scroll bars
for subComponent in component.components:
setVerticalScrollbarWidths(subComponent, width)
If the function were added to library script called components:
...then it could be called during the journal table's initialization from the journal table's propertyChange event handler in this way:
# Runs only once at initialization
# Will NOT run in the designer UNLESS preview mode is started prior to opening the window
if event.propertyName == 'componentRunning' and event.newValue:
# Set the width in pixels of the vertical scrollbars at initialization
component = event.source
width = 40
scriptLibrary.components.setVerticalScrollbarWidths(component, width)
Result:

