Scroll Bar – Giavapps Windows API

 

 

api_scrollbar_create(ParentHandle, X, Y, W, H, Flags, ExFlags) This function creates a scroll bar.

ParentHandle: parent handle.
X: x coordinate.
Y: y coordinate.
W: width.
H: height.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

SBS_BOTTOMALIGN Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle defined by the X, Y, W, and H parameters of api_scrollbar_create() function. The scroll bar has the default height for system scroll bars. Use this style with the SBS_HORZ style.

SBS_HORZ Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN style is specified, the scroll bar has the height, width, and position specified by the X, Y, W, and H parameters of api_scrollbar_create().

SBS_LEFTALIGN Aligns the left edge of the scroll bar with the left edge of the rectangle defined by the X, Y, W, and H parameters of api_scrollbar_create(). The scroll bar has the default width for system scroll bars. Use this style with the SBS_VERT style.

SBS_RIGHTALIGN Aligns the right edge of the scroll bar with the right edge of the rectangle defined by the X, Y, W, and H parameters of api_scrollbar_create(). The scroll bar has the default width for system scroll bars. Use this style with the SBS_VERT style.

SBS_SIZEBOX Designates a size box. If you specify neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor the SBS_SIZEBOXTOPLEFTALIGN style, the size box has the height, width, and position specified by the X, Y, W, and H parameters of api_scrollbar_create().

SBS_SIZEBOXBOTTOMRIGHTALIGN Aligns the lower right corner of the size box with the lower right corner of the rectangle specified by the X, Y, W, and H parameters of api_scrollbar_create(). The size box has the default size for system size boxes. Use this style with the SBS_SIZEBOX style.

SBS_SIZEBOXTOPLEFTALIGN Aligns the upper left corner of the size box with the upper left corner of the rectangle specified by the X, Y, W, and H parameters of api_scrollbar_create(). The size box has the default size for system size boxes. Use this style with the SBS_SIZEBOX style.

SBS_SIZEGRIP Same as SBS_SIZEBOX, but with a raised edge.

SBS_TOPALIGN Aligns the top edge of the scroll bar with the top edge of the rectangle defined by the X, Y, W, and H parameters of api_scrollbar_create(). The scroll bar has the default height for system scroll bars. Use this style with the SBS_HORZ style.

SBS_VERT Designates a vertical scroll bar. If you specify neither the SBS_RIGHTALIGN nor the SBS_LEFTALIGN style, the scroll bar has the height, width, and position specified by the X, Y, W, and H parameters of api_scrollbar_create().

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new scroll bar.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_scrollbar_set_range(ScrollBarHandle, Type, Minimum, Maximum) Sets the minimum and maximum scroll box positions for the specified scroll bar. If the function succeeds, the return value is true or false otherwise.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.
Minimum: the minimum scrolling position.
Maximum: the maximum scrolling position.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_get_range(ScrollBarHandle, Type, MinimumOrMaximum) Returns the current minimum and maximum scroll box positions for the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.

MinimumOrMaximum: retrieves the minimum (false) or maximum (true) range position.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_set_page(ScrollBarHandle, Type, Page) Sets the page size for the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.
Page: specifies the page size, in device units. A scroll bar uses this value to determine the appropriate size of the proportional scroll box.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_get_page(ScrollBarHandle, Type) Returns the page size of the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_set_position(ScrollBarHandle, Type, Position) Sets the position of the scroll box in the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.

Position: Specifies the new position of the scroll box. The position must be within the scrolling range.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_get_position(ScrollBarHandle, Type) Returns the current position of the scroll box in the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

api_scrollbar_set_enabled(ScrollBarHandle, Type, Enabled) Enables or disables one or both scroll bar arrows. ScrollBarHandle should be a WindowHandle since this feature seems to work properly only with window’s standard scroll bars. For disabling scroll bar controls you can use api_control_set_enabled().

ScrollBarHandle: it must be a WindowHandle.
Type: specifies the scroll bar type.
Enabled: Specifies whether the scroll bar arrows are enabled or disabled and indicates which arrows are enabled or disabled.

Type argument can be one of the following values:

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

Enabled argument can be one of the following flags:

ESB_DISABLE_BOTH Disables both arrows on a scroll bar.

ESB_DISABLE_DOWN Disables the down arrow on a vertical scroll bar.

ESB_DISABLE_LEFT Disables the left arrow on a horizontal scroll bar.

ESB_DISABLE_LTUP Disables the left arrow on a horizontal scroll bar or the up arrow of a vertical scroll bar.

ESB_DISABLE_RIGHT Disables the right arrow on a horizontal scroll bar.

ESB_DISABLE_RTDN Disables the right arrow on a horizontal scroll bar or the down arrow of a vertical scroll bar.

ESB_DISABLE_UP Disables the up arrow on a vertical scroll bar.

ESB_ENABLE_BOTH Enables both arrows on a scroll bar.

 

api_scrollbar_show(ScrollBarHandle, Type, ShowState) Shows or hides the specified scroll bar.

ScrollBarHandle: it must be a ScrollBarHandle or a WindowHandle.
Type: specifies the scroll bar type.
ShowState: shows (true) or hides (false) the specified scrollbar.

Type argument can be one of the following values:

SB_CTL Sets the range of a scroll bar control. The ScrollBarHandle parameter must be the handle to the scroll bar control.

SB_HORZ Sets the range of a window’s standard horizontal scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_HSCROLL style.

SB_VERT Sets the range of a window’s standard vertical scroll bar. The ScrollBarHandle parameter must be a WindowHandle with WS_VSCROLL style.

 

Code Examples

 

Creating a Scroll Bar

 

scrollbar = api_scrollbar_create(window,10,10,160,17,WS_VISIBLE | WS_CHILD | SBS_HORZ,0);

 

Setting Range, Page and Position

 

api_scrollbar_set_range(scrollbar,SB_CTL,0,100);
api_scrollbar_set_page(scrollbar,SB_CTL,10);
api_scrollbar_set_position(scrollbar,SB_CTL,50);

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*