Rapid-Q Documentation by William Yu (c)1999-2000 Appendix A: QSCROLLBAR

QSCROLLBAR Component

QScrollBar is a Windows scroll bar, used to scroll contents of a window, form, or control. It can also act as a simple trackbar.

QScrollBar Properties
FieldTypeR/WDefaultSupport
AlignINTEGERRWalNoneW
Align determines how the control aligns within its parent control.
CursorINTEGERRWcrDefaultW
EnabledINTEGERRWTrueWX
HandleINTEGERRW
HeightINTEGERRWWX
HintSTRINGRWWX
KindINTEGERRWsbHorizontalWX
Kind specifies whether the scrollbar is horizontal or vertical.
0 = sbHorizontal -- Scrollbar is horizontal.
1 = sbVertical -- Scrollbar is vertical.
LargeChangeINTEGERRW1WX
LargeChange determines how much Position changes when the user clicks on the scrollbar on either side of the thumb or pressed PageUp or PageDown.
LeftINTEGERRW0WX
MaxINTEGERRW100WX
MinINTEGERRW0WX
PageSizeINTEGERRW1W
PageSize specifies the distance along the trackbar.
ParentQFORM/QPANEL/QTABCONTROLWWX
PopupMenuQPOPUPMENUWW
PositionINTEGERRW0WX
ShowHintINTEGERRWFalseWX
SmallChangeINTEGERRW1WX
SmallChange determines how much Position changes when the user clicks the arrow buttons on the scrollbar or presses the arrow keys.
TabOrderINTEGERRWW
TagINTEGERRWWXG
TopINTEGERRW0WX
WidthINTEGERRWWX
VisibleINTEGERRWTrueWX


QScrollBar Events
EventTypeOccurs when...ParamsSupport
OnChangeVOIDScroll position changes0WX
OnKeyDownSUB (Key AS Word, Shift AS INTEGER)Key held down2W
OnKeyPressSUB (Key AS BYTE)User presses a key1W
OnKeyUpSUB (Key AS Word, Shift AS INTEGER)User releases a key2W
OnScrollSUB (ScrollCode AS BYTE, ScrollPos AS LONG)Scrolling2W


QScrollBar Examples
' Color Palette for Rapid-Q by William Yu


DECLARE SUB ColorChange
DECLARE SUB Paint

CONST False = 0
CONST True = NOT False

'' Here's something that will convert your standard RGB to Rapid-Q's BGR.
'' And quite useless because an RGB function is already implemented!
FUNCTION ConvertRGB(R AS INTEGER, G AS INTEGER, B AS INTEGER) AS INTEGER
  ConvertRGB = (B SHL 16) OR (G SHL 8) OR R
END FUNCTION

CREATE Form AS QForm
  CREATE LabelRed AS QLabel
    Left = 10
    Top = 22
    Caption = "Red:"
  END CREATE
  CREATE LabelGreen AS QLabel
    Left = 5
    Top = 52
    Caption = "Green:"
  END CREATE
  CREATE LabelBlue AS QLabel
    Left = 10
    Top = 82
    Caption = "Blue:"
  END CREATE
  CREATE LabelNum1 AS QLabel
    Left = 270
    Top = 22
    Caption = "0"
  END CREATE
  CREATE LabelNum2 AS QLabel
    Left = 270
    Top = 52
    Caption = "0"
  END CREATE
  CREATE LabelNum3 AS QLabel
    Left = 270
    Top = 82
    Caption = "0"
  END CREATE
  CREATE ScrollRed AS QScrollBar
    Left = 50
    Top = 20
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Red Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE ScrollGreen AS QScrollBar
    Left = 50
    Top = 50
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Green Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE ScrollBlue AS QScrollBar
    Left = 50
    Top = 80
    Width = 200
    Height = 20
    Min = 0: Max = 255
    ShowHint =  True
    Hint = "Blue Attribute"
    OnChange = ColorChange
  END CREATE
  CREATE PaintBox AS QCanvas
    Left = 50
    Top = 110
    Height = 90
    Width = 200
    OnPaint = Paint
  END CREATE
  Caption = "Color Palette"
  Center
  ShowModal
END CREATE

SUB ColorChange
  LabelNum1.Caption = STR$(ScrollRed.Position)
  LabelNum2.Caption = STR$(ScrollGreen.Position)
  LabelNum3.Caption = STR$(ScrollBlue.Position)
  Paint
END SUB

SUB Paint
  PaintBox.Paint(0,0,ConvertRGB(ScrollRed.Position, ScrollGreen.Position, ScrollBlue.Position),&HFFFFFF)
END SUB

Prev Component Contents Next Component
Hosted by uCoz
Hosted by uCoz