FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange behavior of the when clause in the menu
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
Strange behavior of the when clause in the menu
Posted: Sat Dec 14, 2019 11:38 PM
Hi all,
please test this program , is normal behavior ?
thank

Code (fw): Select all Collapse
#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

//----------------------------------------------------------------------------//
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Strange behavior of the when clause in the menu
Posted: Sun Dec 15, 2019 12:58 AM
Mauri, What version of Fivewin do you use?

Please at moment, try with
Code (fw): Select all Collapse
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

Continue the discussion