Strange behavior of the when clause in the menu

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

Strange behavior of the when clause in the menu

Post by mauri.menabue »

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

Code: Select all

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

Re: Strange behavior of the when clause in the menu

Post by cnavarro »

Mauri, What version of Fivewin do you use?

Please at moment, try with

Code: Select all

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

 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Post Reply