<?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: User control UC257 in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295224#M4888</link>
    <description>Actually It is wrong to mix C++ DG classes and plain C DG module functions.&lt;BR /&gt;
&lt;BR /&gt;
Below is cutted source code of UC257 usage as a Pen control.&lt;BR /&gt;
Note the ACAPI_Interface ( APIIo_SetUserControlCallbackID ) function, API_UCCallbackType struct, API_UserControlType enum. It is for AC standard lists like Pen, LineType etc. Full &lt;BR /&gt;
&lt;BR /&gt;
More:&lt;BR /&gt;
Look the DG_Test example of AC19 API&lt;BR /&gt;
BuildingMaterialObserver class in BuildingMaterialDialog.hpp and cpp.&lt;BR /&gt;
I dont study this example but I think it will basically same in more details.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;...
#include "UCModule.hpp"
...

class TabWallAttrs 
	: public DG::TabPage 
	, private DG::UserControlObserver
{
public:

...

private:

	virtual void	UserControlChanged (const DG::UserControlChangeEvent&amp;amp; ev);

private:

	UC::UC257		mi_pcont;
};

&lt;/PRE&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;TabWallAttrs::TabWallAttrs( ... )
	, mi_pconte( GetReference(), PCONTE )
{
	mi_pcont.Attach( *this );

	API_UCCallbackType ct = { APIUserControlType_Pen, GetId(), mi_pcont.GetId() };
	ACAPI_Interface ( APIIo_SetUserControlCallbackID, &amp;amp;ct, NULL );
}

TabWallAttrs::~TabWallAttrs()
{
	mi_pcont.Detach( *this );
}

void TabWallAttrs::UserControlChanged (const DG::UserControlChangeEvent&amp;amp; ev)
{
	if ( ev.GetSource() == &amp;amp;mi_pcont )
	{
	//	mi_pcont.GetValue()
	}
}

&lt;/PRE&gt;</description>
    <pubDate>Wed, 09 Sep 2015 17:02:16 GMT</pubDate>
    <dc:creator>Oleg</dc:creator>
    <dc:date>2015-09-09T17:02:16Z</dc:date>
    <item>
      <title>User control UC257</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295223#M4887</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello! &lt;BR /&gt;&lt;BR /&gt;
&lt;PRE&gt;   
DGModalDialog (ACAPI_GetOwnResModule (), UserControl, ACAPI_GetOwnResModule (), UserControl_Handler, (DGUserData) &amp;amp;numItems);&lt;/PRE&gt;
&lt;BR /&gt;When UserControl is initialized like this it works. &lt;BR /&gt;But i need to initialize it into my Modal dialog.
&lt;PRE&gt;DG::ModalDialog (ACAPI_GetOwnResModule (), dialogResId, ACAPI_GetOwnResModule()),&lt;/PRE&gt;
&lt;BR /&gt;But when opening userControl data menu data doesn't apear. &lt;BR /&gt;&lt;BR /&gt;I tried to do like this :
&lt;PRE&gt;UC257SetUserData (dialogID, Itm, (DGUserData)&amp;amp;numItems);   
			UC257SetCallBack (dialogID, Itm, UserControlCallBack);   
			DGSetItemValLong (dialogID, Itm, 1);&lt;/PRE&gt;
&lt;BR /&gt;CallBack seems to work, when i try to open menu it initializes but somewhere in middle of setting data it doesn't work. &lt;BR /&gt;&lt;BR /&gt;Problem might be somewhere in callBack. Not sure why it worked in DGModalDialog and not in DG::ModalDialog. &lt;BR /&gt;&lt;BR /&gt;CallBack:
&lt;PRE&gt;   
void CCALL	UserControlCallBack (UC257CallBackRec* callBackRec)   
{   
	if (callBackRec-&amp;gt;action == ACT_GETLISTSIZE || callBackRec-&amp;gt;action == ACT_GETITEMSIZE)   
		FillGetListSize (callBackRec, false);   
	else if (callBackRec-&amp;gt;action == ACT_GETLIST || callBackRec-&amp;gt;action == ACT_GETITEM)   
		FillGetList (callBackRec, false);   
	   
	   
	return;   
}   
&lt;/PRE&gt;
&lt;BR /&gt;&lt;BR /&gt;callBackRec is giving errors not sure why and how does it works&lt;/DIV&gt;</description>
      <pubDate>Thu, 13 Jul 2023 13:26:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295223#M4887</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-13T13:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: User control UC257</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295224#M4888</link>
      <description>Actually It is wrong to mix C++ DG classes and plain C DG module functions.&lt;BR /&gt;
&lt;BR /&gt;
Below is cutted source code of UC257 usage as a Pen control.&lt;BR /&gt;
Note the ACAPI_Interface ( APIIo_SetUserControlCallbackID ) function, API_UCCallbackType struct, API_UserControlType enum. It is for AC standard lists like Pen, LineType etc. Full &lt;BR /&gt;
&lt;BR /&gt;
More:&lt;BR /&gt;
Look the DG_Test example of AC19 API&lt;BR /&gt;
BuildingMaterialObserver class in BuildingMaterialDialog.hpp and cpp.&lt;BR /&gt;
I dont study this example but I think it will basically same in more details.&lt;BR /&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;...
#include "UCModule.hpp"
...

class TabWallAttrs 
	: public DG::TabPage 
	, private DG::UserControlObserver
{
public:

...

private:

	virtual void	UserControlChanged (const DG::UserControlChangeEvent&amp;amp; ev);

private:

	UC::UC257		mi_pcont;
};

&lt;/PRE&gt;

&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;TabWallAttrs::TabWallAttrs( ... )
	, mi_pconte( GetReference(), PCONTE )
{
	mi_pcont.Attach( *this );

	API_UCCallbackType ct = { APIUserControlType_Pen, GetId(), mi_pcont.GetId() };
	ACAPI_Interface ( APIIo_SetUserControlCallbackID, &amp;amp;ct, NULL );
}

TabWallAttrs::~TabWallAttrs()
{
	mi_pcont.Detach( *this );
}

void TabWallAttrs::UserControlChanged (const DG::UserControlChangeEvent&amp;amp; ev)
{
	if ( ev.GetSource() == &amp;amp;mi_pcont )
	{
	//	mi_pcont.GetValue()
	}
}

&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Sep 2015 17:02:16 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295224#M4888</guid>
      <dc:creator>Oleg</dc:creator>
      <dc:date>2015-09-09T17:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: User control UC257</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295225#M4889</link>
      <description>Thanks Oleg! &lt;BR /&gt;
 &lt;BR /&gt;
Had defined UserControl under DG::UserControl class but UC::UC257 gives a lot more options. &lt;BR /&gt;
 &lt;BR /&gt;
Got it working now.</description>
      <pubDate>Thu, 10 Sep 2015 12:29:44 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295225#M4889</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-10T12:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: User control UC257</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295226#M4890</link>
      <description>Couldn't found a way to show only specific colors/index, access data of UC257.  &lt;BR /&gt;
How could i access and show only specific colors ?&lt;BR /&gt;

&lt;BLOCKQUOTE&gt;&lt;PRE&gt; mi_pcont.Attach( *this ); 

   API_UCCallbackType ct = { APIUserControlType_Pen, GetId(), mi_pcont.GetId() }; 
   ACAPI_Interface ( APIIo_SetUserControlCallbackID, &amp;amp;ct, NULL ); &lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 14 Sep 2015 13:23:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/User-control-UC257/m-p/295226#M4890</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-14T13:23:35Z</dc:date>
    </item>
  </channel>
</rss>

