colorMap_pane.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.list1.table = [["颜色序号", "R", "G", "B"], ["1", "1.0", "0.0", "0.0"], ["2", "0.0", "1.0", "0.0"]];
  12. 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"]];
  13. 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"]];
  14. 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"]];
  15. }
  16. //Callback after UI is fully loaded and displayed.
  17. function OnReady(reload, preview) {
  18. PUI(()=>{
  19. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  20. //The 'pui' variable is valid in all functions of this document.
  21. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  22. });
  23. }
  24. function OnCloseForm() {
  25. }
  26. function OnException(err) {
  27. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  28. }
  29. //////////////////////////////////////////////////////////////////////////
  30. // Callback Functions.
  31. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  32. function OnMap4(){
  33. unit.form.mainfrm.OnSend('colorRGBS 5 ' + ui.list4.table[1][1] + ' ' + ui.list4.table[1][2] + ' ' + ui.list4.table[1][3] + ' ' +
  34. ui.list4.table[2][1] + ' ' + ui.list4.table[2][2] + ' ' + ui.list4.table[2][3] + ' ' +
  35. ui.list4.table[3][1] + ' ' + ui.list4.table[3][2] + ' ' + ui.list4.table[3][3] + ' ' +
  36. ui.list4.table[4][1] + ' ' + ui.list4.table[4][2] + ' ' + ui.list4.table[4][3] + ' ' +
  37. ui.list4.table[5][1] + ' ' + ui.list4.table[5][2] + ' ' + ui.list4.table[5][3]);
  38. }
  39. function OnMap3(){
  40. unit.form.mainfrm.OnSend('colorRGBS 4 ' + ui.list3.table[1][1] + ' ' + ui.list3.table[1][2] + ' ' + ui.list3.table[1][3] + ' ' +
  41. ui.list3.table[2][1] + ' ' + ui.list3.table[2][2] + ' ' + ui.list3.table[2][3] + ' ' +
  42. ui.list3.table[3][1] + ' ' + ui.list3.table[3][2] + ' ' + ui.list3.table[3][3] + ' ' +
  43. ui.list3.table[4][1] + ' ' + ui.list3.table[4][2] + ' ' + ui.list3.table[4][3]);
  44. }
  45. function OnMap2(){
  46. unit.form.mainfrm.OnSend('colorRGBS 3 ' + ui.list2.table[1][1] + ' ' + ui.list2.table[1][2] + ' ' + ui.list2.table[1][3] + ' ' +
  47. ui.list2.table[2][1] + ' ' + ui.list2.table[2][2] + ' ' + ui.list2.table[2][3] + ' ' +
  48. ui.list2.table[3][1] + ' ' + ui.list2.table[3][2] + ' ' + ui.list2.table[3][3]);
  49. }
  50. function OnMap1(){
  51. unit.form.mainfrm.OnSend('colorRGBS 2 ' + ui.list1.table[1][1] + ' ' + ui.list1.table[1][2] + ' ' + ui.list1.table[1][3] + ' ' +
  52. ui.list1.table[2][1] + ' ' + ui.list1.table[2][2] + ' ' + ui.list1.table[2][3]);
  53. }
  54. //The message corresponding callback executed by the docker pane.
  55. // when calling [side_pane].fireEvent(type,para) in the main form.
  56. function OnParentDockerMessage(type, para) {
  57. }
  58. //////////////////////////////////////////////////////////////////////////
  59. // Utils Functions.
  60. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  61. function onDragFile(filepath) {
  62. }
  63. function PUI(cb) {
  64. if(pui){cb();}
  65. }
  66. /*Usage of BLOCK_EVENT
  67. BLOCK_EVENT(()=>{
  68. ui.[name].[var] = ...;
  69. });
  70. */
  71. function BLOCK_EVENT(cb) {
  72. ui.block_event = true;
  73. cb();
  74. ui.block_event = false;
  75. }
  76. //////////////////////////////////////////////////////////////////////////
  77. // template codes for cw callback js.
  78. function CW_DeclareVariable(name, setter, getter) {
  79. if(typeof(__DeclareVariable) === 'function') {
  80. __DeclareVariable(name, setter, getter);
  81. }
  82. }
  83. function CW_DeclareOuterVariable(name) {
  84. if(typeof(__DeclareOuterVariable) === 'function') {
  85. __DeclareOuterVariable(name);
  86. }
  87. }