(scroll down more for info on ui.adjustment and how to use the damn thing.)
Code: Select all
default my_custom_xadjustment = ui.adjustment() #HERE, THIS TOOK ME FOREVER TO FIND
default my_custom_yadjustment = ui.adjustment() #HERE, THIS TOOK ME FOREVER TO FIND
init python:
def someFuncA():
# move the VPgrid vertibal bar downwards by 100 pixels ....
my_custom_yadjustment .change(my_custom_yadjustment .value + 100) #HERE, THIS TOOK ME FOREVER TO FIND
def someFuncB():
# move the VPgrid vertibal bar upwards by 100 pixels ....
my_custom_yadjustment .change(my_custom_yadjustment .value - 100) #HERE, THIS TOOK ME FOREVER TO FIND
def sumbFuncC():
# set the vertibal bar's position by value directly
myadjust_y123.change(500) #HERE, THIS TOOK ME FOREVER TO FIND
screen that_VPGRID():
vpgrid:
cols 1
spacing 0
draggable True
mousewheel False
arrowkeys True
area (500, 200, 500, 500)
scrollbars "vertical"
xadjustment my_custom_xadjustment #HERE, THIS TOOK ME FOREVER TO FIND
yadjustment my_custom_yadjustment #HERE, THIS TOOK ME FOREVER TO FIND
for i in range(1, 100):
textbutton "Button [i]":
xysize (200, 50)
action nullaction()
Code: Select all
default my_custom_xadjustment = ui.adjustment() #HERE, THIS TOOK ME FOREVER TO FIND
default my_custom_yadjustment = ui.adjustment() #HERE, THIS TOOK ME FOREVER TO FIND
init python:
def someFuncA():
print my_custom_yadjustment.range
print my_custom_yadjustment.value
print my_custom_yadjustment.step
print my_custom_yadjustment.page
print my_custom_yadjustment.adjustable
print my_custom_yadjustment.changed
print my_custom_yadjustment.ranged
print my_custom_yadjustment.force_step
#YOU CAN TYPE THE ABOVE VARIABLES INTO THE CONSOLE (SHIFT O), and see their values instantly
The range of the adjustment, a number.
value
The value of the adjustment, a number.
step
The step size of the adjustment, a number. If None, then defaults to 1/10th of a page, if set. Otherwise, defaults to the 1/20th of the range.
This is used when scrolling a viewport with the mouse wheel.
page
The page size of the adjustment. If None, this is set automatically by a viewport. If never set, defaults to 1/10th of the range.
It's can be used when clicking on a scrollbar.
The following parameters control the behavior of the adjustment.
adjustable
If True, this adjustment can be changed by a bar. If False, it can't.
It defaults to being adjustable if a changed function is given or if the adjustment is associated with a viewport, and not adjustable otherwise.
changed
This function is called with the new value when the value of the adjustment changes.
ranged
This function is called with the adjustment object when the range of the adjustment is set by a viewport.
force_step
If True and this adjustment changes by dragging associated viewport or a bar, value will be changed only if the drag reached next step. If "release" and this adjustment changes by dragging associated viewport or a bar, after the release, value will be rounded to the nearest step. If False, this adjustment will changes by dragging, ignoring the step value.
change(value)
Changes the value of the adjustment to value, updating any bars and viewports that use the adjustment.