FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in mdichild menu [Fixed]
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in mdichild menu [Fixed]
Posted: 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 (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: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: Mon Jan 25, 2016 09:29 PM
Enrico Maria Giordano wrote:This bug is still there (ALT-1 does nothing, ALT-2 open Test&1, mdichild icon vanishes):

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


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 (fw): Select all Collapse
       //if( bMdi ) //&& bPrev )
       // {
         //lpdis->rcItem.right -= 57;
       // }
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 01: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

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 01:56 PM

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

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 02: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
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 02:51 PM

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

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 02:55 PM

I know
That's what needs to be solved

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 03:05 PM

Ok, thank you.

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 09:29 PM

Fixed for next version

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 09:30 PM

Great! Many thanks!

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Wed Jun 28, 2017 10:16 PM
Unfortunately the bug has moved here (note: MAXIMIZED is commented out):

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: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: 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

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in mdichild menu
Posted: Thu Jun 29, 2017 08:01 AM

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

EMG

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Bug in mdichild menu
Posted: 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 (fw): Select all Collapse
聽 聽 聽 聽 聽 聽 聽 聽 聽 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 )
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noci贸n del tiempo

El secreto de la felicidad no est谩 en hacer lo que te gusta, sino en que te guste lo que haces