Borderless MDI Child?
Borderless MDI Child?
Ok, Ive looked in the MDI sample and docs. There is a borderless flag, but its only for the MDI parent, and doesnt work on XP pro (or at least not on my copy, and it's uptodate).
So, how does one get a borderless MDI client? This is a requirement for my game due to skinning, so... Anybody know how?
So, how does one get a borderless MDI client? This is a requirement for my game due to skinning, so... Anybody know how?
-
- Enthusiast
- Posts: 665
- Joined: Fri Sep 12, 2003 10:40 pm
- Location: Tallahassee, Florida
ok, use the EnumChildWindows_ API procedure to get the handles of the child windows of the MDI. once you have the handle, use the
setwindowlong_() procedure to set the right flags.
it is easiest to store the childwindows of a entity in a linked list with a structure. that way, you can have each child window have its own element in the list, and then have lots of "sub elements" in the structure to store position, flags, borders, or whatever. hope this helps.
setwindowlong_() procedure to set the right flags.
Code: Select all
Structure FindWindowData
childwindowhandle.l
EndStructure
NewList FindChild.FindWindowData()
Procedure.l EnumChildProc(hChild, lParam)
clearlist(findchild()) ;make sure we dont keep adding and adding to it
AddElement(FindChild()) ; add an element for each child window
FindChild()\childwindowhandle= hChild ; store the child handle
ProcedureReturn 1
EndProcedure
EnumChildWindows_(gadgetid(#mdi_gadget), @EnumChildProc(), 0)
foreach findchild() ;cycle through each child window
setwindowlong_(FindChild()\childwindowhandle,blah blah)
next
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
-
- Enthusiast
- Posts: 665
- Joined: Fri Sep 12, 2003 10:40 pm
- Location: Tallahassee, Florida
GOT IT!!!!!
try that for now and see how it goes. Regards!!!!!!!!
Code: Select all
Structure FindWindowData
childwindowhandle.l
EndStructure
NewList FindChild.FindWindowData()
Procedure.l EnumChildProc(hChild, lParam)
;ClearList(FindChild()) ;make sure we dont keep adding and adding to it
AddElement(FindChild()) ; add an element for each child window
FindChild()\childwindowhandle= hChild ; store the child handle
ProcedureReturn 1
EndProcedure
If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget,"MDIGadget")
If CreateGadgetList(WindowID(0)) And CreateMenu(0, WindowID(0))
MenuTitle("Menu index 0")
MenuTitle("MDI windows menu")
MenuItem(0, "self created item")
MenuItem(1, "self created item")
MDIGadget(0, 0, 0, 0, 0, 1, 2, #PB_MDI_AutoSize)
AddGadgetItem(0, -1, "child window")
AddGadgetItem(0, -1, "child window")
; add gadgets here...
CloseGadgetList()
EndIf
EnumChildWindows_(GadgetID(0), @EnumChildProc(), 0)
ForEach FindChild() ;cycle through each child window
SetWindowLong_(FindChild()\childwindowhandle,#GWL_STYLE, #WS_CHILD|#WS_DLGFRAME|#WS_CLIPCHILDREN|#WS_CLIPSIBLINGS )
SetWindowPos_( FindChild()\childwindowhandle,0,0,0,0,0,#SWP_NOSIZE|#SWP_NOMOVE|#SWP_FRAMECHANGED )
ShowWindow_(FindChild()\childwindowhandle,#SW_SHOW)
Next
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
Well, for an MDIGadget, the returnvalue of the "AddGadgetItem()" function is
actually the window handle of the mdi child you just created. So you don't
need to enumerate the child windows, you can just use these handles instead.
And if you do want to enumerate them, there is something you have to know:
There are also hidden child windows other than the real ones, which you
should skip in the enumeration (this is a windows thing), so the procedure
should look like this:
Timo
actually the window handle of the mdi child you just created. So you don't
need to enumerate the child windows, you can just use these handles instead.
And if you do want to enumerate them, there is something you have to know:
There are also hidden child windows other than the real ones, which you
should skip in the enumeration (this is a windows thing), so the procedure
should look like this:
Code: Select all
Procedure.l EnumChildProc(hChild, lParam)
; this skips those child windows that are not the real ones.
;
If GetWindow_(hChild, #GW_OWNER)
ProcedureReturn #TRUE
EndIf
;ClearList(FindChild()) ;make sure we dont keep adding and adding to it
AddElement(FindChild()) ; add an element for each child window
FindChild()\childwindowhandle= hChild ; store the child handle
ProcedureReturn 1
EndProcedure
quidquid Latine dictum sit altum videtur
-
- Enthusiast
- Posts: 665
- Joined: Fri Sep 12, 2003 10:40 pm
- Location: Tallahassee, Florida
had to just throw that in there, huh freak? had to rain on my parade. i finally know the answer to complex API stuff, and you gotta just shoot back.
haha. anyway, i didnt know there were hidden windows to an MDI. just goes to show the engineers of MS have no touch with reality as the rest of humanity knows it. and with the addgadgetitem for the MDI, why not update the help file to reflect that the return of that is the child handle. i.e.
childhandle=addgadgetitem(#MDI,-1,"childwindow)
just a suggestion.

childhandle=addgadgetitem(#MDI,-1,"childwindow)
just a suggestion.
Code: Select all
!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw
Somehow I do not think the above statement is accurate. For example, try the following code :freak wrote:Well, for an MDIGadget, the returnvalue of the "AddGadgetItem()" function is
actually the window handle of the mdi child you just created. So you don't
need to enumerate the child windows, you can just use these handles instead.
Timo
Code: Select all
myMDI = MDIGadget(#PB_Any, 0, 0, 0, 0, 1, #MENU_FirstMDI, #PB_MDI_AutoSize)
;Add login window / MDI Child
frmLogin = AddGadgetItem(myMDI, -1, "Login")
SetGadgetItemAttribute(myMDI,frmLogin,#PB_MDI_ItemWidth,200)
Yes, the statement is completly accurate. the result of AddGadgetItem()
is the OS handle for the mdi child window, and you can use it for any
api command you want without problems.
You can't use that value for PB commands though, because they don't work
with the os handles.
Timo
is the OS handle for the mdi child window, and you can use it for any
api command you want without problems.
You can't use that value for PB commands though, because they don't work
with the os handles.
Timo
quidquid Latine dictum sit altum videtur