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

QBUTTON Component

QButton is a general purpose button control.

QButton Properties
FieldTypeR/WDefaultSupport





AlignINTEGERRWalNoneW

Align determines how the control aligns within its parent control.
BMPSTRINGRW
W

Use BMP to assign a new bitmap file, or to use BMP in a draw statement.
Examples:
DIM button AS QBUTTON
button.BMP = "whatever.bmp"
Details:
You can hold multiple images on a single bitmap, but they must be of the same size and next to each other in a horizontal row.
The "first" bitmap appears when the button is up.
The "second" bitmap appears when the button disabled.
The "third" bitmap appears when the button is down (clicked).
You have to tell Rapid-Q how many images are in your bitmap by assigning the number to NumBMPs.
BMPHandleRESOURCEW
W

Assign a BMP resource handle to appear on the selected button.
Example:
$RESOURCE game_BMP AS "game.bmp"
DIM button AS QBUTTON
button.bmpHandle = game_BMP
CancelINTEGERRWFalseW

If Cancel is True, the button's OnClick event handler executes when the user presses the Escape key.
CaptionSTRINGRW
WXG

Caption specifies the text that appears on the button. To underline a character, include an ampersand (&) symbol before the character.
ColorINTEGERRW
X
CursorINTEGERRWcrDefaultW
DefaultINTEGERRWFalseW

If Default is True, the button's OnClick event handler executes when the user presses the Enter key.
EnabledINTEGERRWTrueWXG
FontQFONTW
W
HandleINTEGERR
W
HeightINTEGERRW
WXG
HintSTRINGRW
WXG
KindINTEGERRWbkCustomW
LayoutINTEGERRWblBMPLeftW

Layout determines where the bitmap image appears on the button.
0 = blBMPLeft -- image appears at the left side of the caption
1 = blBMPRight -- image appears at the right side of the caption
2 = blBMPTop -- image appears above the caption
3 = blBMPBottom -- image appears below the caption
LeftINTEGERRW0WXG
ModalResultINTEGERRWmrNoneW
NumBMPsINTEGERRW
W

NumBMPs determines the number of images within the bitmap button.
ParentQFORM/QPANEL/QTABCONTROLW
WXG
PopupMenuQPOPUPMENUW
W
ShowHintINTEGERRWFalseWXG
SpacingINTEGERRW4W

Determines the separation, in pixels, between the image and the caption.
TabOrderINTEGERRW
W
TagINTEGERRW
WXG
TopINTEGERRW0WXG
WidthINTEGERRW
WXG
VisibleINTEGERRWTrueWXG

QButton Methods
MethodTypeDescriptionParamsSupport





StartDragSUBAllows Button to be dragged

0W


'only started by a mouse down event -- destroys the OnMouseUp Event
Sub Button_OnMouseDown (B&, X&, Y&, S&, Sender AS QBUTTON)
    Sender.StartDrag           
End Sub

DIM Button AS QBUTTON
Button.OnMouseDown = Button_OnMouseDown

QButton Events
EventTypeOccurs when...ParamsSupport





OnClickVOIDUser clicked on the button0WXG
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
OnMouseDownSUB (Button%, X%, Y%, Shift%)Mouse button held down4WXG
OnMouseMoveSUB (X%, Y%, Shift%)Mouse moves3WXG
OnMouseUpSUB (Button%, X%, Y%, Shift%)Mouse button is released4WXG


QButton Examples
  '-- A drag button

DIM Form AS QForm
DIM Button AS QButton

SUB MouseDown
Button.StartDrag
SHOWMESSAGE STR$(Button.Left)+", "+STR$(Button.Top)
END SUB

Button.Parent = Form
Button.OnMouseDown = MouseDown

Form.ShowModal

Prev Component Contents Next Component