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


QBUTTON Component

QButton is a general purpose button control.

QButton Properties
Field Type R/W Default Support





Align INTEGER RW alNone W
Align determines how the control aligns within its parent control.
BMP STRING RW 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.
BMPHandle RESOURCE W 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
Cancel INTEGER RW False W
If Cancel is True, the button's OnClick event handler executes when the user presses the Escape key.
Caption STRING RW WXG
Caption specifies the text that appears on the button. To underline a character, include an ampersand (&) symbol before the character.
Color INTEGER RW X
Cursor INTEGER RW crDefault W
Default INTEGER RW False W
If Default is True, the button's OnClick event handler executes when the user presses the Enter key.
Enabled INTEGER RW True WXG
Font QFONT W W
Handle INTEGER R W
Height INTEGER RW WXG
Hint STRING RW WXG
Kind INTEGER RW bkCustom W
Layout INTEGER RW blBMPLeft W
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
Left INTEGER RW 0 WXG
ModalResult INTEGER RW mrNone W
NumBMPs INTEGER RW W
NumBMPs determines the number of images within the bitmap button.
Parent QFORM/QPANEL/QTABCONTROL W WXG
PopupMenu QPOPUPMENU W W
ShowHint INTEGER RW False WXG
Spacing INTEGER RW 4 W
Determines the separation, in pixels, between the image and the caption.
TabOrder INTEGER RW W
Tag INTEGER RW WXG
Top INTEGER RW 0 WXG
Width INTEGER RW WXG
Visible INTEGER RW True WXG

QButton Methods
Method Type Description Params Support





StartDrag SUB Allows Button to be dragged 0 W

QButton Events
Event Type Occurs when... Params Support





OnClick VOID User clicked on the button 0 WXG
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
OnMouseDown SUB (Button%, X%, Y%, Shift%) Mouse button held down 4 WXG
OnMouseMove SUB (X%, Y%, Shift%) Mouse moves 3 WXG
OnMouseUp SUB (Button%, X%, Y%, Shift%) Mouse button is released 4 WXG


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 ComponentContentsNext Component