MENUITEM oFirst PROMPT "&First Alt-F2" MESSAGE "First option" ;
ACTION If( oFirst:lActive, oFirst:Disable(), oFirst:Enable() ) ;
ACCELERATOR ACC_ALT, VK_F2
oFirst:SetPrompt( "Cambiado" )
// Using PullDown Menus from resources
#include "FiveWin.ch"
#include "ResMenu.ch" // Some IDs for this Test
static oWnd
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 75 ;
TITLE "Using Menus from resources" ;
MENU BuildMenu()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem ,oItem2
DEFINE MENU oMenu RESOURCE "Main"
REDEFINE MENUITEM oItem ID ID_ABOUT OF oMenu ;
ACTION MsgInfo( "About FiveWin" )
REDEFINE MENUITEM oItem2 ID ID_TEST OF oMenu ;
ACTION MsgInfo( "Testing Resources PullDown Menus" )
REDEFINE MENUITEM ID ID_EXIT OF oMenu ACTION oWnd:End()
REDEFINE MENUITEM ID ID_DELETE OF oMenu ACTION MsgInfo( "ok: Delete" )
oItem2:SetPrompt( "Cambiado" )
return oMenu
//----------------------------------------------------------------------------//
// Using PullDown Menus from resources
#include "FiveWin.ch"
#include "ResMenu.ch" // Some IDs for this Test
static oWnd
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 75 ;
TITLE "Using Menus from resources" ;
MENU BuildMenu()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem ,oItem2
DEFINE MENU oMenu RESOURCE "Main"
REDEFINE MENUITEM oItem PROMPT " Test " ID ID_ABOUT OF oMenu ;
ACTION MsgInfo( "About FiveWin" )
REDEFINE MENUITEM oItem2 ID ID_TEST OF oMenu ;
ACTION MsgInfo( "Testing Resources PullDown Menus" )
REDEFINE MENUITEM ID ID_EXIT OF oMenu ACTION oWnd:End()
REDEFINE MENUITEM ID ID_DELETE OF oMenu ACTION MsgInfo( "ok: Delete" )
return oMenu
//----------------------------------------------------------------------------//
#xcommand REDEFINE MENUITEM [ <oMenuItem> ] ;
[ PROMPT <cPrompt> ] ;
[ ID <nId> <of: OF, MENU> <oMenu> ] ;
...
METHOD ReDefine( cResName, lPopup ) CLASS TMenu
local hMenu := LoadMenu( GetResources(), cResName )
local n
DEFAULT lPopup := .F.
::hMenu = hMenu
::aMenuItems = {}
::lSysMenu = .f.
::lPopup = lPopup
::l2007 = .F. // new
::l2010 = .F. // new
if lPopup
// Windows does not provides a way of storing only Popups in resources
// so we are going to create one on the fly copying it from the
// one placed at resources
::hMenu = CreatePopupMenu()
MenuClone( ::hMenu, hMenu )
DestroyMenu( hMenu )
endif
ResBuild( Self )
return Self
// Using PullDown Menus from resources
#include "FiveWin.ch"
#include "ResMenu.ch" // Some IDs for this Test
static oWnd
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 75 ;
TITLE "Using Menus from resources" ;
MENU BuildMenu()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem ,oItem2
DEFINE MENU oMenu RESOURCE "Main"
REDEFINE MENUITEM oItem ID ID_ABOUT OF oMenu ;
ACTION MsgInfo( "About FiveWin" )
REDEFINE MENUITEM oItem2 ID ID_TEST OF oMenu ;
ACTION MsgInfo( "Testing Resources PullDown Menus" )
REDEFINE MENUITEM ID ID_EXIT OF oMenu ACTION oWnd:End()
REDEFINE MENUITEM ID ID_DELETE OF oMenu ACTION MsgInfo( "ok: Delete" )
oItem2:SetPrompt( "Cambiado" )
return oMenu
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem, oItem2
DEFINE MENU oMenu RESOURCE "Main"
REDEFINE MENUITEM oItem ID ID_ABOUT OF oMenu ;
ACTION MsgInfo( "About FiveWin" )
REDEFINE MENUITEM oItem2 ID ID_TEST OF oMenu ;
ACTION MsgInfo( "Testing Resources PullDown Menus" )
REDEFINE MENUITEM ID ID_EXIT OF oMenu ACTION oWnd:End()
REDEFINE MENUITEM ID ID_DELETE OF oMenu ACTION MsgInfo( "ok: Delete" )
oItem2:SetPrompt( "FWH power" )
return oMenu
#include "FiveWin.ch"
#define MF_ENABLED 0
#define MF_GRAYED 1
#define MF_DISABLED 2
#define MF_BITMAP 4
#define MF_CHECKED 8
#define MF_POPUP 16 // 0x0010
#define MF_BREAK 64
#define MF_BYPOSITION 1024 // 0x0400
#define MF_SEPARATOR 2048 // 0x0800
#define MF_HELP 16384 // 0x4000
#define MF_HILITE 128 // 0x0080
#define MF_UNHILITE 0
#define MF_OWNERDRAW 256 // 0x0100
static hClass
static aPopups := {}
// Using PullDown Menus from resources
#include "FiveWin.ch"
#include "ResMenu.ch" // Some IDs for this Test
static oWnd
//----------------------------------------------------------------------------//
function Main()
DEFINE WINDOW oWnd FROM 1, 1 TO 20, 75 ;
TITLE "Using Menus from resources" ;
MENU BuildMenu()
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu, oItem ,oItem2
DEFINE MENU oMenu RESOURCE "Main"
REDEFINE MENUITEM oItem ID ID_ABOUT OF oMenu ;
ACTION MsgInfo( "About FiveWin" )
REDEFINE MENUITEM oItem2 ID ID_TEST OF oMenu ;
ACTION MsgInfo( "Testing Resources PullDown Menus" )
REDEFINE MENUITEM ID ID_EXIT OF oMenu ACTION oWnd:End()
REDEFINE MENUITEM ID ID_DELETE OF oMenu ACTION MsgInfo( "ok: Delete" )
? oMenu:GetMenuItem(ID_TEST):cCaption // About ResMenu Test...
oMenu:GetMenuItem(ID_TEST):cCaption := "FWH power "
return oMenu
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 51 guests