EnricoMaria wrote:You can't, as far as I know.
EMG
Antonio Linares wrote:> 3. Use SetParent() to transform the regular window to a MDI child
Good idea
But, what window are you using as the parent ? Keep in mind that a MDI window contains a "ghost" window at DATA oWndClient, so SetParent() should be used this way:
SetParent( oWndChild:hWnd, oWnd:oWndClient:hWnd )
Please let us know the results, thanks
SetParent( oWndChild:hWnd, oWndParent:oWndClient:hWnd )
EnricoMaria wrote:Patrick, but at the end, why do you want to do such a non-standard thing?
EMG
Antonio Linares wrote:Patrick,
> Maybe it's simpler to modify MDIChild.prg class to accept menu?
We can't as it is a Windows built-in class, and it manages the menu automatically
>
It looks like SetParent() also does not add the oWndParent:oWndClient:aWnd. Or do I need to add it manually to it?
>
yes, add it manually
#include "fivewin.ch"
STATIC oWndParent
PROCEDURE Main
LOCAL oMenu
MENU oMenu
MENUITEM "Menu"
MENU
MENUITEM "New Regular window" ;
ACTION NewWindow2(.F.,"Regular window")
MENUITEM "New regular MDI Child window" ;
ACTION NewWindow1("Regular MDI Child window")
MENUITEM "New MDI Child window via Setparent()" ;
ACTION NewWindow2(.T.,"MDI Child window via Setparent()")
SEPARATOR
MENUITEM "Show Len(oWndParent:oWndClient:aWnd)" ;
ACTION MsgInfo( Len(oWndParent:oWndClient:aWnd) )
ENDMENU
ENDMENU
DEFINE WINDOW oWndParent ;
MENU oMenu ;
FROM 10,10 TO 50,99 ;
TITLE "Test MDI Child with Setparent()" ;
MDI
ACTIVATE WINDOW oWndParent
RETURN
//-------------------------------------------------------------//
PROCEDURE NewWindow1(cTitle)
LOCAL oWndChild
DEFINE WINDOW oWndChild;
MDICHILD;
OF oWndParent
ACTIVATE WINDOW oWndChild;
ON MOVE ShowCoordinates(oWndChild,cTitle) ;
ON RESIZE ShowCoordinates(oWndChild, cTitle) ;
ON PAINT ShowCoordinates(oWndChild, cTitle)
RETURN NIL
//-------------------------------------------------------------//
PROCEDURE NewWindow2(lMDIChild,cTitle)
LOCAL oWndChild,oMenu
MENU oMenu
MENUITEM "File"
MENU
MENUITEM "Show coordinates";
ACTION MsgInfo( ShowCoordinates(oWndChild, cTitle) )
ENDMENU
ENDMENU
DEFINE WINDOW oWndChild;
MENU oMenu
ACTIVATE WINDOW oWndChild;
ON MOVE ShowCoordinates(oWndChild, cTitle) ;
ON RESIZE ShowCoordinates(oWndChild, cTitle) ;
ON PAINT ShowCoordinates(oWndChild, cTitle)
IF lMDIChild
SetParent( oWndChild:hWnd, oWndParent:oWndClient:hWnd )
//Aadd( oWndParent:oWndClient:aWnd, oWndChild )
ENDIF
RETURN NIL
//-------------------------------------------------------------//
FUNCTION ShowCoordinates(oWndChild,cTitle)
LOCAL aStart, cPos, aClntArea
aClntArea:=GetClientRect(oWndParent:hWnd)
oWndChild:Normal()
aStart:={aClntArea[ 1],aClntArea[ 2]}
ClientToScreen(oWndParent:hWnd,aStart)
oWndChild:CoorsUpdate()
cPos:=LTrim(Str(oWndChild:nTop ,4,0))+","+;
LTrim(Str(oWndChild:nLeft ,4,0))+","+;
LTrim(Str(oWndChild:nBottom ,4,0))+","+;
LTrim(Str(oWndChild:nRight ,4,0))
oWndChild:SetText( cTitle + " [ " + cPos + " ]" )
RETURN cTitle + " [ " + cPos + " ]"
Antonio Linares wrote:Why don't you use a toolbar on the MDICHILD window ? The buttons of the toolbar can have dropdown menus.
Antonio Linares wrote:> But we are close no? Once we can set the coordinates correctly?
We are going to review it asap
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 86 guests