Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter NineDialog Functions (continued)

9.23 Scrollbar Control

9.23.1 Introduction

Generally, controls that support scrolling will incorporate scrollbars as an integrated function. Many times a scrollbar can be added using the WS_VSCROLL and WS_HSCROLL style bits, and, some also include auto-hide scrollbars. In the event an independent scrollbar is required, the common control “scrollbar” class can be used.

There are four styles of scrollbars: vertical, horizontal, size and grip. Functions within this section can be used to support horizontal and vertical scrollbars. Size and grip can be employed but there is no direct support within Legato.

A scrollbar requires a range (from 0 to x) that defines the range of numerical points that can be scrolled through using the arrow icons, the thumb track and pages by clicking on the track rail. A ‘page size’ can be set to adjust the size of the thumb track. Otherwise, the page size of whatever the script decides in response to a page message.

When a scrollbar control is created, it has no page or range sizes set. As a result the control will appear non-responsive. The script should set the range using the ScrollbarSetRange function. If a page size is not set, the control will pick a size based on the range. The thumb track size also changes based on a combination of the range and the page size.

9.23.2 Scrollbar Control Types and Styles

As mentioned above, there are four styles of scrollbar with alignment variables. Other WS_ styles can be added as appropriate. Example of a scrollbar control:

CONTROL "", 101, "scrollbar", SBS_HORZ | WS_CHILD | WS_VISIBLE, 24, 17, 60, 9, 0

9.23.3 Scrollbar Notifications

The following messages are sent via the dialog action procedure. Note that the left/top and right/bottom messages are the same ordinal value, but they are presented with different definitions to avoid confusion with control orientation. (These are the same sub-messages employed by the Windows SDK and sent via WM_HSCROLL and WM_VSCROLL messages.)

  Notification code   Value   Description
  SB_LINEUP   0   User pressed the up arrow on the control, scroll up by one unit.
  SB_LINELEFT   0   User pressed the left arrow on the control, scroll left by one unit.
  SB_LINEDOWN    1   User pressed the down arrow on the control, scroll down by one unit.
  SB_LINERIGHT    1   User pressed the right arrow on the control, scroll right by one unit.
  SB_PAGEUP    2   User clicked in the body of the control, scroll up by one page.
  SB_PAGELEFT    2   User clicked in the body of the control, scroll left by one page.
  SB_PAGEDOWN    3   User clicked in the body of the control, scroll down by one page.
  SB_PAGERIGHT    3   User clicked in the body of the control, scroll right by one page.
  SB_THUMBPOSITION   4   User has dragged the thumb position and released, sent prior to the SB_ENDSCROLL message.
  SB_THUMBTRACK   5   User is dragging the thumb track and the mouse has changed position.
  SB_TOP   6   Scrolled to the top.
  SB_LEFT   6   Scrolled to the upper left.
  SB_BOTTOM   7   Scrolled to the bottom.
  SB_RIGHT    7   Scrolled to the lower right.
  SB_ENDSCROLL    8   Sent to indicate the scroll action has ended.

In response to a message, the action procedure should calculate and set the new scroll position. Note that the notifications only express what the user requested but the control must be updated by the scroll to reflect the new position.

9.23.4 Scrollbar Control Functions