simulation_grid_pane.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 OnReturn(){
  29. unit.form.mainfrm.menu(3);
  30. }
  31. function OnCloseMesh(){
  32. unit.form.mainfrm.OnCloseMesh();
  33. }
  34. function OnOpenMesh(){
  35. unit.form.mainfrm.OnOpenMesh(parseFloat(ui.pb_x.value), parseFloat(ui.pb_y.value), parseFloat(ui.pb_z.value),
  36. parseFloat(ui.pb_dx.value), parseFloat(ui.pb_dy.value), parseFloat(ui.pb_dz.value));
  37. model.setSize(parseFloat(ui.pb_size.value));
  38. }
  39. //The message corresponding callback executed by the docker pane.
  40. // when calling [side_pane].fireEvent(type,para) in the main form.
  41. function OnParentDockerMessage(type, para) {
  42. }
  43. //////////////////////////////////////////////////////////////////////////
  44. // Utils Functions.
  45. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  46. function onDragFile(filepath) {
  47. }
  48. function PUI(cb) {
  49. if(pui){cb();}
  50. }
  51. /*Usage of BLOCK_EVENT
  52. BLOCK_EVENT(()=>{
  53. ui.[name].[var] = ...;
  54. });
  55. */
  56. function BLOCK_EVENT(cb) {
  57. ui.block_event = true;
  58. cb();
  59. ui.block_event = false;
  60. }
  61. //////////////////////////////////////////////////////////////////////////
  62. // template codes for cw callback js.
  63. function CW_DeclareVariable(name, setter, getter) {
  64. if(typeof(__DeclareVariable) === 'function') {
  65. __DeclareVariable(name, setter, getter);
  66. }
  67. }
  68. function CW_DeclareOuterVariable(name) {
  69. if(typeof(__DeclareOuterVariable) === 'function') {
  70. __DeclareOuterVariable(name);
  71. }
  72. }