<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Add context menu to a DG control? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Add-context-menu-to-a-DG-control/m-p/80061#M7434</link>
    <description>I found it:&lt;BR /&gt;

&lt;PRE&gt;void AddMenuItem (DG::Menu&amp;amp; 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&amp;amp; 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&amp;amp; commandEvent = *DG::ContextMenu ("", menu).Display (ev.GetPosition ());
	if (&amp;amp;commandEvent != 0)
	{
		std::stringstream stream;
		stream &amp;lt;&amp;lt; "Clicked ";
		stream &amp;lt;&amp;lt; commandEvent.GetCommand ().GetCommandId ();
		DGAlert (DG_INFORMATION, "Apple", stream.str ().c_str (), NULL, "OK", NULL, NULL);
	}
}&lt;/PRE&gt;

My problem now is when to call the destructors.</description>
    <pubDate>Tue, 26 Jun 2007 15:48:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2007-06-26T15:48:23Z</dc:date>
    <item>
      <title>Add context menu to a DG control?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Add-context-menu-to-a-DG-control/m-p/80060#M7433</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;How can I add a context menu to a DG control, to a LeftText for example?&lt;/DIV&gt;</description>
      <pubDate>Mon, 07 Aug 2023 08:34:26 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Add-context-menu-to-a-DG-control/m-p/80060#M7433</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-07T08:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add context menu to a DG control?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Add-context-menu-to-a-DG-control/m-p/80061#M7434</link>
      <description>I found it:&lt;BR /&gt;

&lt;PRE&gt;void AddMenuItem (DG::Menu&amp;amp; 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&amp;amp; 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&amp;amp; commandEvent = *DG::ContextMenu ("", menu).Display (ev.GetPosition ());
	if (&amp;amp;commandEvent != 0)
	{
		std::stringstream stream;
		stream &amp;lt;&amp;lt; "Clicked ";
		stream &amp;lt;&amp;lt; commandEvent.GetCommand ().GetCommandId ();
		DGAlert (DG_INFORMATION, "Apple", stream.str ().c_str (), NULL, "OK", NULL, NULL);
	}
}&lt;/PRE&gt;

My problem now is when to call the destructors.</description>
      <pubDate>Tue, 26 Jun 2007 15:48:23 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Add-context-menu-to-a-DG-control/m-p/80061#M7434</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2007-06-26T15:48:23Z</dc:date>
    </item>
  </channel>
</rss>

