Bug in mdichild menu [Fixed]

Bug in mdichild menu [Fixed]

Postby Enrico Maria Giordano » Mon Jan 25, 2016 11:17 am

This bug is still there (ALT-1 does nothing, ALT-2 open Test&1, mdichild icon vanishes):

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: 6655
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in mdichild menu

Postby cnavarro » Mon Jan 25, 2016 9:29 pm

Enrico Maria Giordano wrote:This bug is still there (ALT-1 does nothing, ALT-2 open Test&1, mdichild icon vanishes):

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


Enrico, you are right
This old bug is present for me
I have not been forgotten

You can see my first tests

Remove characters of comment in lines 1412 at 1415 in menudraw.c

Code: Select all  Expand view

       //if( bMdi ) //&& bPrev )
       // {
         //lpdis->rcItem.right -= 57;
       // }
 
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Re: Bug in mdichild menu

Postby cnavarro » Mon Jun 05, 2017 1:03 pm

Dear Enrico
When MdiChild is created, locate the SYSMENU icon in the main menu bar. The items in the main menu are renumbered their order to (n + 1), but the menu has already been created before drawing.
The order of creation and in the painting are different
It is a problem that must be fixed in the creation of the table of accelerators

At the moment
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 NOSYSMENU

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

RETURN NIL

Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Bug in mdichild menu

Postby Enrico Maria Giordano » Mon Jun 05, 2017 1:56 pm

If I understood correctly, this is not possible as MDICHILDs are dinamically created after the creation of the main MDI window.

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

Re: Bug in mdichild menu

Postby cnavarro » Mon Jun 05, 2017 2:41 pm

Enrico Maria Giordano wrote:If I understood correctly, this is not possible as MDICHILDs are dinamically created after the creation of the main MDI window.

EMG


NO
The problem is with menu and SYSMENU ( locate ) of mdichild
Table of accelerators is created with ( ALT + 1 ) as the first item
As the MENUSYS icon is inserted ( now SYSMENU is first item ), the first item defined in the menu is now the second one (the accelerator table has not been modified), so it appears when you press ALT + 1, the SYSMENU and not the action of item & 1

If you add clausule NOSYSMENU, run OK
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Bug in mdichild menu

Postby Enrico Maria Giordano » Mon Jun 05, 2017 2:51 pm

Undestood. But with NOSYSMENU we don't have the three button on the right (minimize, restore and close) anymore. :-(

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

Re: Bug in mdichild menu

Postby cnavarro » Mon Jun 05, 2017 2:55 pm

I know
That's what needs to be solved
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Re: Bug in mdichild menu

Postby cnavarro » Mon Jun 05, 2017 9:29 pm

Fixed for next version
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Re: Bug in mdichild menu

Postby Enrico Maria Giordano » Wed Jun 28, 2017 10:16 pm

Unfortunately the bug has moved here (note: MAXIMIZED is commented out):

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: 6655
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in mdichild menu

Postby cnavarro » Thu Jun 29, 2017 12:21 am

Enrico,
Explain your problem better with this example
I have tried it and I think it works correctly
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Bug in mdichild menu

Postby Enrico Maria Giordano » Thu Jun 29, 2017 8:01 am

With MAXIMIZED commented out, try pressing ALT-1 and you will see a message with 2 instead of 1.

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

Re: Bug in mdichild menu

Postby cnavarro » Thu Jun 29, 2017 12:56 pm

Ok
As I said in previous posts, it is not a problem of the menus, it's of the METHOD Menuchar CLASS TWindow, try with this modification
Code: Select all  Expand view

                  if Upper( oMenu:oWnd:ClassName() ) == "TMDIFRAME"
                     if Upper( oMenu:oWnd:oWndActive:ClassName() ) == "TMDICHILD" .and. ;
                        lAnd( oMenu:oWnd:oWndActive:nStyle, WS_SYSMENU )
                        if IsZoomed( oMenu:oWnd:oWndActive:hWnd )
                           nPos := n
                        else
                           nPos := n - 1
                        endif
                     else
                        nPos := n - 1
                     endif
                  else
                     nPos := n - 1
                  endif
                  return nMakeLong( nPos, 2 )
 
Last edited by cnavarro on Thu Jun 29, 2017 5:47 pm, edited 1 time in total.
Muchas gracias. Many thanks.
Saludos,Regards

Cristobal Navarro - Harbour (r1601050904) - xHarbour (Build 20150603) - VS 2015/17 - FWH 17.12

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
User avatar
cnavarro
 
Posts: 3883
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Next

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

Who is online

Users browsing this forum: No registered users and 1 guest