-
Notifications
You must be signed in to change notification settings - Fork 3
/
_example_panel_callProto.jsx
76 lines (58 loc) · 1.94 KB
/
_example_panel_callProto.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
{
// this will try to call the prototype from example 1 the script
// _example_panel_withProto.jsx needs to be loaded
//
//
#include 'Debugger.jsx';
run_script_callProto(this);
function run_script_callProto(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_callProto
// 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 call 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"
};
}