1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
class CScrollBar
================
An instance of CScrollBar is a scroll bar control which can be placed
in a window or dialog box. It does NOT represent a scroll bar in a
CScrollView. Scroll bars in a CScrollView or other window are part
of the window, not separate controls.
When a scroll bar is constructed, you must set its length. This is
self.wpySizeX for a horizontal bar and self.wpySizeY for a vertical
bar. The returned default is not useful. You should probably not
change the other dimension (the width).
At some point you must set the scroll bar units. Assign values to
self.wpyScrollSize and self.wpyScrollWinSize. To change these after
the scroll bar is created, assign to them and call self.SetScrollRange().
When a scroll bar is operated by the user, the position of the slider
and the value of self.wpyScrollPos is maintained by the system. In
addition, the OnScroll(self, control) method of the parent is called
if it exists. Note that scroll bar messages (the call to OnScroll())
is only sent to the parent, it is not routed as in other controls.
Special Data Attributes
-----------------------
The position of a scroll bar is given as an integer which varies from
zero to a user-defined maximum value. Pick the scroll bar size any way
you want, making sure there are enough values and that you can figure
out the window size. The position of a scroll bar is self.wpyScrollPos
and it varies from zero to (self.wpyScrollSize - self.wpyScrollWinSize).
self.wpyScrollSize
The total size in arbitrary integer scroll bar units. You must
set this at some point.
self.wpyScrollWinSize
The size in scroll bar units which fits within the window. This
may affect the size of the slider on some platforms.
self.wpyScrollPos
The position of the first visible line in the window in scroll
bar units. Read-only after Create(). The system updates this
as the scroll bar is operated.
Methods
-------
__init__(self, parent, text)
Parent is the parent window or dialog box. "Text" is the name
of the scroll bar. This is not visible, but must start with
"v" for a vertical scroll bar or "h" for a horizontal scroll
bar. "Text" is used as a name, and must be alphanumeric.
Create(self)
Create the scroll bar and make it visible.
SetScrollPos(self, pos, redraw = 1)
Set the scroll position to "pos" scroll bar units. You must
not assign to self.wpyScrollPos after the scroll bar is created.
SetScrollRange(self, redraw = 1)
If you change the scroll bar units after the bar is created,
call this method to alert the system.
|