Page 1 of 1

TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 11:16 am
by AntoninoP
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?

Re: TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 12:20 pm
by cnavarro
Antonino, I do not understand what you mean
Can you explain your question better?

Re: TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 1:30 pm
by AntoninoP
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.

Re: TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 1:46 pm
by cnavarro
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.

Re: TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 1:55 pm
by AntoninoP
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.

Re: TMenuItem():New changed

PostPosted: Tue Feb 13, 2018 2:01 pm
by cnavarro
Function MenuData in PDMENU.PRG, create menu and items for one database
Maybe the code of that function could help you