Class ScrollBar

Summary

#
  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.
  @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)

  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.
  @example
  @ 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)

  An Event is returned whenever the buttons are pressed or the
  bar dragged; the value can be retrieved by get_value().  The
  event code (obtainable by {get_code()}) is 1 if the bar has
  been dragged, and 0 if either button has been pressed or the
  bar released after being dragged.  This fact can be used to
  reduce the number of events which are processed by the
  user's program - just ignore events with code 1.

Superclasses:
Component

Package:
(main)
File:
scrollbar.icn
Methods:
bar_to_win, display, final_setup, finally, firstly, get_page_size, get_total_size, get_value, handle_event, handle_notify, move_bar_pos, move_value, refresh, resize, set_increment_size, set_is_horizontal, set_page_size, set_pos_from_value, set_range, set_total_size, set_value, set_value_from_pos

Methods inherited from Component:
accepts_tab_focus, attrib, clear_accepts_tab_focus, clear_draw_border, clear_is_shaded, clear_no_updates, do_shading, error, generate_all_components, generate_components, get_cbwin_reference, get_cwin_reference, get_h_reference, get_parent_Dialog, get_parent_buffer_win, get_parent_win, get_visible_reference, get_w_reference, get_x_reference, get_y_reference, got_focus, in_region, is_hidden, is_shaded, is_unhidden, is_unshaded, lost_focus, parse_pos, redisplay, set_abs_coords, set_abs_size, set_accepts_tab_focus, set_align, set_attribs, set_attribs_list, set_draw_border, set_is_shaded, set_no_updates, set_parent_Dialog, set_pos, set_size, set_tooltip, toggle_draw_border, toggle_is_shaded, unique_end, unique_start

Methods inherited from MetaComponent:
set_fields

Methods inherited from Ticker:
is_ticking, retime_ticker, set_ticker, stop_ticker, tick

Fields:
b1, b2, bar_area_h, bar_area_pos, bar_area_size, bar_area_w, bar_area_x, bar_area_y, bar_down, bar_down_offset, bar_h, bar_pos, bar_size, bar_w, bar_x, bar_y, hi, increment_size, is_horizontal_flag, is_range_flag, lo, page_size, total_size, value

Source code.

Details
Constructor

ScrollBar(argv)

Methods:

bar_to_win(W)


display(buffer_flag)

This method overrides display in class Component

final_setup(x, y)

This method overrides final_setup in class Component

finally()

This method overrides finally in class Component

firstly()

This method overrides firstly in class Component

get_page_size()

#
  Get the page size.


get_total_size()

#
  Return the total size.


get_value()

#
  Get the value.
  @return The value


handle_event(e)

This method overrides handle_event in class Component

handle_notify(e)

This method overrides handle_notify in class Component

move_bar_pos(x)


move_value(x)


refresh()


resize()

This method overrides resize in class Component

set_increment_size(x)

#
  Set the amount to increase the value by when one of the
  buttons is pressed.
  @param x   The increment size.


set_is_horizontal()

#
  Make the scroll bar horizontal (default is vertical).


set_page_size(x)

#
  Set the size which the bar in the scroll bar area represents.
  @param x   The size.


set_pos_from_value()


set_range(lo, hi)

#
  Set the range of the scroll bar.  The values may
  be integer or real.
  @param lo  The lower bound
  @param hi  The upper bound


set_total_size(x)

#
  Set the total size which the scroll bar area represents.
  @param x   The total size


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.
  @param x   The value.


set_value_from_pos()


Fields:
b1

b2

bar_area_h

bar_area_pos

bar_area_size

bar_area_w

bar_area_x

bar_area_y

bar_down

bar_down_offset

bar_h

bar_pos

bar_size

bar_w

bar_x

bar_y

hi

increment_size

is_horizontal_flag

is_range_flag

lo

page_size

total_size

value


This page produced by UniDoc on 2021/04/15 @ 23:59:54.