process_topmenu_pane.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. }
  12. //Callback after UI is fully loaded and displayed.
  13. function OnReady(reload, preview) {
  14. PUI(()=>{
  15. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  16. //The 'pui' variable is valid in all functions of this document.
  17. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  18. });
  19. }
  20. function OnCloseForm() {
  21. }
  22. function OnException(err) {
  23. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  24. }
  25. //////////////////////////////////////////////////////////////////////////
  26. // Callback Functions.
  27. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  28. function OnChangeStep(Idx){
  29. const difModel = {
  30. 'PL':() => {
  31. ui.pl_btn.valid = true;
  32. ui.d_20_btn.valid = false;
  33. unit.form.side_pane.OnChangeProcessTopmenu(0);
  34. },
  35. 'D_20':() => {
  36. ui.pl_btn.valid = false;
  37. ui.d_20_btn.valid = true;
  38. unit.form.side_pane.OnChangeProcessTopmenu(1);
  39. }
  40. };
  41. return difModel[Idx]();
  42. }
  43. //The message corresponding callback executed by the docker pane.
  44. // when calling [side_pane].fireEvent(type,para) in the main form.
  45. function OnParentDockerMessage(type, para) {
  46. }
  47. //////////////////////////////////////////////////////////////////////////
  48. // Utils Functions.
  49. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  50. function onDragFile(filepath) {
  51. }
  52. function PUI(cb) {
  53. if(pui){cb();}
  54. }
  55. /*Usage of BLOCK_EVENT
  56. BLOCK_EVENT(()=>{
  57. ui.[name].[var] = ...;
  58. });
  59. */
  60. function BLOCK_EVENT(cb) {
  61. ui.block_event = true;
  62. cb();
  63. ui.block_event = false;
  64. }
  65. //////////////////////////////////////////////////////////////////////////
  66. // template codes for cw callback js.
  67. function CW_DeclareVariable(name, setter, getter) {
  68. if(typeof(__DeclareVariable) === 'function') {
  69. __DeclareVariable(name, setter, getter);
  70. }
  71. }
  72. function CW_DeclareOuterVariable(name) {
  73. if(typeof(__DeclareOuterVariable) === 'function') {
  74. __DeclareOuterVariable(name);
  75. }
  76. }