1wxScrollBar(3) Erlang Module Definition wxScrollBar(3)
2
3
4
6 wxScrollBar - Functions for wxScrollBar class
7
9 A wxScrollBar is a control that represents a horizontal or vertical
10 scrollbar.
11
12 It is distinct from the two scrollbars that some windows provide auto‐
13 matically, but the two types of scrollbar share the way events are re‐
14 ceived.
15
16 Remark: A scrollbar has the following main attributes: range, thumb
17 size, page size, and position. The range is the total number of units
18 associated with the view represented by the scrollbar. For a table with
19 15 columns, the range would be 15. The thumb size is the number of
20 units that are currently visible. For the table example, the window
21 might be sized so that only 5 columns are currently visible, in which
22 case the application would set the thumb size to 5. When the thumb size
23 becomes the same as or greater than the range, the scrollbar will be
24 automatically hidden on most platforms. The page size is the number of
25 units that the scrollbar should scroll by, when 'paging' through the
26 data. This value is normally the same as the thumb size length, because
27 it is natural to assume that the visible window size defines a page.
28 The scrollbar position is the current thumb position. Most applications
29 will find it convenient to provide a function called AdjustScrollbars()
30 which can be called initially, from an OnSize event handler, and when‐
31 ever the application data changes in size. It will adjust the view, ob‐
32 ject and page size according to the size of the window and the size of
33 the data.
34
35 Styles
36
37 This class supports the following styles:
38
39 The difference between EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED
40
41 The EVT_SCROLL_THUMBRELEASE event is only emitted when actually drag‐
42 ging the thumb using the mouse and releasing it (This EVT_SCROLL_THUM‐
43 BRELEASE event is also followed by an EVT_SCROLL_CHANGED event).
44
45 The EVT_SCROLL_CHANGED event also occurs when using the keyboard to
46 change the thumb position, and when clicking next to the thumb (In all
47 these cases the EVT_SCROLL_THUMBRELEASE event does not happen).
48
49 In short, the EVT_SCROLL_CHANGED event is triggered when scrolling/mov‐
50 ing has finished independently of the way it had started. Please see
51 the page_samples_widgets ("Slider" page) to see the difference between
52 EVT_SCROLL_THUMBRELEASE and EVT_SCROLL_CHANGED in action.
53
54 See: Overview scrolling, Overview events, wxScrolled (not implemented
55 in wx)
56
57 This class is derived (and can use functions) from: wxControl wxWindow
58 wxEvtHandler
59
60 wxWidgets docs: wxScrollBar
61
63 Event types emitted from this class: scroll_top, scroll_bottom,
64 scroll_lineup, scroll_linedown, scroll_pageup, scroll_pagedown,
65 scroll_thumbtrack, scroll_thumbrelease, scroll_changed, scroll_top,
66 scroll_bottom, scroll_lineup, scroll_linedown, scroll_pageup,
67 scroll_pagedown, scroll_thumbtrack, scroll_thumbrelease, scroll_changed
68
70 wxScrollBar() = wx:wx_object()
71
73 new() -> wxScrollBar()
74
75 Default constructor.
76
77 new(Parent, Id) -> wxScrollBar()
78
79 Types:
80
81 Parent = wxWindow:wxWindow()
82 Id = integer()
83
84 new(Parent, Id, Options :: [Option]) -> wxScrollBar()
85
86 Types:
87
88 Parent = wxWindow:wxWindow()
89 Id = integer()
90 Option =
91 {pos, {X :: integer(), Y :: integer()}} |
92 {size, {W :: integer(), H :: integer()}} |
93 {style, integer()} |
94 {validator, wx:wx_object()}
95
96 Constructor, creating and showing a scrollbar.
97
98 See: create/4, wxValidator (not implemented in wx)
99
100 destroy(This :: wxScrollBar()) -> ok
101
102 Destructor, destroying the scrollbar.
103
104 create(This, Parent, Id) -> boolean()
105
106 Types:
107
108 This = wxScrollBar()
109 Parent = wxWindow:wxWindow()
110 Id = integer()
111
112 create(This, Parent, Id, Options :: [Option]) -> boolean()
113
114 Types:
115
116 This = wxScrollBar()
117 Parent = wxWindow:wxWindow()
118 Id = integer()
119 Option =
120 {pos, {X :: integer(), Y :: integer()}} |
121 {size, {W :: integer(), H :: integer()}} |
122 {style, integer()} |
123 {validator, wx:wx_object()}
124
125 Scrollbar creation function called by the scrollbar constructor.
126
127 See new/3 for details.
128
129 getRange(This) -> integer()
130
131 Types:
132
133 This = wxScrollBar()
134
135 Returns the length of the scrollbar.
136
137 See: setScrollbar/6
138
139 getPageSize(This) -> integer()
140
141 Types:
142
143 This = wxScrollBar()
144
145 Returns the page size of the scrollbar.
146
147 This is the number of scroll units that will be scrolled when
148 the user pages up or down. Often it is the same as the thumb
149 size.
150
151 See: setScrollbar/6
152
153 getThumbPosition(This) -> integer()
154
155 Types:
156
157 This = wxScrollBar()
158
159 Returns the current position of the scrollbar thumb.
160
161 See: setThumbPosition/2
162
163 getThumbSize(This) -> integer()
164
165 Types:
166
167 This = wxScrollBar()
168
169 Returns the thumb or 'view' size.
170
171 See: setScrollbar/6
172
173 setThumbPosition(This, ViewStart) -> ok
174
175 Types:
176
177 This = wxScrollBar()
178 ViewStart = integer()
179
180 Sets the position of the scrollbar.
181
182 See: getThumbPosition/1
183
184 setScrollbar(This, Position, ThumbSize, Range, PageSize) -> ok
185
186 Types:
187
188 This = wxScrollBar()
189 Position = ThumbSize = Range = PageSize = integer()
190
191 setScrollbar(This, Position, ThumbSize, Range, PageSize,
192 Options :: [Option]) ->
193 ok
194
195 Types:
196
197 This = wxScrollBar()
198 Position = ThumbSize = Range = PageSize = integer()
199 Option = {refresh, boolean()}
200
201 Sets the scrollbar properties.
202
203 Remark: Let's say you wish to display 50 lines of text, using
204 the same font. The window is sized so that you can only see 16
205 lines at a time. You would use: The page size is 1 less than the
206 thumb size so that the last line of the previous page will be
207 visible on the next page, to help orient the user. Note that
208 with the window at this size, the thumb position can never go
209 above 50 minus 16, or 34. You can determine how many lines are
210 currently visible by dividing the current view size by the char‐
211 acter height in pixels. When defining your own scrollbar behav‐
212 iour, you will always need to recalculate the scrollbar settings
213 when the window size changes. You could therefore put your
214 scrollbar calculations and setScrollbar/6 call into a function
215 named AdjustScrollbars, which can be called initially and also
216 from a wxSizeEvent event handler function.
217
218
219
220wxWidgets team. wx 2.2.2 wxScrollBar(3)