| Rapid-Q Documentation by William Yu (c)1999-2000 | Appendix A: QFORM |
| Field | Type | Read/Write | Default Value | Support |
| AutoScroll | INTEGER | RW | True | W |
| Specify whether scroll bars should appear automatically on the form if it is not large enough to display all of its controls | ||||
| BorderStyle | INTEGER | RW | bsSizeable | WXG |
| BorderStyle specifies the appearance and behaviour of the form border. 0 = bsNone -- Not resizeable; no visible border line or caption bar 1 = bsSingle -- Not resizeable; single-line border 2 = bsSizeable -- Standard resizeable border 3 = bsDialog -- Not resizeable; standard dialog box border 4 = bsToolWindow -- Like bsSingle but with a smaller caption 5 = bsSizeToolWin -- Like bsSizeable but with a smaller caption | ||||
| Caption | STRING | RW | WXG | |
| Caption is the text that appears as the title of your form. | ||||
| ClientHeight | INTEGER | RW | WXG | |
| The height of the form's client area, ie. the usable area inside the form's border. | ||||
| ClientWidth | INTEGER | RW | WXG | |
| The width of the form's client area, ie. the usable area inside the form's border. | ||||
| Color | INTEGER | RW | clBtnFace | W |
| Color of the form. | ||||
| Cursor | INTEGER | RW | crDefault | W |
| Cursor that appears when the mouse pointer is over the form. | ||||
| Font | QFONT | W | W | |
| Sets font property. Used for TextOut method. | ||||
| FormStyle | INTEGER | RW | fsNormal | W |
| Get or set the form's style. Only fsNormal is supported. (fsStayOnTop is also)
fsNormal = 0 fsMDIChild = 1 fsMDIForm = 2 fsStayOnTop = 3 | ||||
| Handle | INTEGER | R | W | |
| Get the form's handle for WinAPI calls. | ||||
| Height | INTEGER | RW | WXG | |
| Get or set the form's vertical size (in pixels). | ||||
| Hint | STRING | RW | W | |
| The hint string that appears when the user moves the mouse pointer over the form. It is not displayed unless ShowHint is true. | ||||
| IcoHandle | RESOURCE | W | W | |
| Assign an icon resource handle to appear as the icon for your form. Example: $RESOURCE game_ICO AS "game.ico" | ||||
| Icon | STRING | W | W | |
| Assign an icon filename to appear as the icon for your form. | ||||
| KeyPreview | INTEGER | RW | False | W |
| Specify whether keyboard events should occur on the form before they occur on the active control. Not all keys will be redirected. | ||||
| Left | INTEGER | RW | 0 | WXG |
| Specifies the left edge of the form relative to the desktop screen. | ||||
| ModalResult | INTEGER | W | W | |
| Assigning a value to ModalResult will close the form when it is displayed modally. 0 = mrNone 1 = mrOk 2 = mrCancel 3 = mrAbort 4 = mrRetry 5 = mrIgnore 6 = mrYes 7 = mrNo 8 = mrAll | ||||
| Parent | QFORM | W | W | |
| Assigning a parent will remove the second form from the taskbar. | ||||
| PopupMenu | QPOPUPMENU | W | W | |
| Popupmenus are displayed when user right clicks on the form. Example: DIM PopupMenu AS QPOPUPMENU | ||||
| ShowHint | INTEGER | RW | False | W |
| If True then the hint popup message can be displayed. | ||||
| Top | INTEGER | RW | 0 | WXG |
| Visible | INTEGER | RW | False | WXG |
| Specifies the visibility of the form. | ||||
| Width | INTEGER | RW | 320 | WXG |
| WindowState | INTEGER | RW | wsNormal | W |
| Specifies how the form appears on the screen. 0 = wsNormal -- form appears neither maximized nor minimized 1 = wsMinimized -- form is minimized 2 = wsMaximized -- form is maximized | ||||
| Method | Type | Description | Params | Support |
| AddBorderIcons | SUBI | Add Border Icons | INTEGER, Infinite | W |
| Valid border icons are: 0 = biSystemMenu -- The form icon 1 = biMinimize -- The minimize icon 2 = biMaximized -- The maximize icon 3 = biHelp -- The help icon Example:
| ||||
| Center | SUB | Used to center a form | 0 | WXG |
| Circle | SUB (x1%, y1%, x2%, y2%, c%, fill%) | Draw & Fill Circle/Ellipse | 6 | W |
| Close | SUB | Close form | 0 | WXG |
| CopyRect | SUB (D, Image, S) | D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap | 3 | W |
Example (copies QIMAGE to form at 10,10):
| ||||
| DelBorderIcons | SUBI | Remove Border Icons | INTEGER, Infinite | W |
| Valid border icons are: 0 = biSystemMenu -- The form icon 1 = biMinimize -- The minimize icon 2 = biMaximized -- The maximize icon 3 = biHelp -- The help icon Example: Details: Deleting icon may not necessarily remove it from the form's title bar, but the icon will be greyed out. | ||||
| Draw | SUB (x%, y%, BMP) | Draw Bitmap on Canvas | 3 | W |
| Details: BMP can be any BMP property from QBitmap, QImage, QImageList, etc. any component with a BMP property is fine. Examples: DIM Image1 AS QIMAGE | ||||
| FillRect | SUB (x1%, y1%, x2%, y2%, c%) | Draws & Fills a rectangle | 5 | W |
| HideTitleBar | SUB | Hides Caption | 0 | W |
| Line | SUB (x1%, y1%, x2%, y2%, c%) | Draw line on form | 5 | W |
| Paint | SUB (x%, y%, c%, borderc%) | Fill Region | 4 | W |
| Pset | SUB (x%, y%, c%) | Pixel plot | 3 | W |
| Rectangle | SUB (x1%, y1%, x2%, y2%, c%) | Draws a rectangle | 5 | W |
| Repaint | SUB | Repaints the entire form | 0 | W |
| RoundRect | SUB (x1%, y1%, x2%, y2%, x3%, y3%, c%) | Draws & Fills a rounded rectangle | 7 | W |
| ShapeForm | SUB (Filename$|Resource, TransparentColor&) | Shapes form as outline of image | 2 | W |
| Details: The first parameter can either be a filename to the BMP file, or a BMP resource file. The second parameter indicates which color is transparent. Example 1: DIM Form AS QFORMExample 2: $RESOURCE image_BMP AS "image.bmp" | ||||
| Show | SUB | Used to show form when hidden | 0 | WX |
| ShowModal | FUNCTION AS SHORT | Display form and wait for result | 0 | WXG |
| ShowTitleBar | SUB | Displays Caption | 0 | W |
| StretchDraw | SUB (Rect AS QRECT, BMP) | Draw BMP and stretch to fit inside Rect | 2 | W |
| Details: BMP can be any BMP property from QBitmap, QImage, QImageList, etc. any component with a BMP property is fine. Examples (Double original size): DIM Image1 AS QIMAGE | ||||
| TextHeight | FUNCTION (Text$) AS WORD | Returns the height, in pixels, of Text$ string | 1 | W |
| TextWidth | FUNCTION (Text$) AS WORD | Returns the width, in pixels, of Text$ string | 1 | W |
| TextRect | SUB (Rect AS QRECT, x%, y%, S$, fc%, bc%) | Write text, and clip within region Rect | 6 | W |
| TextOut | SUB (x%, y%, s$, fc%, bc%) | Write text to form | 5 | W |
| Details: fc% = foreground color bc% = background color For a transparent background, set bc% parameter to -1 | ||||
| Event | Type | Occurs when... | Params | Support |
| OnClick | VOID | User clicks on open area of form | 0 | W |
| OnClose | SUB (Action AS INTEGER) | Form closes
-- Close Actions CONST caNone = 0 '-- Don't close the form CONST caHide = 1 '-- Just hide the form CONST caFree = 2 CONST caClose = caFree '-- Close form CONST caMinimize = 3 '-- Minimize instead of closing | 1 | W |
| OnHint | SUB (Hint AS STRING) | Hint is displayed | 1 | W |
| 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 | W |
| OnMouseMove | SUB (X%, Y%, Shift%) | Mouse moves | 3 | W |
| OnMouseUp | SUB (Button%, X%, Y%, Shift%) | Mouse button is released | 4 | W |
| OnPaint | VOID | Form requires repainting | 0 | W |
| OnResize | VOID | Form is resized | 0 | W |
| OnShow | VOID | Form is displayed | 0 | W |
| WndProc | SUB (Hwnd%, Msg%, wParam%, lParam%) | Messages posted/sent to form | 4 | W |
| Only one WndProc per Form is allowed. So if you have multiple forms, only one may be able to receive messages at a time. (Future consideration to correct this) | ||||
DIM Form AS QForm DIM Button AS QBUTTON Button.Parent = Form '' Add button to form container Form.Center Form.Caption = "Hello world!" IF Form.ShowModal THEN PRINT "Return result is TRUE" ELSE PRINT "Return result is FALSE" END IF
DECLARE SUB Form_Close(Action AS INTEGER)
CREATE Form AS QFORM
Center
OnClose = Form_Close
END CREATE
Form.ShowModal
SUB Form_Close
IF MessageDlg("Do you wish to exit now?", 0, 1 OR 2, 0) = 7 THEN
Action = 0
END IF
END SUB
| Prev Component | Contents | Next Component |