Creation/Dev/Script/Client/GuiScrollCtrl: Difference between revisions

From Graal Bible
mNo edit summary
 
No edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Scripting Reference]]
Inherits [[Creation/Dev/Script/Client/GuiControl|GuiControl]].
=Description=
[[Image:Guicontrol_scroll.png]]
The scroll control is basicly a container where you can add other controls, and the scroll control is automatically displaying vertical and horizontal scroll bars so that you can reach those child controls. Use the ''hScrollBar'' and ''vScrollBar'' variables to say which scroll bars should be displayed.
Use ''globalToLocalCoord()'' and ''localToGlobalCoord()'' described in [[Creation/Dev/Script/Client/GuiControl|GuiControl]] to translate between child position to mouse position and vice versa.
=Variables=
childmargin - {xmargin,ymargin} - gap between the borders and the child controls
constantthumbheight - boolean
hscrollbar - string - "alwaysOn", "alwaysOff", "dynamic" - controls the horizontal scroll bar
scrollpos - {x, y} - read only
tile - boolean - says if the scroll field background should be drawn tiled (otherwise stretched)
vscrollbar - string - "alwaysOn", "alwaysOff", "dynamic" - controls the vertical scroll bar
wheelscrolllines - integer - number of lines to scroll when the mouse wheel is turned
willfirstrespond - boolean
=Functions=
scrolldelta(int deltax, int deltay)
scrollto(int newx, int newy)
=Events=
onScrolled(newposx,newposy,deltax,deltay) - either the horizontal or vertical scrollbar has been moved
=Example=
<pre>
<pre>
    GuiScrollCtrl (GuiControl):
new GuiScrollCtrl("Test_ScrollField") {
      childmargin - string
  profile = GuiBlueScrollProfile;
      constantthumbheight - boolean
  x = 10;
      hscrollbar - string
  y = 10;
      scrollpos - string
  width = 160;
      tile - boolean
  height = 80;
      vscrollbar - string
  hScrollBar = "dynamic";
      wheelscrolllines - integer
  vScrollBar = "alwaysOn";
      willfirstrespond - boolean
}
      scrolldelta(int, int)
      scrollto(int, int)
</pre>
</pre>

Latest revision as of 00:55, 16 February 2010

Inherits GuiControl.

Description

Guicontrol scroll.png

The scroll control is basicly a container where you can add other controls, and the scroll control is automatically displaying vertical and horizontal scroll bars so that you can reach those child controls. Use the hScrollBar and vScrollBar variables to say which scroll bars should be displayed.

Use globalToLocalCoord() and localToGlobalCoord() described in GuiControl to translate between child position to mouse position and vice versa.


Variables

childmargin - {xmargin,ymargin} - gap between the borders and the child controls

constantthumbheight - boolean

hscrollbar - string - "alwaysOn", "alwaysOff", "dynamic" - controls the horizontal scroll bar

scrollpos - {x, y} - read only

tile - boolean - says if the scroll field background should be drawn tiled (otherwise stretched)

vscrollbar - string - "alwaysOn", "alwaysOff", "dynamic" - controls the vertical scroll bar

wheelscrolllines - integer - number of lines to scroll when the mouse wheel is turned

willfirstrespond - boolean

Functions

scrolldelta(int deltax, int deltay)

scrollto(int newx, int newy)

Events

onScrolled(newposx,newposy,deltax,deltay) - either the horizontal or vertical scrollbar has been moved


Example

new GuiScrollCtrl("Test_ScrollField") {
  profile = GuiBlueScrollProfile;
  x = 10;
  y = 10;
  width = 160;
  height = 80;
  hScrollBar = "dynamic";
  vScrollBar = "alwaysOn";
}