-
Notifications
You must be signed in to change notification settings - Fork 3
/
_example_panel_withProto.jsx
80 lines (60 loc) · 1.91 KB
/
_example_panel_withProto.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
// This has a prototype
//
//
#include 'Debugger.jsx';
Array.prototype.clear=function(){
this.length = 0;
};
run_script_withProto(this);
function run_script_withProto(thisObj){
// this is global
myMetaObject = {
setting1 : false,
setting2 : false,
myArray :[],
counter : 0
};
/// THIS WILL CHECK IF PANEL IS DOCKABLE OR FLAOTING WINDOW
var win = buildUI(thisObj , myMetaObject );
if ((win != null) && (win instanceof Window)) {
win.center();
win.show();
}; // end if win null and not a instance of window
};// close run_script_withProto
// from here
// http://www.go4expert.com/forums/showthread.php?t=606
//
function buildUI (thisObj , metaObject ) {
var win = (thisObj instanceof Panel) ? thisObj : new Window('palette', 'example with proto',[0,0,150,260],{resizeable: true});
if (win != null) {
var H = 25; // the height
var W1 = 30; // the width
var G = 5; // the gutter
var x = G;
var y = G;
// var yuioff = G; // and some offset
win.check_box = win.add('checkbox',[x,y,x+W1*2,y + H],'check');
win.check_box.value = metaObject.setting1;
win.clear_button = win.add('button', [x + W1*2 -G*2,y,x+W1*5,y + H], 'clear Array');
win.up_button = win.add('button', [x + W1*5+ G,y,x + W1*6,y + H], 'Up');
win.check_box.onClick = function (){
alert("check");
};
win.up_button.onClick = function () {
metaObject.counter++;
metaObject.myArray.push(metaObject.counter);
}
win.clear_button.onClick = function(){
alert("Array length before clear " + metaObject.myArray.length);
metaObject.myArray.clear();
alert("Array length after clear " + metaObject.myArray.length);
// main(metaObject);
};
}
return win
}
function main(metaobj){
// "in function main. From here on it is a straight run"
};
}