Page 1 of 1

MDI window

Posted: Sun Jun 08, 2008 6:24 pm
by Enrico Maria Giordano
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: Select all

#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

Re: Bug in MDI window

Posted: Sat Jun 21, 2008 12:32 pm
by Enrico Maria Giordano
Any news?

EMG

Re: Bug in MDI window

Posted: Sat Jul 26, 2008 10:41 am
by Enrico Maria Giordano
Any news?

EMG

Re: MDI window

Posted: Sun Mar 22, 2009 10:41 am
by Enrico Maria Giordano
Just to move this up. :-)

EMG

Re: MDI window

Posted: Fri Apr 10, 2009 6:39 pm
by Antonio Linares
Dear Enrico,

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

Re: MDI window

Posted: Fri Apr 10, 2009 7:24 pm
by Antonio Linares
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: Select all

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 :(

Re: MDI window

Posted: Fri Apr 10, 2009 7:33 pm
by Antonio Linares
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.

Re: MDI window

Posted: Fri Apr 10, 2009 7:52 pm
by Antonio Linares
If we check nWParam and nLParam from Class TMdiFrame Method Command():

Code: Select all

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 ?

Re: MDI window

Posted: Thu Dec 03, 2009 11:33 am
by Enrico Maria Giordano
Any news?

EMG