Rapid-Q Documentation by William Yu (c)1999-2000, Appended by John Kelly  QFORMEX

QFormEx Component

INCLUDED IN RAPIDQ2.INC
QFormEx is just like a QForm but adds more functions like placing  icons in the application tray, animating tray icons, drag and drop files, auto minimize the task bar, MouseWheel support, Focus events and any custom windows messaging.  See limitations.

QForm Properties
Field Type R/W Default




DragEnable BOOLEAN RW False

Accept drop file in the application window 
DragZone QRECT RW

Zone of drop file 
DropPoint
POINT_API
R


The location on the form where drag-and-drop files were dropped, eg form.DropPoint.x. See example below.


FormStyle INTEGER RW fsNormal

Style fsStayOnTop is now supported in Win2000/XP, limited in Win98

Transparent INTEGER RW

Make the entire form semi-transparent, 0 = totally transparent, 127 = 50%, 255 = normal (opaque)
This replaces QGlassFrame


TransparentClient INTEGER


Make the form client area transparent

TrayICO QIMAGELIST RW  

See Qimagelist documentation. This loads either BMP or ICON files or handles to your tray icons

TrayIconHint STRING RW  

Hint for your tray icon.

TrayIconIndex INTEGER RW  

If TrayICO has more than one image, you can set which one should be visible in the tray

TrayIconUpdate INTEGER RW  

If you have more than one imaged loaded into TrayICO, this will set the time between animation of the trayIcons

QFormEx Methods
Method Type Description Params




AddMessage SUBI(...) Add ar Windows messages to generate an OnMessage Event  infinite
DelMessage SUB Delete the last message added by AddMessage 0
AddTrayIcon SUB Add  application icon to the Desktop tray 0
DelTrayIcon SUB Delete application icon from the Desktop tray. 0
DeskBar SUB Make application minimize to task bar (obsolete ***) 0

QformEx automatically minimizes to the TaskBar

QFormEx Events  (These Events occur in the QFormEx.WndProc)
Event Type Occurs when... Params




OnDrag (File$ AS STRING) User Drag n' Drop File$ to the form 1

If you can only have one form with a Drag zone. Two forms, each with their own drag zone will not work.
OnLostFocus   SUB () User clicks on other application (form loses focus) 0
OnGetFocus   SUB () User clicks on this application (form gets focus) 0
OnTrayClick   SUB () Click right button on icon application of tool bar 0
OnTrayDblClick   SUB () Double click on left button on icon application of tool bar 0
OnMessage  (Hwnd&, Msg&, wParam&, lParam&) Form received Windows message 4
  Use this for an easy replacement for QForm.WndProc
For a list of Windows messages (ie., WM_CLOSE) see http:\\msdn.microsoft.com
OnMinimise   SUB () Window minimized 0
OnMouseWheel SUB (Rotation%, X%, Y%, Shift%) Mouse wheel is rotated  4

Details:
Rotation = 1 or -1,  at  mouse position X,Y on the screen
Shift% = CTRL or SHIFT key , or left, right or center button down
The Form must have the Focus in order for OnMouseWheel to respond, 

Details:

The .OnShow event interferes with form minizing and needs a statement
MainForm.OnShow = ShowAMessage
MainForm.ShowModal

SUB ShowAMessage
    'this line must be in for form to minimize to taskbar..
    MainForm.InheritOnShow
END SUB



QFormEx Example 1 (Get / Lost focus)

$TYPECHECK ON
$INCLUDE "RAPIDQ2.INC"
DECLARE SUB ShowOtherForm
DECLARE SUB CloseOtherForm

DIM Form2 AS QFORMex
Form2.Caption = "Hey, get back to work!"
Form2.Width = 500
CREATE Form AS QFORMex
OnLostFocus = ShowOtherForm
OnGetFocus = CloseOtherForm
END CREATE
Form.ShowModal

SUB ShowOtherForm
Form2.Show
END SUB

SUB CloseOtherForm
Form2.Close
END SUB

QFormEx Example 2 (Tray icon launcher)

$TYPECHECK ON
$INCLUDE "RAPIDQ2.INC"
declare Sub depose(file as string)
declare Sub testWheel(MouseRotation AS INTEGER, Xpos AS LONG, Ypos AS LONG, Shift AS INTEGER)

$RESOURCE myico as "icon1.ico"
$RESOURCE myico2 as "icon2.ico"
$RESOURCE myico3 as "icon3.ico"

CREATE Form AS QFormEx
width=300
Height=200
Caption="Drag and drop files"
center
DragEnable=true
OnDrag=Depose
OnMouseWheel = testWheel
TrayIconHint = "RapidQ2 example"
TrayIco.AddICOHandle myico
TrayIco.AddICOHandle myico2
TrayIco.AddICOHandle myico3
TrayIconUpdate = 2000
' TrayIco.AddICOFile "c:\rapidq\icon\myother.ico" 'can do this
AddTrayIcon 'this goes last
CREATE Listbox as QLISTBOX
Width=150
height=100
END CREATE
CREATE MyButton as QBUTTON
Left = 155
Width=130
height=30
Caption="Click here to focus form"
END CREATE
END CREATE

form.DragZone.Left=listbox.left
form.DragZone.Top=listbox.Top
form.DragZone.Right=listbox.Width
form.DragZone.Bottom=listbox.Height
Form.ShowModal


Sub Depose(file as string)
ListBox.AddItems(file)
Print form.DropPoint.x,
form.DropPoint.y

End Sub

Sub testWheel(MouseRotation AS INTEGER, Xpos AS LONG, Ypos AS LONG, Shift AS INTEGER)
Showmessage "mouse rotated at " + str$(xPos) + " " + str$(yPos) + " " + str$(Shift)
end sub

QFormEx Example 3  (Icon menu in Windows Tray)

$TYPECHECK ON
$INCLUDE <RAPIDQ2.INC>
$RESOURCE ICO as "myIco.ico"
$OPTION ICON "myIco.ico"

declare sub close
declare sub show
declare sub menu
declare sub hide
declare sub fillpop
declare sub closepop

CREATE MainForm AS QFormEx 'this is for your user!
Caption = "User form"
Center
OnMinimise = ClosePop
OnLostFocus= closepop
OnGetFocus= closepop
END CREATE

CREATE Form AS QFormEx 'this is for tray Icon
OnClose=Close
OnTrayDblClick=Show
OnTrayClick=Menu
OnPaint = hide 'Keep tray app hidden
TrayIco.AddICOHandle ICO 'need this to show your icon
TrayIconHint = "Left click for options"
END CREATE

CREATE PopUpMenu AS QPOPUPMENU
Alignment = 1
AutoPopup = 0
OnPopup = fillpop
CREATE Open AS QMENUITEM
Caption = "&Open"
OnClick =show
END CREATE
CREATE Seperator AS QMENUITEM
Caption = "-"
END CREATE
CREATE PopExit AS QMENUITEM
Caption = "&Close Popup"
OnClick =ClosePop
END CREATE
CREATE MeExit AS QMENUITEM
Caption = "&Exit App"
OnClick =Close
END CREATE
END CREATE

form.addtrayicon
form.showmodal

sub close
form.deltrayicon
MainForm.Close
Application.terminate
end sub

sub show
Mainform.Show
end sub

sub Hide
form.visible=false
end sub

sub menu
popupmenu.popup(screen.MouseX,screen.MouseY)
end sub

sub fillpop
popupmenu.additems(Open, Seperator, PopExit, MeExit)
popupmenu.Tag = True 'signal meun loaded
end sub

sub closepop 'note Qpopup does not go away unless deleted!
IF popupmenu.Tag = True THEN
popupmenu.delitems(Open, Seperator, PopExit, MeExit)
popupmenu.Tag = False 'signal meun unloaded
END IF
end sub



QFormEx Example 4(toggle StayOnTop)
$INCLUDE "rapidq2.inc" declare SUB ToggleStayOnTop CREATE Form AS QFORMex Top = 100 Left = 500 Height = 200 Width = 120 CREATE ShowTopWinChk AS QCHECKBOX OnClick = ToggleStayOnTop END CREATE END CREATE Form.ShowModal SUB ToggleStayOnTop If ShowTopWinChk.Checked THEN Form.FormStyle = fsStayontop else Form.FormStyle = fsNormal end if END SUB

Prev Component Contents Next Component