Page 1 of 2
Bug in mdichild menu [Fixed]
Posted: Mon Jan 25, 2016 11:17 am
by Enrico Maria Giordano
This bug is still there (ALT-1 does nothing, ALT-2 open Test&1, mdichild icon vanishes):
Code: Select all | Expand
#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 mdichild menu
Posted: Mon Jan 25, 2016 9:29 pm
by cnavarro
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
#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
//if( bMdi ) //&& bPrev )
// {
//lpdis->rcItem.right -= 57;
// }
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 7:35 am
by Enrico Maria Giordano
Any news?
EMG
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 1:03 pm
by cnavarro
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
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 1:56 pm
by Enrico Maria Giordano
If I understood correctly, this is not possible as MDICHILDs are dinamically created after the creation of the main MDI window.
EMG
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 2:41 pm
by cnavarro
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
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 2:51 pm
by Enrico Maria Giordano
Undestood. But with NOSYSMENU we don't have the three button on the right (minimize, restore and close) anymore.
EMG
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 2:55 pm
by cnavarro
I know
That's what needs to be solved
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 3:05 pm
by Enrico Maria Giordano
Ok, thank you.
EMG
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 9:29 pm
by cnavarro
Fixed for next version
Re: Bug in mdichild menu
Posted: Mon Jun 05, 2017 9:30 pm
by Enrico Maria Giordano
Great! Many thanks!
EMG
Re: Bug in mdichild menu
Posted: Wed Jun 28, 2017 10:16 pm
by Enrico Maria Giordano
Unfortunately the bug has moved here (note: MAXIMIZED is commented out):
Code: Select all | Expand
#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 mdichild menu
Posted: Thu Jun 29, 2017 12:21 am
by cnavarro
Enrico,
Explain your problem better with this example
I have tried it and I think it works correctly
Re: Bug in mdichild menu
Posted: Thu Jun 29, 2017 8:01 am
by Enrico Maria Giordano
With MAXIMIZED commented out, try pressing ALT-1 and you will see a message with 2 instead of 1.
EMG
Re: Bug in mdichild menu
Posted: Thu Jun 29, 2017 12:56 pm
by cnavarro
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
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 )