FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos MDI window
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
MDI window
Posted: Sun Jun 08, 2008 06:24 PM
In the following sample, try to hit ALT-1 and you will get the system menu instead of the Changed1 menu action. If you hit ALT-2 you will get Changed1 menu action instead of the Changed2 one. You will also notice that the MDI Child icon is vanished at this point.

Code (fw): Select all Collapse
#include "Fivewin.ch"

FUNCTION MAIN()

    LOCAL oWnd, oMenu

    MENU oMenu 2007
        MENUITEM "Test&1" ACTION MSGINFO( "1" )
        MENUITEM "Test&2" ACTION MSGINFO( "2" )
        MENUITEM "Test&3" ACTION MSGINFO( "3" )
    ENDMENU

    DEFINE WINDOW oWnd MDI;
           TITLE "MDI Test";
           MENU oMenu

    ACTIVATE WINDOW oWnd;
             ON INIT CREATECHILD( oWnd )

    RETURN NIL


STATIC FUNCTION CREATECHILD( oMdi )

    LOCAL oWnd, oMenu

    MENU oMenu 2007
        MENUITEM "Changed&1" ACTION MSGINFO( "1" )
        MENUITEM "Changed&2" ACTION MSGINFO( "2" )
        MENUITEM "Changed&3" ACTION MSGINFO( "3" )
    ENDMENU

    DEFINE WINDOW oWnd MDICHILD OF oMdi;
           TITLE "MDI Child Test";
           MENU oMenu

    ACTIVATE WINDOW oWnd;
             VALID !GETKEYSTATE( VK_ESCAPE );
             MAXIMIZED

    RETURN NIL


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: MDI window
Posted: Fri Apr 10, 2009 06:39 PM

Dear Enrico,

Yes, we noticed this behavior too, but we don't know yet why it happens :(

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: MDI window
Posted: Fri Apr 10, 2009 07:24 PM
This is not the right solution and it just works partially, but it may be the start to fix it.

In Class TMenu Method Command():
Code (fw): Select all Collapse
METHOD Command( nCommand ) CLASS TMenu

   local oMenuItem // := ::GetMenuItem( nCommand )
   
   if Upper( ::oWnd:ClassName() ) == "TMDIFRAME" .and. IsZoomed( ::oWnd:oWndActive:hWnd )
      nCommand++
   endif   

   oMenuItem = ::GetMenuItem( nCommand )
   ...

Somehow nCommand is sent with a wrong value, thats why we need to modify it.

This workaround works for all items except for the first one :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: MDI window
Posted: Fri Apr 10, 2009 07:33 PM

Using the mouse it works fine, so such fix such not be used with the mouse.

So we need to detect Alt (how?) or detect that the mouse is used.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: MDI window
Posted: Fri Apr 10, 2009 07:52 PM
If we check nWParam and nLParam from Class TMdiFrame Method Command():
Code (fw): Select all Collapse
METHOD Command( nWParam, nLParam ) CLASS TMdiFrame

   local lToolBar := .f.

   MsgInfo( nWParam )  

   ...

nWParam is different for Alt+... or clicking the mouse, but nLParam is the same (zero).

So, how to know if the keyboard or the mouse was used ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion