[javascript-dev] Re: Re: javascript + Pattr question - storing multiple values of mixed types (string/float)
vade
doktorp at mac.com
Fri Dec 7 13:54:57 MST 2007
- Previous message: [javascript-dev] Re: javascript + Pattr question - storing multiple values of mixed types (string/float)
- Next message: [javascript-dev] Re: Re: javascript + Pattr question - storing multiple values of mixed types (string/float)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Emmanuel - thanks for taking the time to look at that
however, there seems to be an issue with your code (the same issue as mine) Here is a modified version of your code:
var currentPattr = new Array();
var mode = "float"
var minval = 0.0;
var maxval = 10.0;
var currentval = 0.0;
var currenttitle = "SOMETITLE";
var listsize = "10";
var listmode = "int";
function pattrUpdate()
{
// set our array to current global state - have to use an array for
currentPattr[0] = mode;
currentPattr[1] = minval;
currentPattr[2] = maxval;
currentPattr[3] = currentval;
currentPattr[4] = currenttitle;
currentPattr[5] = listsize;
currentPattr[6] = listmode;
}
pattrUpdate.local = 1;
function getvalueof()
{
post("storing pattr state");
post();
pattrUpdate(); // update the states
return currentPattr; // our aggregate array of pattr variables
}
function setvalueof(v)
{
post("recalling pattr state");
post();
// set our values
mode = v[0];
minval = v[1];
maxval = v[2];
currentval = v[3];
currenttitle = v[4];
listsize = v[5];
listmode = v[6];
// menuitems = v[7];
//resize();
debug();
}
// debug
function debug()
{
post("mode = " + mode);
post();
post("min = " + minval);
post(" max = " + maxval);
post();
}
// just to test:
function setmode(s)
{
mode = s; // store your new mode
notifyclients(); // update the pattr values
}
running that code code:
step one:
send message "setmode list" to our js
send message "store 1" to our pattrstorage
note that the clientwindow for pattrstorage properly shows "list" in the data window along side our other data we specified as default in the code
send message "setmode int" to our js
send message "store 2" to store this second set of data. Both client and storage window reflect these settings.
Now recall setting 1.
Note that debug now outputs :
recalling pattr state
mode = l
min = i max = s
storing pattr state
- Previous message: [javascript-dev] Re: javascript + Pattr question - storing multiple values of mixed types (string/float)
- Next message: [javascript-dev] Re: Re: javascript + Pattr question - storing multiple values of mixed types (string/float)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
