MDI window

MDI window

Postby Enrico Maria Giordano » Sun Jun 08, 2008 6: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: Select all  Expand view
#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
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia



Re: MDI window

Postby Enrico Maria Giordano » Sun Mar 22, 2009 10:41 am

Just to move this up. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: MDI window

Postby Antonio Linares » Fri Apr 10, 2009 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MDI window

Postby Antonio Linares » Fri Apr 10, 2009 7: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: Select all  Expand view

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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MDI window

Postby Antonio Linares » Fri Apr 10, 2009 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: MDI window

Postby Antonio Linares » Fri Apr 10, 2009 7:52 pm

If we check nWParam and nLParam from Class TMdiFrame Method Command():
Code: Select all  Expand view

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



Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 2 guests