<?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: pattrstorage and getvalueof(), how does it work?</title>
		<atom:link href="http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/feed</link>
		<description></description>
		<pubDate>Thu, 20 Jun 2013 04:11:47 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-30096</guid>
					<title><![CDATA[pattrstorage and getvalueof(), how does it work?]]></title>
					<link>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-30096</link>
					<pubDate>Sat, 03 Feb 2007 11:52:55 +0000</pubDate>
					<dc:creator>Mattijs</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>From what I read in the docs, I believe it is possible to store and recall a value of a js with pattrstorage by defining a getvalueof and setvalueof function. Is that correct?</p>
<p>I&#8217;ve been trying, but with no succes. Store and recall don&#8217;t work, I don&#8217;t see any reference in the clientwindow, and the saved xml file is empty.</p>
<p>If anyone has a hint how to do this, I would be very grateful.</p>
<p>Mattijs</p>
<p>
I use the following patch and script to test:</p>
<p>&#8212;&#8212;&#8211; save as pattrbindtest.js:</p>
<p>autowatch = 1;</p>
<p>var myvalue = 0.25;</p>
<p>function getvalueof()<br />
{<br />
	return myvalue;<br />
}</p>
<p>function setvalueof(v)<br />
{<br />
	myvalue = v;<br />
	notifyclients();<br />
}</p>
<p>function msg_int(v)<br />
{<br />
	myvalue = v;<br />
}</p>
<p>function bang()<br />
{<br />
	post(&#8220;myvalue: &#8221; + myvalue);<br />
	post();<br />
}</p>
<p>function printThis()<br />
{<br />
	for (var property in this)<br />
	{<br />
		post(property)<br />
		post();<br />
	}<br />
}</p>
<p>
&#8212;&#8212;&#8211; patch:</p>
<p>#P number 39 128 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P window linecount 1;<br />
#P message 62 32 14 9109513 1;<br />
#P message 22 32 37 9109513 store 1;<br />
#P message 62 51 14 9109513 2;<br />
#P message 22 51 37 9109513 store 2;<br />
#P message 104 148 51 9109513 printThis;<br />
#P newex 22 87 58 9109513 pattrstorage;<br />
#X client_rect 15 55 655 295;<br />
#X storage_rect 0 0 640 240;<br />
#P objectname u811000042;<br />
#P button 22 128 15 0;<br />
#P newex 22 148 80 9109513 js pattrbindtest.js;<br />
#P objectname js;<br />
#P connect 4 0 2 0;<br />
#P connect 5 0 2 0;<br />
#P connect 6 0 2 0;<br />
#P connect 7 0 2 0;<br />
#P connect 8 0 0 0;<br />
#P connect 3 0 0 0;<br />
#P connect 1 0 0 0;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95472</guid>
					<title><![CDATA[Re: pattrstorage and getvalueof(), how does it work?]]></title>
					<link>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95472</link>
					<pubDate>Sun, 04 Feb 2007 12:14:45 +0000</pubDate>
					<dc:creator>volker böhm</dc:creator>

					<description>
						<![CDATA[
						<p>
On 03 Feb 2007, at 12:52, Mattijs Kneppers wrote:<br />
><br />
>>> From what I read in the docs, I believe it is possible to store  <br />
>>> and recall a value of a js with pattrstorage by defining a  <br />
>>> getvalueof and setvalueof function. Is that correct?<br />
><br />
> I&#8217;ve been trying, but with no succes. Store and recall don&#8217;t work,  <br />
> I don&#8217;t see any reference in the clientwindow, and the saved xml  <br />
> file is empty.</p>
<p>my understanding is, that you have to add a pattr object to your  <br />
patch and connect/bindto the js object.<br />
also i would suggest to move the notifyclients() message from the  <br />
setvalue() function to your msg_int() function, as to &#8220;notify&#8221; pattr,  <br />
that myvalue has changed:</p>
<p>function msg_int(v) {<br />
	myvalue = v;<br />
	notifyclients();<br />
}</p>
<p>
hope that helps<br />
- volker.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95473</guid>
					<title><![CDATA[Re: pattrstorage and getvalueof(), how does it work?]]></title>
					<link>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95473</link>
					<pubDate>Sun, 04 Feb 2007 16:31:45 +0000</pubDate>
					<dc:creator>Mattijs</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95474</guid>
					<title><![CDATA[Re: pattrstorage and getvalueof(), how does it work?]]></title>
					<link>http://cycling74.com/forums/topic/pattrstorage-and-getvalueof-how-does-it-work/#post-95474</link>
					<pubDate>Sun, 04 Feb 2007 16:36:17 +0000</pubDate>
					<dc:creator>Mattijs</dc:creator>

					<description>
						<![CDATA[
						<p></p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

