It is currently Wed Sep 17, 2014 5:37 pm




Post new topic Reply to topic  [ 4 posts ] 
 Change width of Table scroll bars 
Author Message
Sergeant
Sergeant

Joined: Wed Aug 18, 2010 7:29 am
Posts: 47
Location: Little Rock, AR
Post Change width of Table scroll bars
Is there any way to change the width of the scroll bars on a Table Component? I would like to use the table in a mobile app, but I have fat fingers and it is difficult to navigate the table.

Thanks.


Fri Aug 10, 2012 11:10 am
Profile
Moderator
Moderator

Joined: Mon Jun 04, 2012 8:53 am
Posts: 440
Post Re: Change width of Table scroll bars
You can use getVerticalScrollBar() and setPreferredSize() from Java's ScrollPaneLayout, which is from Java Swing (which Ignition uses). An example:

Code:
from java.awt import Dimension
from java.lang import Integer

# create Dimension object, first parameter is width of scrollbar
new_scrollbar_width = Dimension(25, Integer.MAX_VALUE)

# get component object, pass the Dimension object to setPreferredSize to change width
comp = system.gui.getWindow('WindowName').getRootContainer().getComponent("Table")
comp.getVerticalScrollBar().setPreferredSize(new_scrollbar_width)

# a hacky way of "repainting" the component, since repaint() won't work.
# manually resizing the component in the designer using the arrows would work as well
system.gui.resizeComponent(comp,comp.getWidth()+1,comp.getHeight()+1)
system.gui.resizeComponent(comp,comp.getWidth()-1,comp.getHeight()-1)

_________________
James Lorenz
QA/Build Systems Engineer
Inductive Automation


Fri Aug 10, 2012 12:07 pm
Profile
General
General

Joined: Thu Jan 26, 2012 5:18 pm
Posts: 221
Post Re: Change width of Table scroll bars
Would this code be put on the component somewhere? Where does it need added?
I also have a similar need to increase the size of the scroll bar.
Its not on mobile but same principle.


Sat Aug 11, 2012 7:52 pm
Profile WWW
Moderator
Moderator

Joined: Mon Jun 04, 2012 8:53 am
Posts: 440
Post Re: Change width of Table scroll bars
It just depends on when or how often you want to change the scrollbar width. If you're just making a static change to the scrollbar width in the designer, you can go to Tools -> Script Playground and put the script in there. If you want a user to change the width while using the client, you can use a button/pop-up window to prompt the user to change the value, or use a numeric text field. If you need it to dynamically change at a certain time or when a tag changes, you can use a gateway startup script. There are many different implementations that can be applied.

_________________
James Lorenz
QA/Build Systems Engineer
Inductive Automation


Mon Aug 13, 2012 7:19 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron