' Rapid-Q by William Yu (c)1999-2000 . ' ================================================================================ ' Upload_il_tuo_script_su_Rapidq.it ' QFormMDI ****** QFormMDI Component ****** QFormEx is identical as a QForm component with functionality MDI. The standard components of rapidq having a handle control (Qpanel, QRichEdit, QScrollBox...) can be associated the windows child MDI, they must be no visible and their parent property must be the object itself at the time of their declaration. The components can be declared as variables array or to be of different type for each window child MDI. QFormMDI Property Field Type R/ Default W ============== =============================================================================================================================================================================== == ======== ChildCaption STRING R/ W Text of title bar of active child window ChildHandle LONG R Handle of active child window ChildLeft SHORT R/ W Left position of active child window ChildTop SHORT R/ W Top position of active child window ChildWidth SHORT R/ W Width of active child window ChildHeight SHORT R/ W Height of active child window ChildMax INTEGER R/ 1024 W Maximum child window ChildCount INTEGER R Child window number ChildIcon LONG R/ W Icon handle for child window ChildState INTEGER R/ W State of active child window,could be wsNormal,wsMinimized,wsMaximized wsNormal MDIMenu LONG R/ W Sub menu handle to insert the child window name ComponentIndex INTEGER R Index of associated component to the active child window ChildResult INTEGER R/ False W Result of the action of closing of a child window, the value is has true during closing and can be put at false at the time of a OnChildClose event to cancel closing if the application requires a safeguard QFormMDI Methods Method Type Description Params ============================== ===================================== ================================================================================ ============================== SUB Add a child window , handle& is the handle component AddChild (handle&,Title$,index&,left%, associated the child window , Title$ is the text of the title bar of 8 the child window , index& is the number of the associated component, top%,width%,height%,DefaultSize&) DefaultSize& indicates if one uses dimensions by default. CloseChild SUB Close the active child window 0 CloseAllChild SUB Close all the child window 0 CascadeChild SUB Resize all the child window on cascade 0 SetHorzChild SUB Resize all the child window on horizontal 0 SetVertChild SUB Resize all the child window on vertical 0 IconArrangeChild SUB Arrange all the child window on icon 0 MinimizeAllChild SUB Minimize all the child window 0 MaximizeAllChild SUB Maximize all the child window 0 RestoreChild SUB Restore the child window ActiveNextChild SUB Activate the next child window 0 ActivePreviousChild SUB Activate the previous child window 0 GetChild FUNCTION(Title$)& Return the index of child window corresponding to the title Title$ 1 ChildExist FUNCTION(Title$)& Return the existence of a child window by his title 1 ActiveChild SUB(Index&) Activate the child window identified by index& 1 FreeChild FUNCTION(handle&)& Return the state associated from a component to a child window, return True if 1 the component identified by handle& is not associated to a child window SetDeskBar SUB The application will be in the task bar during its reduction 0 QFormMDI Events Event Type Occurs when... Params ============================================ ============================================ ============================================ ============================================= Closing child window, the parameter OnChildClose (handleChild&,index&,titleChild$) index& is the index of the associated 3 component OnChildActive (handleChild&,index&,titleChild$) Activation child window 3 OnChildResize (handleChild&,index&,titleChild$) Resize child window 3 QFormMDI Example1 $TYPECHECK ON $include "rapidq.inc" $include "object\QformMDI.inc" DECLARE SUB mnuNew_Click DECLARE SUB mnuOpen_Click DECLARE SUB mnuClose_Click DECLARE SUB mnuCloseAll_Click DECLARE SUB mnuNext_Click DECLARE SUB mnuPrevious_Click DECLARE SUB mnuCascade_Click DECLARE SUB mnuTileHorz_Click DECLARE SUB mnuTileVert_Click DECLARE SUB mnuArrange_Click DECLARE SUB mnuMinAll_Click DECLARE SUB mnuMaxAll_Click DECLARE SUB mnuRestAll_Click DECLARE SUB mnuCut_Click DECLARE SUB mnuCopy_Click DECLARE SUB mnuPaste_Click DECLARE SUB mnuSelectAll_Click DECLARE SUB show DECLARE SUB close DECLARE SUB KeyDown(Key as word,Shift as integer) DECLARE SUB infos(handleChild as long,index as integer,titleChild as string) DECLARE SUB CloseMDI(handleChild as long,index as integer,titleChild as string) dim j as integer dim flag as integer dim UntitledCount as integer const VK_F6=117 CREATE Form AS QFormMDI Caption = "MDI Parent" Center Width=Screen.Width/2*1.5 Height=Screen.Height/2*1.5 CREATE mnuMain AS QMAINMENU CREATE mnuFile AS QMENUITEM Caption="&File" CREATE mnuNew AS QMENUITEM Caption="&New" OnClick=mnuNew_Click END CREATE CREATE mnuOpen AS QMENUITEM Caption="&Open" OnClick=mnuOpen_Click END CREATE CREATE mnuClose AS QMENUITEM Caption="&Close" OnClick=mnuClose_Click END CREATE CREATE mnuCloseAll AS QMENUITEM Caption="Close &All" OnClick=mnuCloseAll_Click END CREATE CREATE mnuNext AS QMENUITEM Caption="Next" OnClick=mnuNext_Click END CREATE CREATE mnuPrevious AS QMENUITEM Caption="Previous" OnClick=mnuPrevious_Click END CREATE END CREATE CREATE mnuEdit as QMENUITEM Caption="&Edit" CREATE mnuCut as QMENUITEM Caption="&Cut" ShortCut="CTRL+X" OnClick=mnuCut_Click END CREATE CREATE mnuCopy as QMENUITEM Caption="&Copy" ShortCut="CTRL+C" OnClick=mnuCopy_Click END CREATE CREATE mnuPaste as QMENUITEM Caption="&Paste" ShortCut="CTRL+V" OnClick=mnuPaste_Click END CREATE CREATE Sep2 as QMENUITEM Caption="-" END CREATE CREATE mnuSelectAll as QMENUITEM Caption="&Select all" ShortCut="CTRL+A" OnClick=mnuSelectAll_Click END CREATE END CREATE CREATE mnuWindows AS QMENUITEM Caption="&Windows" CREATE mnuCascade AS QMENUITEM Caption="&Cascade" OnClick=mnuCascade_Click END CREATE CREATE mnuTileHorz AS QMENUITEM Caption="Tile &Horizontally" OnClick=mnuTileHorz_Click END CREATE CREATE mnuTileVert AS QMENUITEM Caption="Tile &Vertically" OnClick=mnuTileVert_Click END CREATE CREATE mnuArrange AS QMENUITEM Caption="&Arrange Icons" OnClick=mnuArrange_Click END CREATE CREATE mnuMinAll AS QMENUITEM Caption="&Minimize All" OnClick=mnuMinAll_Click END CREATE CREATE mnuMaxAll AS QMENUITEM Caption="Ma&ximixe All" OnClick=mnuMaxAll_Click END CREATE CREATE mnuRestAll AS QMENUITEM Caption="&Restore All" OnClick=mnuRestAll_Click END CREATE END CREATE END CREATE CREATE Stat AS QSTATUSBAR END CREATE KeyPreview=true MdiMenu=mnuWindows.handle ChildMax=20 OnChildClose=CloseMDI OnChildActive=infos OnClose=Close OnPaint=Show OnKeyDown=KeyDown END CREATE ' Components for MDI dim edit(20) as qrichedit dim handleControl as long for j=0 to 20 edit(j).parent=form edit(j).visible=false 'must be no visible edit(j).ScrollBars=3 edit(j).WordWrap=false next j Form.SetDeskBar Form.ShowModal 'Find free component for MDI Function GetCtl() as integer dim find as integer dim h as integer find=0 for j=0 to 20 if form.FreeChild(edit(j).handle) and find=0 then h=j find=1 end if next j result=h End Function SUB mnuNew_Click dim index as integer if form.ChildCount0 then edit(form.componentIndex).CutToClipBoard end if END SUB SUB mnuCopy_Click if form.ChildCount>0 then edit(form.componentIndex).CopyToClipBoard end if END SUB SUB mnuPaste_Click if form.ChildCount>0 then edit(form.componentIndex).PasteFromClipBoard end if END SUB SUB mnuSelectAll_Click if form.ChildCount>0 then edit(form.componentIndex).SelectAll end if END SUB SUB infos(handleChild as long,index as integer,titleChild as string) stat.simpleText=titleChild End Sub SUB show dim index as integer if flag=false then if form.ChildCount0 then form.modalResult=false End Sub Sub KeyDown(key as word,shift as integer) 'next child with Ctrl+F6 if shift=CtrlDown and key=VK_F6 then form.ActiveNextChild end sub QFormMDI Example2 $TYPECHECK ON $OPTION ICON "photo.ico" $include "rapidq.inc" $Include "Object\QFormMDI.inc" $Include "Object\QICON.inc" DECLARE SUB mnuNew_Click DECLARE SUB mnuOpen_Click DECLARE SUB mnuClose_Click DECLARE SUB mnuCloseAll_Click DECLARE SUB mnuNext_Click DECLARE SUB mnuPrevious_Click DECLARE SUB mnuCascade_Click DECLARE SUB mnuTileHorz_Click DECLARE SUB mnuTileVert_Click DECLARE SUB mnuArrange_Click DECLARE SUB mnuMinAll_Click DECLARE SUB mnuMaxAll_Click DECLARE SUB mnuRestAll_Click DECLARE SUB show DECLARE SUB close DECLARE SUB KeyDown(Key as word,Shift as integer) DECLARE SUB infos(handleChild as long,index as integer,titleChild as string) DECLARE SUB CloseMDI(handleChild as long,index as integer,titleChild as string) dim j as integer dim flag as integer dim UntitledCount as integer const VK_F6=117 dim icon as Qicon icon.associated=true icon.filename=command$(0) CREATE Form AS QFormMDI Caption="MDI Parent" Center Width=Screen.Width/2*1.5 Height=Screen.Height/2*1.5 ChildIcon=icon.handle CREATE panel as QPANEL align=1 height=35 bevelOuter=0 CREATE bt1 as QBUTTON top=5 left=5 width=25 Hint="Prévious" ShowHint=true caption="<<" OnClick=mnuPrevious_Click END CREATE CREATE bt2 as QBUTTON top=5 left=35 width=25 Hint="Next" ShowHint=true caption=">>" OnClick=mnuNext_Click END CREATE END CREATE CREATE mnuMain AS QMAINMENU CREATE mnuFile AS QMENUITEM Caption="&File" CREATE mnuNew AS QMENUITEM Caption="&New" OnClick=mnuNew_Click END CREATE CREATE mnuOpen AS QMENUITEM Caption="&Open" OnClick=mnuOpen_Click END CREATE CREATE mnuClose AS QMENUITEM Caption="&Close" OnClick=mnuClose_Click END CREATE CREATE mnuCloseAll AS QMENUITEM Caption="Close &All" OnClick=mnuCloseAll_Click END CREATE CREATE mnuNext AS QMENUITEM Caption="Next" OnClick=mnuNext_Click END CREATE CREATE mnuPrevious AS QMENUITEM Caption="Previous" OnClick=mnuPrevious_Click END CREATE END CREATE CREATE mnuWindows AS QMENUITEM Caption="&Windows" CREATE mnuCascade AS QMENUITEM Caption="&Cascade" OnClick=mnuCascade_Click END CREATE CREATE mnuTileHorz AS QMENUITEM Caption="Tile &Horizontally" OnClick=mnuTileHorz_Click END CREATE CREATE mnuTileVert AS QMENUITEM Caption="Tile &Vertically" OnClick=mnuTileVert_Click END CREATE CREATE mnuArrange AS QMENUITEM Caption="&Arrange Icons" OnClick=mnuArrange_Click END CREATE CREATE mnuMinAll AS QMENUITEM Caption="&Minimize All" OnClick=mnuMinAll_Click END CREATE CREATE mnuMaxAll AS QMENUITEM Caption="Ma&ximixe All" OnClick=mnuMaxAll_Click END CREATE CREATE mnuRestAll AS QMENUITEM Caption="&Restore All" OnClick=mnuRestAll_Click END CREATE END CREATE END CREATE CREATE Stat AS QSTATUSBAR END CREATE KeyPreview=true MdiMenu=mnuWindows.handle ChildMax=20 OnChildClose=CloseMDI OnChildActive=infos OnClose=Close OnKeyDown=KeyDown END CREATE 'components for MDI dim edit(20) as qpanel dim img(20) as qimage for j=0 to 20 edit(j).parent=form edit(j).visible=false 'must be no visible edit(j).bevelOuter=0 edit(j).color=&hffffff img(j).AutoSize=1 img(j).Parent=edit(j) next j Form.SetDeskBar Form.ShowModal 'Find free component for MDI Function GetCtl() as integer dim find as integer dim h as integer find=0 for j=0 to 20 if form.FreeChild(edit(j).handle) and find=0 then h=j find=1 end if next j result=h End Function SUB mnuNew_Click dim index as integer if form.ChildCount0 then form.modalResult=false if form.ChildCount=0 then icon.filename="" End Sub Sub KeyDown(key as word,shift as integer) 'next child with Ctrl+F6 if shift=CtrlDown and key=VK_F6 then form.ActiveNextChild end sub ' =============================================================================== ' 2003 Holyguard.net - 2007_Abruzzoweb