Class ScrollBar
- Superclasses :
-
gui::Component
- Package :
- gui
This class provides horizontal and vertical scroll bars.
There are two ways to use a scroll bar. The first way is to
set a total_size (represented by the whole bar), a page_size
(represented by the draggable button) and an increment_size
(being the amount added/subtracted when the top/bottom
button is pressed). The value will then range from zero to
(total_size - page_size) inclusive. An initial value must
be set with the set_value() method.
Alternatively, a scroll bar can be used as a slider which
ranges over a given range of values. In this case, the
range is set with set_range(). It is still necessary to set
the increment size and the initial value, as above, but
page_size and total_size should not be set.
Real numbers as opposed to integers can be used for the
range settings if desired.
A SCROLLBAR_PRESSED_EVENT occurs whenever the buttons are pressed,
or after a drag, and a SCROLLBAR_DRAGGED_EVENT occurs during the drag. The
value can then be retrieved by get_value(). The fact that
there are two different event types can be used to reduce the
number of events which are processed by the user's program - just
listen for SCROLLBAR_PRESSED_EVENT.
- Example :
vb := ScrollBar()
vb.set_pos("85%", "25%")
vb.set_size(20, "40%")
vb.set_total_size(130)
vb.set_page_size(30)
vb.set_increment_size(1)
vb.set_value(0)
self.add(vb)
vb := ScrollBar()
vb.set_pos("85%", "25%")
vb.set_size(20, "40%")
vb.set_range(2, 25)
vb.set_value(10)
vb.set_increment_size(1)
self.add(vb)
- Source
Methods inherited from gui::Component |
accepts_focus()
add(c, i)
all_valid()
can_drag(ev)
can_drop(d)
child_validated(c)
clear_accepts_focus()
clear_allow_drag()
clear_allow_drop()
clear_draw_border()
clear_is_shaded()
compute_absolutes()
create_event_and_fire(type, param)
do_handle_event(e)
do_shading(W)
drag_event(d)
drag_reset()
end_drag(d, c)
fatal(s)
finally()
find_accel(e)
find_focus()
fire_icon_events_on_mouse(p, e)
firstly()
generate_components()
get_accel()
get_cbwin_reference()
get_children()
get_cwin_reference()
get_h_reference()
get_parent()
get_parent_buffer_win()
get_parent_dialog()
get_parent_dialog_reference()
get_parent_win()
get_w_reference()
get_x_reference()
get_y_reference()
got_focus(e)
handle_accel(e)
in_region()
init()
invalidate()
invoke_can_drag(ev)
invoke_can_drop(d)
invoke_drag_event(d)
invoke_drag_reset()
invoke_end_drag(d, c)
is_attrib(s)
is_dialog_open()
is_hidden()
is_shaded()
is_ticking()
is_unhidden()
is_unshaded()
keeps(e)
lost_focus(e)
parse_pos(total, s)
remove(c)
retime_ticker(n)
set_abs_coords(x, y)
set_abs_size(w, h)
set_accel(k)
set_accepts_focus()
set_align(x_align, y_align)
set_allow_drag()
set_allow_drop()
set_attribs(x[])
set_attribs_list(l)
set_draw_border()
set_is_shaded()
set_parent(c)
set_parent_dialog(c)
set_pos(x_spec, y_spec)
set_size(w_spec, h_spec)
set_ticker(n, d)
set_tooltip(x)
stop_ticker()
toggle_draw_border()
toggle_is_shaded()
unique_end(x)
unique_start()
validate()
|
Methods inherited from util::SetFields |
as_attrib(attr, val)
attrib(a[])
cset_val(attr, val)
field_error(s)
int_val(attr, val)
int_vals(attr, val, n)
numeric_val(attr, val)
numeric_vals(attr, val, n)
set_fields(l)
string_val(attr, val)
string_vals(attr, val, n)
test_flag(attr, val)
|
Variables inherited from util::Connectable |
listeners
|
clear_is_horizontal()
-
Make the scroll bar vertical (the default).
- Source
display(buffer_flag)
- Overrides display(buffer_flag) in gui::Component
-
- Source
get_page_size()
-
Get the page size.
- Source
get_total_size()
-
Return the total size.
- Source
get_value()
-
Get the value.
- Returns :
-
The value
- Source
handle_button_down(ev)
-
- Source
handle_button_up(ev)
-
- Source
handle_drag(e)
-
- Source
handle_event(e)
- Overrides handle_event(e) in gui::Component
-
- Source
handle_press(e)
-
- Source
handle_release(e)
-
- Source
initially()
- Overrides initially() in util::Connectable
-
move_bar_pos(x)
-
- Source
move_value(x)
-
- Source
reconfigure()
-
- Source
resize()
- Overrides resize() in gui::Component
-
- Source
set_increment_size(x)
-
Set the amount to increase the value by when one of the
buttons is pressed.
- Parameters :
- x - The increment size.
- Source
set_is_horizontal()
-
Make the scroll bar horizontal (default is vertical).
- Source
set_one(attr, val)
- Overrides set_one(attr, val) in util::SetFields
-
- Source
set_page_size(x)
-
Set the size which the bar in the scroll bar area represents.
- Parameters :
- x - The size.
- Source
set_pos_from_value()
-
- Source
set_range(lo, hi)
-
Set the range of the scroll bar. The values may
be integer or real.
- Parameters :
- lo - The lower bound
- hi - The upper bound
- Source
set_total_size(x)
-
Set the total size which the scroll bar area represents.
- Parameters :
- x - The total size
- Source
set_value(x)
-
Set the value representing the top of the bar in the scroll
bar. The value is forced into range if it is not in range already.
- Parameters :
- x - The value.
- Source
set_value_from_pos()
-
- Source
start_paging(n)
-
- Source
stop_paging()
-
- Source
tick()
- Overrides tick() in gui::Component
-
- Source
b1
-
b2
-
bar_area
-
bar_area_pos
-
bar_area_size
-
bar_down
-
bar_down_offset
-
bar_pos
-
bar_size
-
hi
-
increment_size
-
is_horizontal_flag
-
is_paging
-
is_range_flag
-
lo
-
page_size
-
repeat_delay
-
total_size
-
value
-