<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: query width and height of UI object box</title>
		<atom:link href="http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 23:16:24 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-48949</guid>
					<title><![CDATA[query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-48949</link>
					<pubDate>Sat, 06 Mar 2010 09:28:55 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>hi,<br />
after a longer break, i&#8217;m working on a UI external again, and my brain still seems to be a little rusty&#8230;<br />
while initializing the object variables in the new-routine, i need to query the width and height of the current objects box. therefore i guess i need a patcherview (in order to be able to call jbox_get_rect_for_view()).<br />
is it possible to get a patcherview at this stage of object instantiation (in the new-routine), or would i have to somehow get hold of the patcher_rect attribute from the inspector?<br />
thanks,<br />
v</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175826</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175826</link>
					<pubDate>Sat, 06 Mar 2010 17:08:46 +0000</pubDate>
					<dc:creator>Luigi Castelli</dc:creator>

					<description>
						<![CDATA[
						<p>Hi Volker,</p>
<p>you do not need a patcherview. You need a dictionary.<br />
You need to query the values you need from the dictionary that you create in the myobject_new routine. They are all there.</p>
<p>Look at the jslider example in the SDK and specifically at the jslider_stdargs() method to get a clue on where the values you need might be.</p>
<p>Hope this helps.<br />
Let me know if that solves your problem.</p>
<p>- Luigi</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175827</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175827</link>
					<pubDate>Sat, 06 Mar 2010 21:53:01 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>ciao luigi<br />
thanks for the hint. dictionary looks interesting, but somewhat complicated&#8230;<br />
from the api get the impression, i need something like dictionary_copyatoms, to get hold of the patcher_rect attributes.<br />
so i tried:</p>
<p>        t_atom **r = NULL;<br />
	long num = 4;<br />
	long k;<br />
	dictionary_copyatoms(d, gensym(&#8220;patching_rect&#8221;), &#038;num, r);<br />
	for(k=0; k&lt;4; k++)<br />
		post(&#8220;k: %ld &#8212; %f&#8221;, k, atom_getfloat((t_atom *)r+k));<br />
	if(r)<br />
		sysmem_freeptr(r);</p>
<p>which crashes&#8230;<br />
the atom_getfloat() call causes me trouble.<br />
is that going into the right direction at all?<br />
it&#8217;s not urgent, as i found a workaround for what i was trying to do, but comments on how to get values from the dictionary would still be welcome.<br />
thanks,<br />
volker.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175828</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175828</link>
					<pubDate>Sat, 06 Mar 2010 23:37:38 +0000</pubDate>
					<dc:creator>Luigi Castelli</dc:creator>

					<description>
						<![CDATA[
						<p>The only reason why you get a crash is because of some dereference confusion.<br />
Do the same but replace atom_getfloat((t_atom *)r+k) with atom_getfloat((*r)+k)</p>
<p>Other than that, you are definitely in the right direction&#8230;</p>
<p>You might also want to consider using dictionary_getatoms().<br />
This way you don&#8217;t need to allocate any memory.<br />
You just get a pointer to the patching rect which, in most cases, it&#8217;s all you need.</p>
<p>Ciao.</p>
<p>- Luigi</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175829</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175829</link>
					<pubDate>Mon, 08 Mar 2010 20:08:30 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>> Do the same but replace atom_getfloat((t_atom *)r+k) with atom_getfloat((*r)+k)</p>
<p>hm, i&#8217;ve tried that before, and it crashes here just the same.<br />
any more clues anyone?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175830</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175830</link>
					<pubDate>Tue, 09 Mar 2010 12:51:38 +0000</pubDate>
					<dc:creator>Timothy Place</dc:creator>

					<description>
						<![CDATA[
						<p>Do you know which line it crashes on?   The crash report probably tells you.</p>
<p>However, I can see a couple of suspicious things about your call to dictionary_copyatoms().</p>
<pre>t_atom *r = NULL;
long num = 0;
long k;

dictionary_copyatoms(d, gensym("patching_rect"), &#038;num, &#038;r);
for (k=0; k&lt;4; k++)
    post("k: %ld -- %f", k, atom_getfloat((*r)+k));
if (r)
    sysmem_freeptr(r);</pre><p>This is email-client coding, but notice that I pass a size (num) initialized to zero and also that for 'r' I am passing the address of a valid pointer (which is pointing to NULL).</p>
<p>Hope this helps</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175831</guid>
					<title><![CDATA[Re: query width and height of UI object box]]></title>
					<link>http://cycling74.com/forums/topic/query-width-and-height-of-ui-object-box/#post-175831</link>
					<pubDate>Tue, 09 Mar 2010 13:37:32 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>thanks, tim. your version won&#8217;t compile here, but it got me on the right track.<br />
i got a little confused by the pointer to point to t_atom thing from the dictionary_copyatoms() call, and wasn&#8217;t sure how to properly dereference it. but this, too, of course is only an address.<br />
so this works for me:</p>
<p><code><br />
t_atom *r = NULL;<br />
	long num = 0;<br />
	long k;</code></p>
<p>	dictionary_copyatoms(d, gensym("patching_rect"), &#038;num, &#038;r);<br />
	for (k=0; k&lt;4; k++)<br />
		post("k: %ld -- %f", k, atom_getfloat(r+k));<br />
	if (r)<br />
		sysmem_freeptr(r);<br /></p>
<p>dictionary seems to be quite powerful. i think a future version of the sdk would benefit from some more examples on how it can be used.<br />
thanks again,<br />
volker.</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

