Appendix A: QSCROLLBAR
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
Field | Type | R/W | Default | Support |
|
|
|
|
|
Align | INTEGER | RW | alNone | W |
| Align determines how the control aligns within its parent control.
|
Cursor | INTEGER | RW | crDefault | W |
Enabled | INTEGER | RW | True | WX |
Handle | INTEGER | R | | W |
Height | INTEGER | RW | | WX |
Hint | STRING | RW | | WX |
Kind | INTEGER | RW | sbHorizontal | WX |
| Kind specifies whether the scrollbar is horizontal or vertical.
0 = sbHorizontal -- Scrollbar is horizontal.
1 = sbVertical -- Scrollbar is vertical.
|
LargeChange | INTEGER | RW | 1 | WX |
| LargeChange determines how much Position changes when the user clicks on the scrollbar on either side of the thumb or pressed PageUp or PageDown.
|
Left | INTEGER | RW | 0 | WX |
Max | INTEGER | RW | 100 | WX |
Min | INTEGER | RW | 0 | WX |
PageSize | INTEGER | RW | 1 | W |
| PageSize specifies the distance along the trackbar.
|
Parent | QFORM/QPANEL/QTABCONTROL | W | | WX |
PopupMenu | QPOPUPMENU | W | | W |
Position | INTEGER | RW | 0 | WX |
ShowHint | INTEGER | RW | False | WX |
SmallChange | INTEGER | RW | 1 | WX |
| SmallChange determines how much Position changes when the user clicks the arrow buttons on the scrollbar or presses the arrow keys.
|
TabOrder | INTEGER | RW | | W |
Tag | INTEGER | RW | | WXG |
Top | INTEGER | RW | 0 | WX |
Width | INTEGER | RW | | WX |
Visible | INTEGER | RW | True | WX |
QScrollBar Events
Event | Type | Occurs when... | Params | Support |
|
|
|
|
|
OnChange | VOID | Scroll position changes | 0 | WX |
OnKeyDown | SUB (Key AS Word, Shift AS INTEGER) | Key held down | 2 | W |
OnKeyPress | SUB (Key AS BYTE) | User presses a key | 1 | W |
OnKeyUp | SUB (Key AS Word, Shift AS INTEGER) | User releases a key | 2 | W |
OnScroll | SUB (ScrollCode AS BYTE, ScrollPos AS LONG) | Scrolling | 2 | W |
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
|
|