We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2007-06-22 03:53 PM - last edited on 2023-08-07 10:34 AM by Doreena Deng
2007-06-26 05:48 PM
void AddMenuItem (DG::Menu& menu, int id, std::string text) { DG::CommandDescriptor* commandDescriptor = new DG::CommandDescriptor (DG::Command (id), text.c_str ()); menu.AddMenuItem (DG::MenuSimpleItem (commandDescriptor)); } void MyPalette::ItemContextMenuRequested ( const DG::ItemContextMenuEvent& ev, bool* needHelp, bool* processed) { *processed = true; DG::Menu* menu = new DG::Menu (""); AddMenuItem (*menu, 1, "Apple"); AddMenuItem (*menu, 2, "Pear"); AddMenuItem (*menu, 3, "Dog"); DG::CommandEvent& commandEvent = *DG::ContextMenu ("", menu).Display (ev.GetPosition ()); if (&commandEvent != 0) { std::stringstream stream; stream << "Clicked "; stream << commandEvent.GetCommand ().GetCommandId (); DGAlert (DG_INFORMATION, "Apple", stream.str ().c_str (), NULL, "OK", NULL, NULL); } }My problem now is when to call the destructors.