Bug in TMenu

Bug in TMenu

Postby Enrico Maria Giordano » Sat Jan 09, 2010 11:02 pm

In the following sample, open the menu and wait for the timer to change the prompt. You will see that the menuitem temporary losts its 2007 style:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oMenu, oTimer

    MENU oMenu 2007
        MENUITEM "Test"

        MENU
            MENUITEM "Test" CHECKED
        ENDMENU
    ENDMENU

    DEFINE WINDOW oWnd;
           MENU oMenu

    DEFINE TIMER oTimer OF oWnd;
           INTERVAL 3000;
           ACTION ( TONE( 440, 1 ), oMenu:aItems[ 1 ]:bAction:aItems[ 1 ]:SetPrompt( "Changed" ) )

    ACTIVATE TIMER oTimer

    ACTIVATE WINDOW oWnd

    RELEASE TIMER oTimer

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TMenu

Postby Enrico Maria Giordano » Sun Jan 10, 2010 11:16 am

Already fixed in the upcoming FWH release.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TMenu

Postby Antonio Linares » Sun Jan 10, 2010 1:48 pm

Enrico,

Thanks for the fix :-)

We appreciate if you post the fix here, so users can already apply it, thanks
regards, saludos

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

Re: Bug in TMenu

Postby Enrico Maria Giordano » Sun Jan 10, 2010 2:00 pm

Here it is:

Code: Select all  Expand view
#define MF_BYCOMMAND  0
#define MF_ENABLED    0
#define MF_UNCHECKED  0
#define MF_GRAYED     1
#define MF_DISABLED   2
#define MF_CHECKED    8
#define MF_POPUP     16   // 0x0010
#define MF_BREAK     64
#define MF_OWNERDRAW 256  // 0x0100
#define MF_HELP   16384   // 0x4000


Code: Select all  Expand view
METHOD SetPrompt( cPrompt ) CLASS TMenuItem

   local nNewId, nFlags

   ::cPrompt = cPrompt

   if ValType( ::bAction ) == "O" .and. ;
      Upper( ::bAction:ClassName() ) == "TMENU"
      nNewId := ::bAction:hMenu
      nFlags := MF_POPUP
   else
      nNewId := ::nId
      nFlags := nOR( If( ::lActive, MF_ENABLED,;
                nOR( MF_DISABLED, MF_GRAYED ) ),;
                If( ::lChecked, MF_CHECKED, 0 ),;
                If( ::lHelp, MF_HELP, 0 ),;
                If( ::lBreak, MF_BREAK, 0 ),;
                If( ::oMenu:l2007, MF_OWNERDRAW, 0 ) )
   endif

   if ::oMenu != nil
      ModifyMenu( ::oMenu:hMenu, ::nId, nFlags, nNewId, cPrompt )

      if ::oMenu:oWnd != nil
         DrawMenuBar( ::oMenu:oWnd:hWnd )
      endif
   endif

return nil


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in TMenu

Postby Antonio Linares » Sun Jan 10, 2010 11:18 pm

Enrico,

Many thanks :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 64 guests