Board index » cppbuilder » Creating TMenuItems... or not

Creating TMenuItems... or not

The following line of code is taken directly out of the Help file. BUT
will not compile.

Can anybody tell me what the correct syntax is please.

TMenuItem *NewItem = new TMenuItem; // create the separator

The compiler error is:
[C++ Error] MainDXN.cpp(71): E2285 Could not find a match for
'TMenuItem::TMenuItem()'

(Reposted from language newsgroup on advice)

Geoff Marshall

 

Re:Creating TMenuItems... or not


Did you specify which menu item it belongs to?  I've used that line of code,
but with a parameter

    TMenuItem  *NewItem = new TMenuItem(FileMenu);

Have you tried this?  I guess you could say I specified the "owner" of the
NewItem

Good Luck
Weisen

Re:Creating TMenuItems... or not


Thanks Weisen,

I had tried somthing of the sort but entered the form where you used the
FileMenu.  As soon as I changed to your format it worked perfectly.

Thanks again,
Geoff Marshall

Other Threads