process_pl_pane.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. OnPressModelShow();
  12. OnDrawbeadModelShow();
  13. OnDefinitionModelShow();
  14. }
  15. //Callback after UI is fully loaded and displayed.
  16. function OnReady(reload, preview) {
  17. PUI(()=>{
  18. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  19. //The 'pui' variable is valid in all functions of this document.
  20. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  21. });
  22. }
  23. function OnCloseForm() {
  24. }
  25. function OnException(err) {
  26. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  27. }
  28. //////////////////////////////////////////////////////////////////////////
  29. // Callback Functions.
  30. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  31. function OnPressModelHide(){
  32. ui.press_down_btn.visible = false;
  33. ui.press_right_btn.visible = true;
  34. ui.press_stk.visible = false;
  35. }
  36. function OnPressModelShow(){
  37. ui.press_down_btn.visible = true;
  38. ui.press_right_btn.visible = false;
  39. ui.press_stk.visible = true;
  40. }
  41. function OnDrawbeadModelHide(){
  42. ui.drawbead_down_btn.visible = false;
  43. ui.drawbead_right_btn.visible = true;
  44. ui.drawbead_stk.visible = false;
  45. }
  46. function OnDrawbeadModelShow(){
  47. ui.drawbead_down_btn.visible = true;
  48. ui.drawbead_right_btn.visible = false;
  49. ui.drawbead_stk.visible = true;
  50. }
  51. function OnDefinitionModelHide(){
  52. ui.definition_down_btn.visible = false;
  53. ui.definition_right_btn.visible = true;
  54. ui.definition_stk.visible = false;
  55. }
  56. function OnDefinitionModelShow(){
  57. ui.definition_down_btn.visible = true;
  58. ui.definition_right_btn.visible = false;
  59. ui.definition_stk.visible = true;
  60. }
  61. //The message corresponding callback executed by the docker pane.
  62. // when calling [side_pane].fireEvent(type,para) in the main form.
  63. function OnParentDockerMessage(type, para) {
  64. }
  65. //////////////////////////////////////////////////////////////////////////
  66. // Utils Functions.
  67. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  68. function onDragFile(filepath) {
  69. }
  70. function PUI(cb) {
  71. if(pui){cb();}
  72. }
  73. /*Usage of BLOCK_EVENT
  74. BLOCK_EVENT(()=>{
  75. ui.[name].[var] = ...;
  76. });
  77. */
  78. function BLOCK_EVENT(cb) {
  79. ui.block_event = true;
  80. cb();
  81. ui.block_event = false;
  82. }
  83. //////////////////////////////////////////////////////////////////////////
  84. // template codes for cw callback js.
  85. function CW_DeclareVariable(name, setter, getter) {
  86. if(typeof(__DeclareVariable) === 'function') {
  87. __DeclareVariable(name, setter, getter);
  88. }
  89. }
  90. function CW_DeclareOuterVariable(name) {
  91. if(typeof(__DeclareOuterVariable) === 'function') {
  92. __DeclareOuterVariable(name);
  93. }
  94. }