Guidance
指路人
g.yi.org
software / RapidQ / RQ Doc / html / qform.html

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

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


QFORM Component

QForm is a standard application Window. You can put any visible control component on a QForm, such as QEdit, QLabel, QButton, etc...

W = Windows, X = Rapid-Q/XForms, G = Rapid-Q/GTK

QForm Properties
FieldTypeRead/WriteDefault ValueSupport





AutoScrollINTEGERRWTrueW
Specify whether scroll bars should appear automatically on the form if it is not large enough to display all of its controls
BorderStyleINTEGERRWbsSizeableWXG
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
CaptionSTRINGRWWXG
Caption is the text that appears as the title of your form.
ClientHeightINTEGERRWWXG
The height of the form's client area, ie. the usable area inside the form's border.
ClientWidthINTEGERRWWXG
The width of the form's client area, ie. the usable area inside the form's border.
ColorINTEGERRWclBtnFaceW
Color of the form.
CursorINTEGERRWcrDefaultW
Cursor that appears when the mouse pointer is over the form.
FontQFONTWW
Sets font property. Used for TextOut method.
FormStyleINTEGERRWfsNormalW
Get or set the form's style. Only fsNormal is supported.
HandleINTEGERRW
Get the form's handle for WinAPI calls.
HeightINTEGERRWWXG
Get or set the form's vertical size (in pixels).
HintSTRINGRWW
The hint string that appears when the user moves the mouse pointer over the form. It is not displayed unless ShowHint is true.
IcoHandleRESOURCEWW
Assign an icon resource handle to appear as the icon for your form.
Example:
$RESOURCE game_ICO AS "game.ico"
DIM Form AS QFORM
Form.IcoHandle = game_ICO
IconSTRINGWW
Assign an icon filename to appear as the icon for your form.
KeyPreviewINTEGERRWFalseW
Specify whether keyboard events should occur on the form before they occur on the active control. Not all keys will be redirected.
LeftINTEGERRW0WXG
Specifies the left edge of the form relative to the desktop screen.
ModalResultINTEGERWW
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
ParentQFORMWW
Assigning a parent will remove the second form from the taskbar.
PopupMenuQPOPUPMENUWW
Popupmenus are displayed when user right clicks on the form.
Example:
DIM PopupMenu AS QPOPUPMENU
DIM Form AS QFORM
Form.PopupMenu = PopupMenu
ShowHintINTEGERRWFalseW
If True then the hint popup message can be displayed.
TopINTEGERRW0WXG
VisibleINTEGERRWFalseWXG
Specifies the visibility of the form.
WidthINTEGERRW320WXG
WindowStateINTEGERRWwsNormalW
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


QForm Methods
MethodTypeDescriptionParamsSupport





AddBorderIconsSUBIAdd Border IconsINTEGER, InfiniteW
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:
$INCLUDE "RAPIDQ.INC"
DIM Form AS QFORM
Form.AddBorderIcons(biHelp)
CenterSUBUsed to center a form0WXG
CircleSUB (x1%, y1%, x2%, y2%, c%, fill%)Draw & Fill Circle/Ellipse6W
CloseSUBClose form0WXG
CopyRectSUB (D, Image, S)D and S are QRECTs, Image can be a QImage, QCanvas, or QBitmap3W
Example (copies QIMAGE to form at 10,10):
DIM Destination AS QRECT
DIM Source AS QRECT
DIM Image AS QIMAGE
Image.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
WITH Destination
.Top = 10
.Left = 10
.Right = .Left+Image.Width
.Bottom = .Top+Image.Height
END WITH
WITH Source
.Top = 0
.Left = 0
.Right = Image.Width
.Bottom = Image.Height
END WITH
Sender.CopyRect(Destination, Image, Source)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
DelBorderIconsSUBIRemove Border IconsINTEGER, InfiniteW
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:
$INCLUDE "RAPIDQ.INC"
DIM Form AS QFORM
Form.DelBorderIcons(biMinimize)
Details:
Deleting icon may not necessarily remove it from the form's title bar, but the icon will be greyed out.
DrawSUB (x%, y%, BMP)Draw Bitmap on Canvas3W
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
Image1.BMP = "whatever.bmp"
DIM Image2 AS QBITMAP
Image2.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
Sender.Draw(0, 0, Image1.BMP)
Sender.Draw(50, 50, Image2.BMP)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
FillRectSUB (x1%, y1%, x2%, y2%, c%)Draws & Fills a rectangle5W
HideTitleBarSUBHides Caption0W
LineSUB (x1%, y1%, x2%, y2%, c%)Draw line on form5W
PaintSUB (x%, y%, c%, borderc%)Fill Region4W
PsetSUB (x%, y%, c%)Pixel plot3W
RectangleSUB (x1%, y1%, x2%, y2%, c%)Draws a rectangle5W
RepaintSUBRepaints the entire form0W
RoundRectSUB (x1%, y1%, x2%, y2%, x3%, y3%, c%)Draws & Fills a rounded rectangle7W
ShapeFormSUB (Filename$|Resource, TransparentColor&)Shapes form as outline of image2W
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 QFORM
Form.ShapeForm("image.bmp", &HFFFFFF)
Example 2:
$RESOURCE image_BMP AS "image.bmp"

DIM Form AS QFORM
Form.ShapeForm(image_BMP, &HFFFFFF)
ShowSUBUsed to show form when hidden0WX
ShowModalFUNCTION AS SHORTDisplay form and wait for result0WXG
ShowTitleBarSUBDisplays Caption0W
StretchDrawSUB (Rect AS QRECT, BMP)Draw BMP and stretch to fit inside Rect2W
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
Image1.BMP = "whatever.bmp"

SUB FormPaint (Sender AS QFORM)
DIM R AS QRECT
R.Left = 0
R.Top = 0
R.Right = Image1.Width*2
R.Bottom = Image1.Height*2
Sender.StretchDraw(R Image1.BMP)
END SUB

DIM Form AS QFORM
Form.OnPaint = FormPaint
TextHeightFUNCTION (Text$) AS WORDReturns the height, in pixels, of Text$ string1W
TextWidthFUNCTION (Text$) AS WORDReturns the width, in pixels, of Text$ string1W
TextRectSUB (Rect AS QRECT, x%, y%, S$, fc%, bc%)Write text, and clip within region Rect6W
TextOutSUB (x%, y%, s$, fc%, bc%)Write text to form5W
Details:
fc% = foreground color
bc% = background color
For a transparent background, set bc% parameter to -1


QForm Events
EventTypeOccurs when...ParamsSupport





OnClickVOIDUser clicks on open area of form0W
OnCloseSUB (Action AS INTEGER)Form closes1W
OnHintSUB (Hint AS STRING)Hint is displayed1W
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 down4W
OnMouseMoveSUB (X%, Y%, Shift%)Mouse moves3W
OnMouseUpSUB (Button%, X%, Y%, Shift%)Mouse button is released4W
OnPaintVOIDForm requires repainting0W
OnResizeVOIDForm is resized0W
OnShowVOIDForm is displayed0W
WndProcSUB (Hwnd%, Msg%, wParam%, lParam%)Messages posted/sent to form4W
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)


QForm Examples
  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

Prev Component Contents Next Component
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2024-4-25  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2015-12-25 19:42:37