Strange behavior of the when clause in the menu

Strange behavior of the when clause in the menu

Postby mauri.menabue » Sat Dec 14, 2019 11:38 pm

Hi all,
please test this program , is normal behavior ?
thank

Code: Select all  Expand view

#include "FiveWin.ch"

//----------------------------------------------------------------------------//

static oWnd

function Main()

   DEFINE WINDOW oWnd FROM 1, 5 TO 20, 70 TITLE "Menu When" ;
      MENU BuildMenu()

   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//

function BuildMenu()

LOCAL oMenu

MENU oMenu
  MENUITEM "Item 1" when .F.
    MENU
      MENUITEM "Item 1 / SubItem 1"  ACTION MsgInfo( "Why SubItem 1 is not locked if Item 1 is locked ?" )  when .T.
      MENUITEM "Item 1 / SubItem 2"  ACTION MsgInfo( "Locked" ) when .F.
      MENUITEM "Item 1 / Subitem 3"  ACTION MsgInfo( "Locked without clause 'WHEN'" )    
   ENDMENU
   MENUITEM "End"   ACTION ( MsgInfo( "End" ), oWnd:End() ) WHEN .T.
ENDMENU

return oMenu

//----------------------------------------------------------------------------//

 
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm

Re: Strange behavior of the when clause in the menu

Postby cnavarro » Sun Dec 15, 2019 12:58 am

Mauri, What version of Fivewin do you use?

Please at moment, try with
Code: Select all  Expand view

function BuildMenu()

LOCAL oMenu

MENU oMenu
  MENUITEM "Item 1" DISABLED //when .F.
    MENU
      MENUITEM "Item 1 / SubItem 1"  ACTION MsgInfo( "Why SubItem 1 is not locked if Item 1 is locked ?" )  when .T.
      MENUITEM "Item 1 / SubItem 2"  ACTION MsgInfo( "Locked" ) when .F.
      MENUITEM "Item 1 / Subitem 3"  ACTION MsgInfo( "Locked without clause 'WHEN'" )    
   ENDMENU
   MENUITEM "Other"   ACTION ( oWnd:End() ) WHEN .F.
   MENUITEM "End"     ACTION ( MsgInfo( "End" ), oWnd:End() ) WHEN .T.
ENDMENU

return oMenu

 
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests