//////////////////////////////////////////////////////////////////////////// // System Pre-define Functions // 95099372-ef3e-11ea-9c81-bf848405c62e //Callback of data preparation stage before UI is fully loaded. function OnInitializeData(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); ui.list1.table = [["颜色序号", "R", "G", "B"], ["1", "1.0", "0.0", "0.0"], ["2", "0.0", "1.0", "0.0"]]; ui.list2.table = [["颜色序号", "R", "G", "B"], ["1", "1.0", "0.0", "0.0"], ["2", "0.0", "1.0", "0.0"], ["3", "0.0", "1.0", "1.0"]]; ui.list3.table = [["颜色序号", "R", "G", "B"], ["1", "1.0", "0.0", "0.0"], ["2", "0.0", "1.0", "0.0"], ["3", "0.0", "1.0", "1.0"], ["4", "1.0", "1.0", "1.0"]]; ui.list4.table = [["颜色序号", "R", "G", "B"], ["1", "1.0", "0.0", "0.0"], ["2", "0.0", "1.0", "0.0"], ["3", "0.0", "1.0", "1.0"], ["4", "1.0", "1.0", "1.0"], ["5", "1.0", "0.0", "1.0"]]; } //Callback after UI is fully loaded and displayed. function OnReady(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); } function OnCloseForm() { } function OnException(err) { //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok); } ////////////////////////////////////////////////////////////////////////// // Callback Functions. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7 function OnMap4(){ unit.form.mainfrm.OnSend('colorRGBS 5 ' + ui.list4.table[1][1] + ' ' + ui.list4.table[1][2] + ' ' + ui.list4.table[1][3] + ' ' + ui.list4.table[2][1] + ' ' + ui.list4.table[2][2] + ' ' + ui.list4.table[2][3] + ' ' + ui.list4.table[3][1] + ' ' + ui.list4.table[3][2] + ' ' + ui.list4.table[3][3] + ' ' + ui.list4.table[4][1] + ' ' + ui.list4.table[4][2] + ' ' + ui.list4.table[4][3] + ' ' + ui.list4.table[5][1] + ' ' + ui.list4.table[5][2] + ' ' + ui.list4.table[5][3]); } function OnMap3(){ unit.form.mainfrm.OnSend('colorRGBS 4 ' + ui.list3.table[1][1] + ' ' + ui.list3.table[1][2] + ' ' + ui.list3.table[1][3] + ' ' + ui.list3.table[2][1] + ' ' + ui.list3.table[2][2] + ' ' + ui.list3.table[2][3] + ' ' + ui.list3.table[3][1] + ' ' + ui.list3.table[3][2] + ' ' + ui.list3.table[3][3] + ' ' + ui.list3.table[4][1] + ' ' + ui.list3.table[4][2] + ' ' + ui.list3.table[4][3]); } function OnMap2(){ unit.form.mainfrm.OnSend('colorRGBS 3 ' + ui.list2.table[1][1] + ' ' + ui.list2.table[1][2] + ' ' + ui.list2.table[1][3] + ' ' + ui.list2.table[2][1] + ' ' + ui.list2.table[2][2] + ' ' + ui.list2.table[2][3] + ' ' + ui.list2.table[3][1] + ' ' + ui.list2.table[3][2] + ' ' + ui.list2.table[3][3]); } function OnMap1(){ unit.form.mainfrm.OnSend('colorRGBS 2 ' + ui.list1.table[1][1] + ' ' + ui.list1.table[1][2] + ' ' + ui.list1.table[1][3] + ' ' + ui.list1.table[2][1] + ' ' + ui.list1.table[2][2] + ' ' + ui.list1.table[2][3]); } //The message corresponding callback executed by the docker pane. // when calling [side_pane].fireEvent(type,para) in the main form. function OnParentDockerMessage(type, para) { } ////////////////////////////////////////////////////////////////////////// // Utils Functions. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe function onDragFile(filepath) { } function PUI(cb) { if(pui){cb();} } /*Usage of BLOCK_EVENT BLOCK_EVENT(()=>{ ui.[name].[var] = ...; }); */ function BLOCK_EVENT(cb) { ui.block_event = true; cb(); ui.block_event = false; } ////////////////////////////////////////////////////////////////////////// // template codes for cw callback js. function CW_DeclareVariable(name, setter, getter) { if(typeof(__DeclareVariable) === 'function') { __DeclareVariable(name, setter, getter); } } function CW_DeclareOuterVariable(name) { if(typeof(__DeclareOuterVariable) === 'function') { __DeclareOuterVariable(name); } }