MDI window

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

MDI window

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MDI window

Post by Antonio Linares »

Dear Enrico,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MDI window

Post 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 :(
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MDI window

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MDI window

Post 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 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply