TMenuItem():New changed

TMenuItem():New changed

Postby AntoninoP » Tue Feb 13, 2018 11:16 am

Hello,
comparing FWH 15.03 and FWH 17.11 I see that TMenuItem():New has a lot of changes...
The result is that we have a lots of items around the main menu instead of in its menu...
I think the guilty is:
Code: Select all  Expand view
::oMenu := LastMenu()

inside tMenuItem:New

That change the behaviour of TMenu:Add in these lines:
Code: Select all  Expand view
if Empty( oMenuItem:oMenu )
   oMenuItem:oMenu  := Self
endif


Anybody remember these changes?
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: TMenuItem():New changed

Postby cnavarro » Tue Feb 13, 2018 12:20 pm

Antonino, I do not understand what you mean
Can you explain your question better?
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TMenuItem():New changed

Postby AntoninoP » Tue Feb 13, 2018 1:30 pm

in FWH 15.07 the new is this:
Code: Select all  Expand view
METHOD New( cPrompt, cMsg, lChecked, lActive, bAction, cBmpFile, cResName,;
            nVKState, nVirtKey, lHelp, nHelpId, bWhen, lBreak ) CLASS TMenuItem

   DEFAULT lChecked := .f., lActive := .t., cBmpFile := "",;
           lHelp := .f., lBreak := .f.

   ::bAction  = bAction
   ::cPrompt  = cPrompt
   ::cMsg     = cMsg
   ::lChecked = lChecked
   ::lActive  = lActive
   ::lHelp    = lHelp
   ::lBreak   = lBreak
   ::hBitmap  = 0
   ::nHelpId  = nHelpId
   ::bWhen    = bWhen

   while IsMenu( ::nInitId )   // A popup could already own the ID !!!
      ::nInitId++
   end
   ::nId = ::nInitId++

   ::cVarName = "oMItem" + AllTrim( Str( ::nId ) )

   if ! Empty( cBmpFile ) .and. File( cBmpFile )
      ::hBitmap = ReadBitmap( 0, cBmpFile )
   endif
   if ! Empty( cResName )
      ::hBitmap = LoadBitmap( GetResources(), cResName )
   endif

   if nVirtKey != nil
      ::nVKState = nVKState
      ::nVirtKey = nVirtKey
   endif

return Self


now it is bigger, anybody know why? I searching in the forum and I don't found the thread about the modifications...

After these modifications in our enormous program we see menuitem create without the macro in wrong position, then my question is asked because the increment of complexity of the method drove the program to unexpected behaviours.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: TMenuItem():New changed

Postby cnavarro » Tue Feb 13, 2018 1:46 pm

Antonino
This is actual definition of command MENUITEM


#xcommand MENUITEM [ <oMenuItem> PROMPT ] [<cPrompt>] ;
[ MESSAGE <cMsg> ] ;
[ <checked: CHECK, CHECKED, MARK> ] ;
[ <enable: ENABLED, DISABLED> ] ;
[ <file: FILE, FILENAME, DISK> <cBmpFile> ] ;
[ <resource: RESOURCE, RESNAME, NAME> <cResName> ] ;
[ ACTION <uAction,...> ] ;
[ BLOCK <bAction> ] ;
[ <of: OF, MENU, SYSMENU> <oMenu> ] ;
[ ACCELERATOR <nState>, <nVirtKey> ] ;
[ <help: HELP> ] ;
[ <HelpId: HELP ID, HELPID> <nHelpId> ] ;
[ WHEN <uWhen> ] ;
[ <lDegrade: DEGRADE> ] ;
[ <break: BREAK> ] ;
[ FONT <oFont> ] ;
[ COLORMENU [ <nClrMenu>, ] <nClrMenutxt> ] ;
[ <left: COLORBMP, COLORLEFT, LEFTCOLOR> <nClrToBa> [, <nClrBkBa>] ] ;
[ <right: COLORPNEL, COLORRIGHT, RIGHTCOLOR> <nClrToBr> [, <nClrBkBr> ] ] ;
[ COLORSELECT <nClrHiLi>, <nClrHiLf>[, <nClrHitx>] ] ;
[ COLORSEPARATOR <nClrHiBr> ] ;
[ <lVert: LINESVERT> ] ;
[ <lColors: COLORS> ] ;
[ CHARICON <cCharBmp> ] ;
[ HSYSBITMAP <hBmp> ] ;
[ INDEX <nIndex> ] ;
[ <lRight: RIGHT> ] ;
[ <lSeparator: SEPARATOR> ] ;
[ <lBold: BOLD> ];
[ <lItalic: ITALIC> ];
[ COLORBOX <nClrBox> ] ;
[ RADIOCHECK <nItemsGroup>, <nCheck> ] ;
[ <lDefault: ITEMDEFAULT> ] ;
[ <lLeft: LEFT> ] ;
[ <lControl: CONTROL> ] ;


This is command MENUITEM of Fivewin 15.03

#xcommand MENUITEM [ <oMenuItem> PROMPT ] [<cPrompt>] ;
[ MESSAGE <cMsg> ] ;
[ <checked: CHECK, CHECKED, MARK> ] ;
[ <enable: ENABLED, DISABLED> ] ;
[ <file: FILE, FILENAME, DISK> <cBmpFile> ] ;
[ <resource: RESOURCE, RESNAME, NAME> <cResName> ] ;
[ ACTION <uAction,...> ] ;
[ BLOCK <bAction> ] ;
[ <of: OF, MENU, SYSMENU> <oMenu> ] ;
[ ACCELERATOR <nState>, <nVirtKey> ] ;
[ <help: HELP> ] ;
[ <HelpId: HELP ID, HELPID> <nHelpId> ] ;
[ WHEN <uWhen> ] ;
[ <break: BREAK> ] ;


There have been many implementations since then with new features
All these new properties have been documented in the Whatsnew.txt documents of each new version.
In addition, I have documented all the properties of the menus and menuitems in the fivewin wiki where you can find all the information about it

http://wiki.fivetechsoft.com/doku.php?i ... ldown_menu

If you have a problem with your program, tell me how I can help you, either here in the forum or directly to my email.
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: TMenuItem():New changed

Postby AntoninoP » Tue Feb 13, 2018 1:55 pm

I changed the code that mixex items created with macro and items created without... now look stable..
I will write if the error appears again.
AntoninoP
 
Posts: 375
Joined: Tue Feb 10, 2015 9:48 am
Location: Albenga, Italy

Re: TMenuItem():New changed

Postby cnavarro » Tue Feb 13, 2018 2:01 pm

Function MenuData in PDMENU.PRG, create menu and items for one database
Maybe the code of that function could help you
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 104 guests