part_material_pane.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. ui.list.table = [["Material Zones", "Type"], ["CR3-070mm/0.700mm", "Constant"]];
  12. ui.list.filter = [0, 1, ["Constant", "Rolled"]];
  13. ui.list.head_size = [0, -1];
  14. OnInfoModelShow();
  15. OnMeterialModelShow();
  16. }
  17. //Callback after UI is fully loaded and displayed.
  18. function OnReady(reload, preview) {
  19. PUI(()=>{
  20. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  21. //The 'pui' variable is valid in all functions of this document.
  22. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  23. });
  24. }
  25. function OnCloseForm() {
  26. }
  27. function OnException(err) {
  28. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  29. }
  30. //////////////////////////////////////////////////////////////////////////
  31. // Callback Functions.
  32. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  33. function OnOpenEditWin(){
  34. unit.form.Material_Editor_View.Show();
  35. }
  36. function OnMeterialModelHide(){
  37. ui.material_btn_down.visible = false;
  38. ui.material_btn_right.visible = true;
  39. ui.material_stk.visible = false;
  40. }
  41. function OnInfoModelHide(){
  42. ui.info_btn_down.visible = false;
  43. ui.info_btn_right.visible = true;
  44. ui.info_stk.visible = false;
  45. }
  46. function OnInfoModelShow(){
  47. ui.info_btn_down.visible = true;
  48. ui.info_btn_right.visible = false;
  49. ui.info_stk.visible = true;
  50. }
  51. function OnMeterialModelShow(){
  52. ui.material_btn_down.visible = true;
  53. ui.material_btn_right.visible = false;
  54. ui.material_stk.visible = true;
  55. }
  56. //The message corresponding callback executed by the docker pane.
  57. // when calling [side_pane].fireEvent(type,para) in the main form.
  58. function OnParentDockerMessage(type, para) {
  59. }
  60. //////////////////////////////////////////////////////////////////////////
  61. // Utils Functions.
  62. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  63. function onDragFile(filepath) {
  64. }
  65. function PUI(cb) {
  66. if(pui){cb();}
  67. }
  68. /*Usage of BLOCK_EVENT
  69. BLOCK_EVENT(()=>{
  70. ui.[name].[var] = ...;
  71. });
  72. */
  73. function BLOCK_EVENT(cb) {
  74. ui.block_event = true;
  75. cb();
  76. ui.block_event = false;
  77. }
  78. //////////////////////////////////////////////////////////////////////////
  79. // template codes for cw callback js.
  80. function CW_DeclareVariable(name, setter, getter) {
  81. if(typeof(__DeclareVariable) === 'function') {
  82. __DeclareVariable(name, setter, getter);
  83. }
  84. }
  85. function CW_DeclareOuterVariable(name) {
  86. if(typeof(__DeclareOuterVariable) === 'function') {
  87. __DeclareOuterVariable(name);
  88. }
  89. }