Hmmm, right now it just adds it to the current page. If you need to add it to a particular page, you can call "/control/addWidget yourJSON pageNumber" if you paste the following code in your interface file...
Control.prototype.addWidget = function(widget, page) {
this.pages[page].push(widget);
if(page == control.currentPage) {
if(widget.show != null)
widget.show();
if(widget.draw != null)
widget.draw();
}else{
if(widget.hide != null)
widget.hide();
}
eval(widget.oninit);
}
and
OSCManager.prototype.processOSCMessage = function() {
var address = arguments[0];
var typetags = arguments[1];
var args = [];
console.log(address + "::"+typetags+"::"+arguments[2]);
switch(address){
case "/control/runScript":
eval(arguments[2]);
return;
break;
case "/control/addWidget":
eval("var w = " + arguments[2]);
var _w = control.makeWidget(w);
control.widgets.push(_w);
eval("control.addWidget(" + w.name + ", " + arguments[3] + ");");
return;
break;
case "/control/removeWidget":
control.removeWidgetWithName(arguments[2]);
return;
break;
case "/control/setBounds":
var w = control.getWidgetWithName(arguments[2]);
w.setBounds([arguments[3], arguments[4], arguments[5], arguments[6]]);
return;
break;
case "/control/setColors":
var w = control.getWidgetWithName(arguments[2]);
w.setColors([arguments[3], arguments[4], arguments[5]]);
return;
break;
case "/control/setRange":
var w = control.getWidgetWithName(arguments[2]);
w.setRange(arguments[3], arguments[4]);
return;
break;
case "/control/setAddress":
var w = control.getWidgetWithName(arguments[2]);
w.address = arguments[3];
return;
break;
case "/control/createBlankInterface":
control.unloadWidgets();
var _json = "loadedInterfaceName = '" + arguments[2] + "'; interfaceOrientation = '" + arguments[3] + "'; pages = [["
if(typeof arguments[4] == "undefined" || arguments[4] == "true") {
_json += '{\
"name": "menuButton",\
"type": "Button",\
"bounds": [.8,.8,.2,.1],\
"mode":"toggle",\
"colors": ["#000", "#444", "#aaa"],\
"ontouchstart": "if(this.value == this.max) { control.showToolbar();} else { control.hideToolbar(); }",\
"label": "menu",\
},';
}
_json += "]];";
interfaceManager.runInterface(_json);
$.mobile.changePage('#SelectedInterfacePage');
return;
break;
}
for(var i = 2; i < arguments.length; i++) {
args[i - 2] = arguments[i];
}
this.delegate.processOSC(address, typetags, args);
}