Menuitem error with SetPrompt - Solved

Re: Menuitem error with SetPrompt - Solved

Postby Antonio Linares » Thu Jul 10, 2014 3:15 pm

Maurizio,

Reviewing it... thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Menuitem error with SetPrompt - Solved

Postby Antonio Linares » Sun Jul 13, 2014 6:36 am

Maurizio,

This example is working fine here:

Code: Select all  Expand view
#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


But 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Menuitem error with SetPrompt - Solved

Postby Maurizio » Mon Jul 14, 2014 8:17 am

For me is OK :D

Antonio , can you take a look at :
viewtopic.php?f=3&t=28844#p162156

Thanks
Maurizio
http://www.nipeservice.com
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 24 guests