$IFNDEF TRUE
$DEFINE True 1
$ENDIF
$IFNDEF FALSE
$DEFINE False 0
$ENDIF
$IFNDEF boolean
$DEFINE boolean INTEGER
$ENDIF
TYPE MDI_CLASS
cbSize AS LONG
style AS LONG
lpfnWndProc AS LONG
cbClsExtra AS LONG
cbWndExtra AS LONG
hInstance AS LONG
hIcon AS LONG
hCursor AS LONG
hbrBackground AS LONG
lpszMenuName AS LONG
lpszClassName AS LONG
hIconSm AS LONG
END TYPE
DECLARE FUNCTION MDI_RegisterClass LIB "User32" ALIAS "RegisterClassExA" (pcWndClassEx AS MDI_CLASS) AS LONG
DECLARE FUNCTION MDI_EnumChild LIB "User32" ALIAS "EnumChildWindows" (hWndParent AS LONG,lpEnumFunc AS LONG,lParam AS LONG) AS LONG
DECLARE FUNCTION MDI_CreateWindow LIB "User32" ALIAS "CreateWindowExA" (dwExStyle AS LONG,lpClassName AS STRING,lpWindowName AS STRING,dwStyle AS LONG,x AS LONG,y AS LONG,nWidth AS LONG,nHeight AS LONG,hWndParent AS LONG,hMenu AS LONG,hInstance AS LONG,lpParam AS LONG) AS LONG
DECLARE FUNCTION MDI_DefChildProc LIB "User32" ALIAS "DefMDIChildProcA" (hWnd AS LONG,uMsg AS LONG,wParam AS LONG,lParam AS LONG) AS LONG
DECLARE FUNCTION MDI_GetClassName LIB "User32" ALIAS "GetClassNameA" (hwnd AS LONG,ByRef lpClassName AS STRING,nMaxCount AS LONG) AS LONG
DECLARE FUNCTION MDI_SetProp LIB "User32" ALIAS "SetPropA" (hwnd AS LONG,lpString AS STRING,hData AS LONG) AS LONG
DECLARE FUNCTION MDI_GetProp LIB "User32" ALIAS "GetPropA" (hwnd AS LONG,lpString AS STRING) AS LONG
DECLARE FUNCTION MDI_GetClientRect LIB "User32" ALIAS "GetClientRect" (hwnd AS LONG,lpRect AS QRECT) AS LONG
DECLARE FUNCTION MDI_MoveWindow LIB "User32" ALIAS "MoveWindow" (hwnd AS LONG,x AS LONG,y AS LONG,nWidth AS LONG,nHeight AS LONG,bRepaint AS LONG) AS LONG
DECLARE FUNCTION MDI_SetLong LIB "User32" ALIAS "SetWindowLongA" (hwnd AS LONG,nIndex AS LONG,dwNewLong AS LONG) AS LONG
DECLARE FUNCTION MDI_GetText LIB "User32" ALIAS "GetWindowTextA" (hwnd AS LONG,ByRef lpString AS STRING,cch AS LONG) AS LONG
DECLARE FUNCTION MDI_SetText LIB "user32" ALIAS "SetWindowTextA" (hWnd AS LONG,lpString AS STRING) AS LONG
DECLARE FUNCTION MDI_SetFocus LIB "User32" ALIAS "SetFocus" (hwnd AS LONG) AS LONG
DECLARE FUNCTION MDI_SetParent LIB "user32" ALIAS "SetParent" (hWndChild AS LONG,hWndNewParent AS LONG) AS LONG
DECLARE FUNCTION MDI_GetParent LIB "user32" ALIAS "GetParent" (hwnd AS LONG) AS LONG
DECLARE FUNCTION MDI_GetRect LIB "user32" ALIAS "GetWindowRect" (hwnd AS LONG, lpRect AS QRECT) AS LONG
DECLARE FUNCTION MDI_isIconic LIB "user32" ALIAS "IsIconic" (hwnd AS LONG) AS LONG
DECLARE FUNCTION MDI_isZoomed LIB "user32" ALIAS "IsZoomed" (hwnd AS LONG) AS LONG
DECLARE FUNCTION MDI_GetTextLenght LIB "user32" ALIAS "GetWindowTextLengthA" (hwnd AS LONG) AS LONG
DECLARE FUNCTION MDI_SendMessage LIB "user32" ALIAS "SendMessageA" (hwnd AS LONG, wMsg AS LONG, wParam AS LONG, lParam AS LONG) AS LONG
DECLARE FUNCTION MDI_SetClassLong LIB "user32" ALIAS "SetClassLongA" (hwnd AS LONG,nIndex AS LONG,dwNewLong AS LONG) AS LONG
DECLARE FUNCTION MDI_ShowWindow LIB "user32" ALIAS "ShowWindow" (hwnd AS LONG,nCmdShow AS LONG) AS LONG
CONST MDI_EX_MDICHILD=&H40
CONST MDI_CHILD=&H40000000
CONST MDI_VISIBLE=&H10000000
CONST MDI_OVERLAPPED=&H0
CONST MDI_CAPTION=&HC00000
CONST MDI_SYSMENU=&H80000
CONST MDI_THICKFRAME=&H40000
CONST MDI_MINIMIZEBOX=&H20000
CONST MDI_MAXIMIZEBOX=&H10000
CONST MDI_OVERLAPPEDWINDOW=(MDI_OVERLAPPED OR MDI_CAPTION OR MDI_SYSMENU OR MDI_THICKFRAME OR MDI_MINIMIZEBOX OR MDI_MAXIMIZEBOX)
CONST MDI_MOVE = &H3
CONST MDI_CLOSE=&H10
CONST MDI_CREATE=&H1
CONST MDI_DESTROY=&H2
CONST MDI_SIZE=&H5
CONST MDI_SYSCOMMAND=&H112
CONST MDI_MDIDESTROY=&H221
CONST MDI_MDIRESTORE=&H223
CONST MDI_MDIMAXIMIZE=&H225
CONST MDI_MDITILE=&H226
CONST MDI_MDICASCADE=&H227
CONST MDI_MDIICONARRANGE=&H228
CONST MDI_MDIACTIVATE=&H222
CONST MDI_MDISETMENU=&H230
CONST MDI_MDINEXT=&H224
CONST MDI_MDIGETACTIVE = &H229
CONST MDI_CHILDACTIVATE = &H22
CONST MDI_TILE_VERTICAL=&H0
CONST MDI_TILE_HORIZONTAL=&H1
CONST MDI_HWND_DESKTOP=0
CONST MDI_USEDEFAULT=&H80000000
CONST MDI_MINIMIZE=&HF020
CONST MDI_MAXIMIZE = &HF030
CONST MDI_HWNDPARENT=-8
CONST MDI_HICON=-14
CONST MDI_COLOR_WINDOW=5
CONST MDI_COLOR_BACKGROUND=1
CONST MDI_COLOR_WINDOWFRAME=6
CONST MDI_COLOR_APPWORKSPACE=12
CONST MDI_COLOR_HIGHLIGHT=13
DECLARE SUB OnChildClose_eventTemplate(handleChild AS LONG,index AS INTEGER,titleChild AS STRING)
DECLARE SUB OnChildActive_eventTemplate(handleChild AS LONG,index AS INTEGER,titleChild AS STRING)
DECLARE SUB OnChildResize_eventTemplate(handleChild AS LONG,index AS INTEGER,titleChild AS STRING)
TYPE QFormMDI EXTENDS QFORM
Private:
hClient AS LONG
hChild(1024) AS LONG
hComponent AS LONG
ClassName AS STRING
ChildClass AS MDI_CLASS
Rect AS QRECT
style AS LONG
Public:
ChildCaption AS STRING PROPERTY SET SetChildCaption
ChildHandle AS LONG PROPERTY SET SetChildHandle
ComponentIndex AS INTEGER PROPERTY SET SetComponentIndex
ChildTop AS SHORT PROPERTY SET SetChildTop
ChildLeft AS SHORT PROPERTY SET SetChildLeft
ChildWidth AS SHORT PROPERTY SET SetChildWidth
ChildHeight AS SHORT PROPERTY SET SetChildHeight
MdiMenu AS LONG PROPERTY SET SetMdiMenu
ChildMax AS INTEGER PROPERTY SET SetChildMax
ChildCount AS INTEGER PROPERTY SET SetChildCount
ChildState AS INTEGER PROPERTY SET SetChildState
ChildIcon AS LONG PROPERTY SET SetChildIcon
ChildResult AS INTEGER
OnChildClose AS EVENT(OnChildClose_eventTemplate)
OnChildActive AS EVENT(OnChildActive_eventTemplate)
OnChildResize AS EVENT(OnChildResize_eventTemplate)
Private:
FUNCTION EnumClient(hWnd AS LONG,lParam AS LONG) AS LONG
DIM Buffer AS STRING
Buffer=SPACE$(255)
MDI_GetClassName(hWnd,Buffer,255)
IF INSTR(UCASE$(Buffer),"MDICLIENT") THEN QFormMDI.hClient=hWnd
Result=True
END FUNCTION
FUNCTION EnumChild(hWnd AS LONG,lParam AS LONG) AS LONG
DIM Buffer AS STRING
Buffer=SPACE$(255)
MDI_GetClassName(hWnd,Buffer,255)
IF INSTR(UCASE$(Buffer),"MDICHILD") THEN
IF QFormMDI.ChildCount>0 THEN
IF hwnd<>QFormMDI.hChild(QFormMDI.ChildCount-1) THEN
QFormMDI.hChild(QFormMDI.ChildCount)=hWnd
QFormMDI.ChildCount++
END IF
ELSE
QFormMDI.hChild(QFormMDI.ChildCount)=hWnd
QFormMDI.ChildCount++
END IF
END IF
Result=true
END FUNCTION
SUB GetSizeChild(hwnd AS LONG)
DIM Rc AS QRECT
DIM Rw AS QRECT
DIM borderX AS SHORT
DIM borderY AS SHORT
DIM top AS SHORT
DIM left AS SHORT
MDI_GetClientRect(QFormMDI.hClient,Rc)
MDI_GetRect(QFormMDI.hClient,Rw)
top=Rw.top
left=Rw.left
borderX=((Rw.Right-Rw.Left)-Rc.Right)/2
borderY=((Rw.Bottom-Rw.Top)-Rc.Bottom)/2
MDI_GetRect(hWnd,Rw)
QFormMDI.ChildLeft=Rw.Left-(left+borderX)
QFormMDI.ChildTop=Rw.Top-(top+borderY)
QFormMDI.ChildWidth=Rw.Right-Rw.Left
QFormMDI.ChildHeight=Rw.Bottom-Rw.Top
END SUB
FUNCTION GetState(hwnd AS LONG) AS SHORT
IF MDI_isIconic(hwnd) THEN
result=1
ELSEIF MDI_isZoomed(hwnd) THEN
result=2
ELSE
result=0
END IF
END FUNCTION
FUNCTION GetTextChild(hwnd AS LONG) AS STRING
DIM size AS INTEGER
DIM buffer AS STRING
size=MDI_GetTextLenght(hwnd)
buffer=SPACE$(size)+CHR$(0)
size=MDI_GetText(hwnd,buffer,LEN(buffer))
result=LEFT$(buffer,size)
END FUNCTION
public:
FUNCTION ChildProc(hWnd AS LONG,uMsg AS LONG,wParam AS LONG,lParam AS LONG) AS LONG
SELECT CASE uMsg
CASE MDI_CREATE
MDI_SetParent(QFormMDI.hComponent,hWnd)
MDI_ShowWindow(QFormMDI.hComponent,true)
MDI_SetProp(hWnd,"EditHandle",QFormMDI.hComponent)
MDI_SetProp(hWnd,"EditIndex",QFormMDI.ComponentIndex)
QFormMDI.ChildCount++
IF QFormMDI.MdiMenu>0 THEN SendMessage(QFormMDI.hClient,MDI_MDISETMENU,0,QFormMDI.MdiMenu)
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
CASE MDI_SIZE
QFormMDI.hComponent=MDI_GetProp(hWnd,"EditHandle")
QFormMDI.ComponentIndex=MDI_GetProp(hWnd,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(hwnd)
MDI_GetClientRect(hWnd,QFormMDI.Rect)
MDI_MoveWindow(QFormMDI.hComponent,0,0,QFormMDI.Rect.Right,QFormMDI.Rect.Bottom,True)
QFormMDI.GetSizeChild(hwnd)
IF QFormMDI.OnChildResize<>0 THEN CALLFUNC(QFormMDI.OnChildResize,hwnd,QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
CASE MDI_MDIACTIVATE
QFormMDI.ChildHandle=hWnd
QFormMDI.ChildCaption=QFormMDI.GetTextChild(hwnd)
QFormMDI.GetSizeChild(hwnd)
MDI_SetFocus(MDI_GetProp(lParam,"EditHandle"))
QFormMDI.ComponentIndex=MDI_GetProp(hWnd,"EditIndex")
QFormMDI.ChildState=QFormMDI.GetState(hwnd)
IF QFormMDI.OnChildActive<>0 THEN CALLFUNC(QFormMDI.OnChildActive,hwnd,QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
CASE MDI_CLOSE
QFormMDI.ChildResult=True
QFormMDI.ChildCaption=QFormMDI.GetTextChild(hwnd)
QFormMDI.ComponentIndex=MDI_GetProp(hWnd,"EditIndex")
IF QFormMDI.OnChildClose<>0 THEN CALLFUNC(QFormMDI.OnChildClose,hwnd,QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
IF QFormMDI.ChildResult>0 THEN
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
ELSE
Result=False
END IF
CASE MDI_DESTROY
QFormMDI.hComponent=MDI_GetProp(hWnd,"EditHandle")
MDI_MoveWindow(QFormMDI.hComponent,0,0,0,0,0)
MDI_ShowWindow(QFormMDI.hComponent,false)
MDI_SetParent(QFormMDI.hComponent,QFormMDI.handle)
QFormMDI.ChildCount--
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
CASE MDI_MOVE
QFormMDI.GetSizeChild(hwnd)
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
CASE ELSE
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildState=QFormMDI.GetState(hwnd)
END IF
Result=MDI_DefChildProc(hWnd,uMsg,wParam,lParam)
END SELECT
END FUNCTION
Public:
PROPERTY SET SetChildMax(number AS INTEGER)
IF number<=1024 THEN QFormMDI.ChildMax=number
END PROPERTY
PROPERTY SET SetChildIcon(handle AS LONG)
IF QFormMDI.ChildCount>0 THEN
MDI_SetClassLong(QFormMDI.ChildHandle,MDI_HICON,handle)
ELSE
QFormMDI.ChildClass.hIcon=handle
QFormMDI.ChildClass.hIconSm=handle
END IF
END PROPERTY
PROPERTY SET SetChildCaption(CAPTION AS STRING)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCaption=CAPTION
MDI_SetText(QFormMDI.ChildHandle,QFormMDI.ChildCaption)
END IF
END PROPERTY
PROPERTY SET SetChildHandle(handle AS LONG)
END PROPERTY
PROPERTY SET SetComponentIndex(index AS INTEGER)
END PROPERTY
PROPERTY SET SetChildTop(top AS SHORT)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildTop=top
MDI_MoveWindow(QFormMDI.ChildHandle,QFormMDI.ChildLeft,QFormMDI.ChildTop,QFormMDI.ChildWidth,QFormMDI.ChildHeight,True)
END IF
END PROPERTY
PROPERTY SET SetChildLeft(left AS SHORT)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildLeft=left
MDI_MoveWindow(QFormMDI.ChildHandle,QFormMDI.ChildLeft,QFormMDI.ChildTop,QFormMDI.ChildWidth,QFormMDI.ChildHeight,True)
END IF
END PROPERTY
PROPERTY SET SetChildWidth(width AS SHORT)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildWidth=width
MDI_MoveWindow(QFormMDI.ChildHandle,QFormMDI.ChildLeft,QFormMDI.ChildTop,QFormMDI.ChildWidth,QFormMDI.ChildHeight,True)
END IF
END PROPERTY
PROPERTY SET SetChildHeight(height AS SHORT)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHeight=height
MDI_MoveWindow(QFormMDI.ChildHandle,QFormMDI.ChildLeft,QFormMDI.ChildTop,QFormMDI.ChildWidth,QFormMDI.ChildHeight,True)
END IF
END PROPERTY
PROPERTY SET SetMdiMenu(MenuHandle AS LONG)
IF MenuHandle>0 THEN QFormMDI.MdiMenu=MenuHandle
END PROPERTY
PROPERTY SET SetChildCount(index AS INTEGER)
END PROPERTY
PROPERTY SET SetChildState(state AS INTEGER)
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildState=state
IF state=1 THEN
SendMessage(QFormMDI.ChildHandle,MDI_SYSCOMMAND,MDI_MINIMIZE,0)
ELSEIF state=2 THEN
SendMessage(QFormMDI.hClient,MDI_MDIMAXIMIZE,QFormMDI.ChildHandle,0)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
ELSE
SendMessage(QFormMDI.hClient,MDI_MDIRESTORE,QFormMDI.ChildHandle,0)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END PROPERTY
SUB AddChild(handle AS LONG,Title AS STRING,index AS INTEGER,Left AS SHORT,Top AS SHORT,Width AS SHORT,Height AS SHORT,DefaultSize AS boolean)
IF QFormMDI.hClient=0 THEN
QFormMDI.ChildClass.cbSize=SIZEOF(QFormMDI.ChildClass)
QFormMDI.ChildClass.lpfnWndProc=CODEPTR(QFormMDI.ChildProc)
QFormMDI.ChildClass.hbrBackground=MDI_COLOR_WINDOWFRAME
QFormMDI.ChildClass.lpszClassName=VARPTR(QFormMDI.ClassName)
MDI_RegisterClass(QFormMDI.ChildClass)
MDI_EnumChild(QFormMDI.Handle,CODEPTR(QFormMDI.EnumClient),0)
END IF
IF QFormMDI.ChildCount<QFormMDI.ChildMax AND handle<>0 THEN
QFormMDI.hComponent=handle
QFormMDI.ComponentIndex=index
QFormMDI.style=MDI_CHILD OR MDI_VISIBLE OR MDI_OVERLAPPEDWINDOW
IF DefaultSize=True THEN
QFormMDI.hChild(QFormMDI.ChildCount)=MDI_CreateWindow(MDI_EX_MDICHILD,QFormMDI.ClassName,Title,QFormMDI.style,MDI_USEDEFAULT,MDI_USEDEFAULT,MDI_USEDEFAULT,MDI_USEDEFAULT,QFormMDI.hClient,0,0,0)
ELSE
QFormMDI.hChild(QFormMDI.ChildCount)=MDI_CreateWindow(MDI_EX_MDICHILD,QFormMDI.ClassName,Title,QFormMDI.style,Left,Top,Width,Height,QFormMDI.hClient,0,0,0)
END IF
END IF
END SUB
SUB CloseChild
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildResult=True
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
IF QFormMDI.OnChildClose<>0 THEN CALLFUNC(QFormMDI.OnChildClose,QFormMDI.CHildHandle,QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
IF QFormMDI.ChildResult>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDIDESTROY,QFormMDI.ChildHandle,0)
END IF
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
QFormMDI.ChildState=QFormMDI.GetState(QFormMDI.ChildHandle)
QFormMDI.GetSizeChild(QFormMDI.ChildHandle)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END SUB
SUB CloseAllChild
DIM i AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
IF QFormMDI.ChildCount>1 THEN
FOR i=0 TO QFormMDI.ChildCount-1
QFormMDI.ChildResult=True
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.hChild(i),"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.hChild(i))
IF QFormMDI.OnChildClose<>0 THEN CALLFUNC(QFormMDI.OnChildClose,QFormMDI.hChild(i),QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
IF QFormMDI.ChildResult>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDIDESTROY,QFormMDI.hChild(i),0)
END IF
NEXT i
ELSE
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildResult=True
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.hChild(0),"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.hChild(0))
IF QFormMDI.OnChildClose<>0 THEN CALLFUNC(QFormMDI.OnChildClose,QFormMDI.hChild(0),QFormMDI.ComponentIndex,QFormMDI.ChildCaption)
IF QFormMDI.ChildResult>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDIDESTROY,QFormMDI.hChild(0),0)
END IF
END IF
END IF
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
QFormMDI.ChildState=QFormMDI.GetState(QFormMDI.ChildHandle)
QFormMDI.GetSizeChild(QFormMDI.ChildHandle)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END SUB
SUB CascadeChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDICASCADE,0,0)
END IF
END SUB
SUB SetHorzChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDITILE,MDI_TILE_HORIZONTAL,0)
END IF
END SUB
SUB SetVertChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDITILE,MDI_TILE_VERTICAL,0)
END IF
END SUB
SUB IconArrangeChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDIICONARRANGE,0,0)
END IF
END SUB
SUB MinimizeAllChild
DIM i AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
FOR i=0 TO QFormMDI.ChildCount-1
SendMessage(QFormMDI.hChild(i),MDI_SYSCOMMAND,MDI_MINIMIZE,0)
NEXT i
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
QFormMDI.ChildState=QFormMDI.GetState(QFormMDI.ChildHandle)
QFormMDI.GetSizeChild(QFormMDI.ChildHandle)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END SUB
SUB MaximizeAllChild
DIM i AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
FOR i=0 TO QFormMDI.ChildCount-1
SendMessage(QFormMDI.hClient,MDI_MDIMAXIMIZE,QFormMDI.hChild(i),0)
NEXT i
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
QFormMDI.ChildState=QFormMDI.GetState(QFormMDI.ChildHandle)
QFormMDI.GetSizeChild(QFormMDI.ChildHandle)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END SUB
SUB RestoreChild
DIM i AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
FOR i=0 TO QFormMDI.ChildCount-1
SendMessage(QFormMDI.hClient,MDI_MDIRESTORE,QFormMDI.hChild(i),0)
NEXT i
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildHandle=MDI_SendMessage(QFormMDI.hClient,MDI_MDIGETACTIVE,0,0)
QFormMDI.ComponentIndex=MDI_GetProp(QFormMDI.ChildHandle,"EditIndex")
QFormMDI.ChildCaption=QFormMDI.GetTextChild(QFormMDI.ChildHandle)
QFormMDI.ChildState=QFormMDI.GetState(QFormMDI.ChildHandle)
QFormMDI.GetSizeChild(QFormMDI.ChildHandle)
MDI_SetFocus(MDI_GetProp(QFormMDI.ChildHandle,"EditHandle"))
END IF
END IF
END SUB
SUB ActiveNextChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDINEXT,QFormMDI.ChildHandle,False)
END IF
END SUB
SUB ActivePreviousChild
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDINEXT,QFormMDI.ChildHandle,True)
END IF
END SUB
FUNCTION GetChild(title AS STRING) AS INTEGER
DIM i AS INTEGER
DIM index AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
index=0
FOR i=0 TO QFormMDI.ChildCount-1
IF title=QFormMDI.GetTextChild(QFormMDI.hChild(i)) THEN index=i
NEXT i
result=index
ELSE
result=0
END IF
END FUNCTION
FUNCTION ChildExist(title AS STRING) AS boolean
DIM i AS INTEGER
DIM exist AS INTEGER
IF QFormMDI.ChildCount>0 THEN
QFormMDI.ChildCount=0
MDI_EnumChild(QFormMDI.hClient,CODEPTR(QFormMDI.EnumChild),0)
exist=False
FOR i=0 TO QFormMDI.ChildCount-1
IF title=QFormMDI.GetTextChild(QFormMDI.hChild(i)) THEN exist=True
NEXT i
result=exist
ELSE
result=False
END IF
END FUNCTION
SUB ActiveChild(index AS INTEGER)
IF QFormMDI.ChildCount>0 THEN
SendMessage(QFormMDI.hClient,MDI_MDIACTIVATE,QFormMDI.hChild(index),0)
END IF
END SUB
FUNCTION FreeChild(handle AS LONG) AS boolean
IF MDI_GetParent(handle)=QFormMDI.handle THEN
result=True
ELSE
result=False
END IF
END FUNCTION
SUB SetDeskBar
MDI_SetLong(QFormMDI.handle,MDI_HWNDPARENT,MDI_HWND_DESKTOP)
MDI_SetLong(application.handle,MDI_HWNDPARENT,QFormMDI.handle)
END SUB
CONSTRUCTOR
FormStyle=2
COLOR=-2147483636
ChildMax=1024
ClassName="MDIChild"
hClient=0
ChildCount=0
END CONSTRUCTOR
END TYPE
|
|