| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- ////////////////////////////////////////////////////////////////////////////
- // 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.
-
- });
- OnPartImtBtnShow(0);
- OnPartImtBtnShow(1);
- OnPartImtBtnShow(2);
- OnPartImtBtnShow(3);
- OnPartImtBtnShow(4);
- OnPartImtBtnHide(5);
- ui.part_imt_2.index = 0;
- OnCurvesModelShow();
- }
- //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 OnOpenBtnImTool(){
- unit.form.side_pane.OnOpenBtnImTool();
- }*/
- function OnOpenImTool(){
- unit.form.side_pane.OnOpenToolFile();
- }
- function OnOpenImPart(){
- unit.form.side_pane.OnOpenPartFile();
- }
- function OnCurvesModelHide(){
- ui.curves_down_btn.visible = false;
- ui.curves_right_btn.visible = true;
- ui.curves_stk.visible = false;
- }
- function OnCurvesModelShow(){
- ui.curves_down_btn.visible = true;
- ui.curves_right_btn.visible = false;
- ui.curves_stk.visible = true;
- }
- function OnPartImtBtnHide(Idx){
- if(Idx === 0){
- ui.imt_btn_d0.visible = false;
- ui.imt_btn_r0.visible = true;
- ui.part_imt_0.visible = false;
- }
- if(Idx === 1){
- ui.imt_btn_d1.visible = false;
- ui.imt_btn_r1.visible = true;
- ui.part_imt_1.visible = false;
- }
- if(Idx === 2){
- ui.imt_btn_d2.visible = false;
- ui.imt_btn_r2.visible = true;
- ui.part_imt_2.visible = false;
- }
- if(Idx === 3){
- ui.imt_btn_d3.visible = false;
- ui.imt_btn_r3.visible = true;
- ui.part_imt_3.visible = false;
- }
- if(Idx === 4){
- ui.imt_btn_d4.visible = false;
- ui.imt_btn_r4.visible = true;
- ui.part_imt_4.visible = false;
- }
- if(Idx === 5){
- ui.imt_btn_d5.visible = false;
- ui.imt_btn_r5.visible = true;
- ui.part_imt_5.visible = false;
- }
-
- }
- function OnPartImtBtnShow(Idx){
- if(Idx === 0){
- ui.imt_btn_d0.visible = true;
- ui.imt_btn_r0.visible = false;
- ui.part_imt_0.visible = true;
- }
- if(Idx === 1){
- ui.imt_btn_d1.visible = true;
- ui.imt_btn_r1.visible = false;
- ui.part_imt_1.visible = true;
- }
- if(Idx === 2){
- ui.imt_btn_d2.visible = true;
- ui.imt_btn_r2.visible = false;
- ui.part_imt_2.visible = true;
- }
- if(Idx === 3){
- ui.imt_btn_d3.visible = true;
- ui.imt_btn_r3.visible = false;
- ui.part_imt_3.visible = true;
- }
- if(Idx === 4){
- ui.imt_btn_d4.visible = true;
- ui.imt_btn_r4.visible = false;
- ui.part_imt_4.visible = true;
- }
- if(Idx === 5){
- ui.imt_btn_d5.visible = true;
- ui.imt_btn_r5.visible = false;
- ui.part_imt_5.visible = true;
- }
- }
- //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);
- }
- }
|