<?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: How to create dialog or menu like attached picture after right click event? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/393774#M1006</link>
    <description>&lt;P&gt;this one seems to be helpful:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.graphisoft.com/t5/Developer-forum/How-to-add-custom-Context-menu-to-treview-in-the-Dialog/m-p/166096" target="_blank"&gt;https://community.graphisoft.com/t5/Developer-forum/How-to-add-custom-Context-menu-to-treview-in-the-Dialog/m-p/166096&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jul 2023 11:53:05 GMT</pubDate>
    <dc:creator>Joel Buehler</dc:creator>
    <dc:date>2023-07-29T11:53:05Z</dc:date>
    <item>
      <title>How to create dialog or menu like attached picture after right click event?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/393494#M1005</link>
      <description>&lt;P&gt;As shown in picture, is there any suggestion of how to detect right click event then create select able menu with API functions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="http://community.graphisoft.com/t5/image/serverpage/image-id/56826iF0A53A10601D34B3/image-size/large?v=v2&amp;amp;px=999" border="0" alt="Screenshot 2023-07-26 214805.png" title="Screenshot 2023-07-26 214805.png" /&gt;</description>
      <pubDate>Wed, 26 Jul 2023 14:53:14 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/393494#M1005</guid>
      <dc:creator>Newbie</dc:creator>
      <dc:date>2023-07-26T14:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dialog or menu like attached picture after right click event?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/393774#M1006</link>
      <description>&lt;P&gt;this one seems to be helpful:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.graphisoft.com/t5/Developer-forum/How-to-add-custom-Context-menu-to-treview-in-the-Dialog/m-p/166096" target="_blank"&gt;https://community.graphisoft.com/t5/Developer-forum/How-to-add-custom-Context-menu-to-treview-in-the-Dialog/m-p/166096&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jul 2023 11:53:05 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/393774#M1006</guid>
      <dc:creator>Joel Buehler</dc:creator>
      <dc:date>2023-07-29T11:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create dialog or menu like attached picture after right click event?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/394549#M1007</link>
      <description>&lt;P&gt;You can detect right mouse click by implementing/overriding the&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;virtual void ListBoxContextMenuRequested (const ListBoxContextMenuEvent&amp;amp; ev, bool* processed);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;virtual function of the ListboxObserver.&lt;/P&gt;
&lt;P&gt;And you can create a custom context menu like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;void OpenContextMenu (const DG::NativePoint&amp;amp; pos)
{
	const ULong CmdId1 = 1001;
	const ULong CmdId2 = 1002;
	const ULong CmdId3 = 1003;

	DG::Command cmd1 (CmdId1, 0, 0);
	DG::Command cmd2 (CmdId2, 0, 0);
	DG::Command cmd3 (CmdId3, 0, 0);
	DG::CommandDescriptor cmddesc1(cmd1, GS::UniString ("Command 1"));
	DG::CommandDescriptor cmddesc2(cmd2, GS::UniString ("Command 2"));
	DG::CommandDescriptor cmddesc3(cmd3, GS::UniString ("Command 3"));

	GS::UniString menuNameStr ("ContextMenu");
	DG::Menu* menu = new DG::Menu (menuNameStr);
	if (menu == nullptr)
		return;

	menu-&amp;gt;AddMenuItem (DG::MenuSimpleItem (CmdId1));
	menu-&amp;gt;AddMenuItem (DG::MenuSimpleItem (CmdId2));
	menu-&amp;gt;AddMenuItem (DG::MenuSimpleItem (CmdId3));
	DG::ContextMenu* contextMenu = new DG::ContextMenu (menuNameStr, menuNameStr, menu);
	if (contextMenu == nullptr) {
		delete menu;
		return;
	}

	DG::CommandTable enabledCommands;
	enabledCommands.Put (CmdId1, &amp;amp;cmddesc1);
	enabledCommands.Put (CmdId2, &amp;amp;cmddesc2);
	enabledCommands.Put (CmdId3, &amp;amp;cmddesc3);
	contextMenu-&amp;gt;SetEnabledCommands (enabledCommands);

	Int32 commandId = 0;
	DG::CommandEvent* commandEvent = contextMenu-&amp;gt;Display (pos);
	if (commandEvent != nullptr)
		commandId = commandEvent-&amp;gt;GetCommand ().GetCommandId ();

	delete commandEvent;
	delete contextMenu;
	delete menu;

	switch (commandId) {
		case CmdId1:
		case CmdId2:
		case CmdId3:
			break;

		default:
			break;
	}
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or you can also create a popup-like dialog with a listbox or any other controls inside. The popup like dialog is closed on a mouseclick outside of the dialog area. You can set the popup-like style with the DG::Dialog::SetPopupStyle() member function. Popup dialogs must not have caption and sizeable flag. See the following example:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;'GDLG'   SAMPLE_POPUP_DLG_ID  Modal | noFrame | noCaption | noGrow  0    0  100  100  "" {
/* [  1] */ LeftText			    5    5  90   23	SmallPlain  vCenter  "Text"
}

'DLGH'   SAMPLE_POPUP_DLG_ID  DLG_SAMPLE_POPUP {
1	""	LeftText_0
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;class SamplePopupDialog: public DG::ModalDialog,
						 public DG::PanelObserver
{
	enum {
		LeftTextId	= 1
	};

	DG::LeftText text;
	const DG::NativeRect&amp;amp; openButtonScreenRect;

public:
	SamplePopupDialog(const DG::NativeRect&amp;amp; openButtonScreenRect_);
	~SamplePopupDialog();

	virtual void	PanelOpened (const DG::PanelOpenEvent&amp;amp; ev) override;
};


SamplePopupDialog::SamplePopupDialog (const DG::NativeRect&amp;amp; dialogOpeningButtonScreenRect_, ...):
	DG::ModalDialog	(resModule, SAMPLE_POPUP_DLG_ID, resModule),
	text (GetReference (), LeftTextId),
	dialogOpeningButtonScreenRect (dialogOpeningButtonScreenRect_)
{
	SetPopupStyle ();
	Attach (*this);
}


SamplePopupDialog::~SamplePopupDialog ()
{
	Detach (*this);
}


void	SamplePopupDialog::PanelOpened (const DG::PanelOpenEvent&amp;amp; /*ev*/)
{
	DG::Utils::PlaceDialogNextToNativeRect (*this, dialogOpeningButtonScreenRect, DG::Utils::RightCenter);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 07:01:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-create-dialog-or-menu-like-attached-picture-after-right/m-p/394549#M1007</guid>
      <dc:creator>Miklos Vegh</dc:creator>
      <dc:date>2023-08-09T07:01:31Z</dc:date>
    </item>
  </channel>
</rss>

