|
Class Lscrollbar |
Home |
|
This is a scrollbar. It consists of a scroller button (Lscrollbar_scroller) and two buttons (Lscrollbar_button) on either size of the scrollbar. The Lframe class automatically creates Lscrollbar objects as needed and automatically manages them for you. Since the Leditbox and Llistbox classes are bases on the Lframe object, they two support automatic scrollbars.
This class is based on the Lcontainer class. Here are several interesting notes about supported attributes:
You can specify the location of the scroller button using either the :value or the :position attribute. The :value attribute takes precedence over the :position attribute. You can also use the value or position methods to find out where the scroller button is located.
To properly use a scrollbar you need to set the total_size and client_size attributes or define these methods in the object that owns the scrollbar. If the owner object defines scroll_distance_alignment and or scroll_distance they are used for determining how the scrollbar works.
| Methods |
| Public Instance methods |
| inherit_color_from_parent?() src |
Returns false because this does not inherit color from it’s parent like other objects.
| skip_object_theme() src |
Return true because scrollbars don’t pull from the :object portion of the any theme.
| default_fg() src |
Returns :sys_button_bg as the default background color of the Lscrollbar_button and Lscrollbar_scroller objects. The Lscrollbar object does not use this directly.
| default_bg() src |
Returns :sys_scrollbar as the default background color of scrollbars.
| is_horizontal?() src |
Returns true if this is a horizontal scrollbar. Returns false if this is a vertical scrollbar.
| is_vertical?() src |
Returns true if this is a vertical scrollbar. Returns false if this is a horizontal scrollbar.
| include_objects() src |
Creates several instance variables for this object. Also creates the timer used for repeating the on_mouse_ldn event when the left mouse button is pressed and held. Also creates the Lscrollbar_scroller and two Lscrollbar_button objects.
| can_have_focus?() src |
Returns false because scrollbars don’t participate in tabbing.
| valid_attribute?(attribute, lvalue=nil) src |
Supports the :otype attributes of :vertical and :horizontal. Also supports the :total_size, :client_size, :value, and :position attributes.
| scroll_distance_alignment() src |
Returns the number of pixels to round up or down when dragging the scroller button. It keeps the content of the owner aligned on this boundary. If the scrollbar has an owner (:owner attribute) and has defined this method, then owner.scroll_distance_alignment is returned. Otherwise returns 1.
| scroll_distance() src |
Returns the amount in pixels to scroll when clicking on a scrollbar button. If the scrollbar has an owner (:owner attribute) and has defined this method, then owner.scroll_distance is returned. Otherwise returns 1.
| total_size() src |
This returns the total area in pixels. It is used to calculate the size and position of the scroller button. Returns self[:total_size] it is has been set. Otherwise, returns owner.total_size when this scrollbar has an owner (:owner attribute) and the owner has defined this method. Otherwise, returns parent.total_size when this scrollbar parent has defined this method. Otherwise, returns the parent.clientW when horizontal or parent.clientH when vertical.
| client_size() src |
This returns the client area or visible area in pixels. It is used to calculate the size and position of the scroller button. Returns self[:client_size] it is has been set. Otherwise, returns owner.client_size when this scrollbar has an owner (:owner attribute) and the owner has defined this method. Otherwise, returns parent.client_size when this scrollbar parent has defined this method. Otherwise, returns the clientW when horizontal or clientH when vertical.
| total_size=(new_value) src |
Sets the total area in pixels. If this is not provided, the total_size is determined using the :owner attribute.
| client_size=(new_value) src |
Sets the client area or visible area in pixels. If this is not provided, the client_size is determined using the :owner attribute.
| update_scroller() src |
Recalculates the size of the scroller. You can call this to resize the scroller when the content of the owning object changes.
| fg=(new_value) src |
The foreground of the scrollbar is uses as the background color of all the buttons in the scrollbar.
| position() src |
Returns the position (x pixel position for horizontal scrollbars, y pixel position for vertical scrollbars) of the scroller button as a percentage (0.0-99.0) of the total_size.
| position=(new_value) src |
Sets the :value attribute according the new percentage (new_value) and repositions the scroller button accordingly.
| value() src |
If the :value attribute has not been defined and the :position attribute has been defined, value returned is calculated based on the :position attribute. 0 is returned if neither the :value or :position attributes are set.
| value=(new_value) src |
Sets the position of the scroller button in pixels.
| on_mouse_ldbl(levent=nil) src |
Calls on_mouse_ldn otherwise clicking multiple times can appear to skip on_mouse_ldn events.
| on_mouse_ldn(levent=nil, &block) src |
Left mouse button clicks in the scrollbar area (not the scroller button) triggers an on_scroll event to scroll either a page up or page down depending on where the mouse is located. This also starts a button timer to repeat the on_scroll as long as the left mouse button is pressed.
| on_mouse_lup(levent=nil, &block) src |
Cancels the button repeat timer.
| on_scroll(levent=nil, &block) src |
Relocates the scroller button to levent[:value]. Triggers the on_change event. Here are levent attributes specific to the scrollbar:
This is triggered whenever activity in the scrollbar causes scrolling. These activities will trigger this event:
| set_focus() src |
Redirects the focus to the owner (:owner attribute) or parent object.
| Seva Software |
Thank you for taking the time to visit this web page. I trust you found the information contained in this page useful.
Please email any questions, concerns, or issues with this web site to webmaster@sevasoftware.com.
Please remember Seva Software when your company would benefit from an experienced database architect and software engineer.