<?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 overriding correctly GetDisplayName (OPM) ? in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364656#M13361</link>
    <description>&lt;P&gt;As far as I know, the only solution is to create a separate wrapper instance (I create one of the base class entity type), then call it's GetDisplayName member function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CComQIPtr&amp;lt;IOPMPropertyExtension&amp;gt; OPEHelper;
OPEHelper.CoCreateInstance( CLSID_AcadLine );

if (dispID &amp;gt;= 0x100 &amp;amp;&amp;amp; OPEHelper)
{
	hr = OPEHelper-&amp;gt;GetDisplayName(dispID, propName);
	if (SUCCEEDED(hr))
		return S_OK;
}
hr = __super::GetDisplayName(dispID, propName);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2013 13:44:24 GMT</pubDate>
    <dc:creator>owenwengerd</dc:creator>
    <dc:date>2013-08-13T13:44:24Z</dc:date>
    <item>
      <title>How overriding correctly GetDisplayName (OPM) ?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364310#M13360</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I implemented OPM wrapper for my custom entity and I overrided the method&amp;nbsp;&lt;STRONG&gt;GetDisplayName&lt;/STRONG&gt; to specify custom properties names and a custom display name like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;STDMETHODIMP CCustomWrapper::GetDisplayName(DISPID dispId, BSTR * propName)
{
	HRESULT hr = S_OK;

	switch(dispId)
	{	
	case DISPID_...:
		*propName = ::SysAllocString(_T("My property"));
		break;

	case DISPID_DISPLAYNAME:
		*propName = ::SysAllocString(_T("MyCustomEntity"));
		break;

	default:
		hr = IOPMPropertyExtensionImpl&amp;lt;CCustomWrapper&amp;gt;::GetDisplayName(dispId, propName);
		assert(hr == S_OK);
	}

	return hr;
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that the call to&amp;nbsp;&lt;STRONG&gt;IOPMPropertyExtensionImpl&amp;lt;CCustomWrapper&amp;gt;::GetDisplayName(dispId, propName);&lt;/STRONG&gt; always returns E_FAIL. The result is that the name of each common properties of AcDbEntities is not correct. See the images below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" src="https://forums.autodesk.com/t5/image/serverpage/image-id/58133iB60E9FD6B992A12A/image-size/original?v=mpbl-1&amp;amp;px=-1" title="opm_getdisplayname_normal.png" alt="opm_getdisplayname_normal.png" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG align="center" src="https://forums.autodesk.com/t5/image/serverpage/image-id/58134i639FAA9BE5797B2E/image-size/original?v=mpbl-1&amp;amp;px=-1" title="opm_getdisplayname_custom.png" alt="opm_getdisplayname_custom.png" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What did I do wrong? In the ObjectARX samples, no call to the parent&amp;nbsp;&lt;STRONG&gt;IOPMPropertyExtensionImpl&lt;/STRONG&gt;&amp;nbsp;is made...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 10:15:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364310#M13360</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2013-08-13T10:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How overriding correctly GetDisplayName (OPM) ?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364656#M13361</link>
      <description>&lt;P&gt;As far as I know, the only solution is to create a separate wrapper instance (I create one of the base class entity type), then call it's GetDisplayName member function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CComQIPtr&amp;lt;IOPMPropertyExtension&amp;gt; OPEHelper;
OPEHelper.CoCreateInstance( CLSID_AcadLine );

if (dispID &amp;gt;= 0x100 &amp;amp;&amp;amp; OPEHelper)
{
	hr = OPEHelper-&amp;gt;GetDisplayName(dispID, propName);
	if (SUCCEEDED(hr))
		return S_OK;
}
hr = __super::GetDisplayName(dispID, propName);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 13:44:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364656#M13361</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2013-08-13T13:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: How overriding correctly GetDisplayName (OPM) ?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364686#M13362</link>
      <description>&lt;P&gt;Hi Owen,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer. Your solution works.&lt;/P&gt;&lt;P&gt;Maybe there is a easier (lighter) solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jonathan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2013 13:59:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/4364686#M13362</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2013-08-13T13:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How overriding correctly GetDisplayName (OPM) ?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/12774452#M13363</link>
      <description>&lt;P class="lia-align-center"&gt;Could you share me your project example?&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 09:35:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/12774452#M13363</guid>
      <dc:creator>KIMHENGHOR98</dc:creator>
      <dc:date>2024-05-15T09:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: How overriding correctly GetDisplayName (OPM) ?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/12774462#M13364</link>
      <description>&lt;P&gt;I added a COM wrapper for my entity but getdisplayname() method never get called&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 09:40:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-overriding-correctly-getdisplayname-opm/m-p/12774462#M13364</guid>
      <dc:creator>KIMHENGHOR98</dc:creator>
      <dc:date>2024-05-15T09:40:09Z</dc:date>
    </item>
  </channel>
</rss>

