Maurizio,
Reviewing it... thanks ![]()
Maurizio,
Reviewing it... thanks ![]()
Maurizio,
This example is working fine here:
#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 oMenuBut when executing it, I found that when the first popup is going to open, an error ocurrs (same problem related to DATAs l2007 and 2010).
So I reviewed Class TMenu Method Redefine() and found that we were not properly initializing l2007 and l2010 for submenus, so this is the right code:
static function ResBuild( oMenu )
...
if ( hSubMenu := GetSubMenu( hMenu, n - 1 ) ) != 0
oSubMenu = TMenu()
oSubMenu:l2007 = oMenu:l2007 // new
oSubMenu:l2010 = oMenu:l2010 // new
oSubMenu:hMenu = hSubMenu
oSubMenu:lSysMenu = .f.
oSubMenu:aMenuItems = {}
oMenuItem:bAction = oSubMenu
ResBuild( oSubMenu )
endif...
With those changes it does not fail. I am including this change for next FWH build, thanks :-)