<?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: (SDK) How can I get UI control associated with a param of a ParamBlock2? in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6663037#M13943</link>
    <description>&lt;P&gt;did a quick test with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BOOL CALLBACK EnumChildWindowProc(HWND hWnd, LPARAM lParam) 
{
	static TCHAR className[256];
	static TCHAR windowText[256];
	int bufSize = sizeof(TCHAR)*256;

	int res1 = GetClassName(hWnd, className, bufSize);
	int res2 = GetWindowText(hWnd, windowText, bufSize);

	mprintf("class = %s\n", className);
	mprintf("text = %s\n", windowText);
    return TRUE; 
}&lt;/PRE&gt;&lt;P&gt;called by this in a BeginEditParams() call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IParamMap2* map = params_pb-&amp;gt;GetMap();
if(map)
{
	IRollupWindow*  rollup = map-&amp;gt;GetIRollup();
	if(rollup)
	{
		for(int p = 0; p &amp;lt; rollup-&amp;gt;GetNumPanels(); ++p)
		{
			HWND panelHWnd = rollup-&amp;gt;GetPanelDlg(p);
			if(panelHWnd)
			{
				IRollupPanel* panel = rollup-&amp;gt;GetPanel(panelHWnd);
				if(!panel) continue;
				EnumChildWindows(panel-&amp;gt;GetPanelWnd(), EnumChildWindowProc, LPARAM(panel-&amp;gt;GetHInst()));
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;in your case your going to have to know when your ca is being edited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2016 17:21:10 GMT</pubDate>
    <dc:creator>klvnk</dc:creator>
    <dc:date>2016-11-02T17:21:10Z</dc:date>
    <item>
      <title>(SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6647702#M13938</link>
      <description>&lt;P&gt;The task should be easily solved by using&amp;nbsp;&lt;STRONG&gt;ParamDef&lt;/STRONG&gt;, where we can ask&amp;nbsp;&lt;STRONG&gt;ctrl_count&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;ctrl_IDs&lt;/STRONG&gt; properties. But for all parameters&amp;nbsp;&lt;STRONG&gt;ctrl_count &lt;/STRONG&gt;is 0.&lt;/P&gt;&lt;P&gt;Am I missing anything?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 18:47:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6647702#M13938</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2016-10-26T18:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: (SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6654865#M13939</link>
      <description>and what about all the other fields? are the returning useful information? is for instance "ctrl_IDs" a NULL pointer?</description>
      <pubDate>Sat, 29 Oct 2016 09:13:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6654865#M13939</guid>
      <dc:creator>istan</dc:creator>
      <dc:date>2016-10-29T09:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: (SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6658401#M13940</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just run the following in both the constructor (after the&amp;nbsp; MakeAutoParamBlocks() call) and in the BeginEditParams() functions&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;&lt;BR /&gt;ParamDef&amp;amp; def = params_pb-&amp;gt;GetParamDef(ksem_radius);
mprintf("%d\n", def.ctrl_count);
for(int i = 0;  i &amp;lt; def.ctrl_count; ++i)
	mprintf("%d\n", def.ctrl_IDs[i]);&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;gives the following (correct) result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2&lt;BR /&gt;1043&lt;BR /&gt;1044&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 19:50:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6658401#M13940</guid>
      <dc:creator>klvnk</dc:creator>
      <dc:date>2016-10-31T19:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: (SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6661057#M13941</link>
      <description>&lt;P&gt;ok...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to have this snippet works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/************ MXS **********/

ca = attributes ca
(
	parameters params rollout:params
	(
		count type:#integer ui:ui_count
		numbers type:#inttab tabsize:3 ui:(ui_number1, ui_number2, ui_number3)
	)
	rollout params ""
	(
		spinner ui_count "Count: " type:#integer 
		spinner ui_number1 "1: " type:#integer  
		spinner ui_number2 "2: " type:#integer  
		spinner ui_number3 "3: " type:#integer  
	)
)

/*
_a = createinstance ca
getPBlockParamControl _a
*/

/************ SDK **********/

def_visible_primitive(getPBlockParamControl, "getPBlockParamControl");
Value* getPBlockParamControl_cf(Value** arg_list, int count)
{
	check_arg_count(getPBlockParamControl, 1, count);
	ReferenceTarget *ref = arg_list[0]-&amp;gt;to_reftarg();
	if (!ref) return &amp;amp;undefined;
	for (int k=0; k &amp;lt; ref-&amp;gt;NumParamBlocks(); k++)
	{
		IParamBlock2* pb2 = ref-&amp;gt;GetParamBlock(k);
		ParamBlockDesc2* pdc = pb2-&amp;gt;GetDesc();
		for (int i = 0; i &amp;lt; pb2-&amp;gt;NumParams(); i++) 
		{
			ParamDef pdef = pdc-&amp;gt;paramdefs[i];
			mprintf(_M("%s &amp;gt;&amp;gt; %i\n"), pdef.int_name, pdef.ctrl_count);
		}
	}
	return &amp;amp;ok;
}

&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2016 21:39:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6661057#M13941</guid>
      <dc:creator>denisT.MaxDoctor</dc:creator>
      <dc:date>2016-11-01T21:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: (SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6661881#M13942</link>
      <description>&lt;P&gt;I doubt in that case they will ever have a resourse ID as such, the control would be created on the fly using something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", 
            WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 
            0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);&lt;/PRE&gt;&lt;P&gt;this i guess, it would have a valid HWND when it's been edited which you can test via&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="2"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;TABLE cellspacing="0" cellpadding="0" border="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;A href="https://forums.autodesk.com/t5/forums/replypage/board-id/area-b35/message-id/class_i_param_map2.html" target="_blank"&gt;IParamMap2&lt;/A&gt;* IParamBlock2::GetMap&lt;/TD&gt;&lt;TD&gt;(&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;A href="https://forums.autodesk.com/t5/forums/replypage/board-id/area-b35/message-id/iparamb2_8h.html#a62" target="_blank"&gt;MapID&lt;/A&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;EM&gt;map_id&lt;/EM&gt; = 0&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;)&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and from there the get the HWND, IRollupWIndow&amp;nbsp; etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then you would need to use &lt;A href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms633494(v=vs.85).aspx" target="_self"&gt;EnumChildWindows &lt;/A&gt;to iterate through the controls in the rollout&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 10:22:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6661881#M13942</guid>
      <dc:creator>klvnk</dc:creator>
      <dc:date>2016-11-02T10:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: (SDK) How can I get UI control associated with a param of a ParamBlock2?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6663037#M13943</link>
      <description>&lt;P&gt;did a quick test with this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;BOOL CALLBACK EnumChildWindowProc(HWND hWnd, LPARAM lParam) 
{
	static TCHAR className[256];
	static TCHAR windowText[256];
	int bufSize = sizeof(TCHAR)*256;

	int res1 = GetClassName(hWnd, className, bufSize);
	int res2 = GetWindowText(hWnd, windowText, bufSize);

	mprintf("class = %s\n", className);
	mprintf("text = %s\n", windowText);
    return TRUE; 
}&lt;/PRE&gt;&lt;P&gt;called by this in a BeginEditParams() call&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;IParamMap2* map = params_pb-&amp;gt;GetMap();
if(map)
{
	IRollupWindow*  rollup = map-&amp;gt;GetIRollup();
	if(rollup)
	{
		for(int p = 0; p &amp;lt; rollup-&amp;gt;GetNumPanels(); ++p)
		{
			HWND panelHWnd = rollup-&amp;gt;GetPanelDlg(p);
			if(panelHWnd)
			{
				IRollupPanel* panel = rollup-&amp;gt;GetPanel(panelHWnd);
				if(!panel) continue;
				EnumChildWindows(panel-&amp;gt;GetPanelWnd(), EnumChildWindowProc, LPARAM(panel-&amp;gt;GetHInst()));
			}
		}
	}
}&lt;/PRE&gt;&lt;P&gt;in your case your going to have to know when your ca is being edited.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 17:21:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/sdk-how-can-i-get-ui-control-associated-with-a-param-of-a/m-p/6663037#M13943</guid>
      <dc:creator>klvnk</dc:creator>
      <dc:date>2016-11-02T17:21:10Z</dc:date>
    </item>
  </channel>
</rss>

