Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. rollout test "test" height:300
  2. (
  3. subrollout test1 "test1" height:151
  4. subrollout test2 "test2" height:151
  5. )
  6. rollout test1a "test1a"
  7. (
  8. spinner test1as "test1as"
  9. )
  10.  
  11. rollout test1b "test1b"
  12. (
  13. spinner test1bs "test1bs"
  14. )
  15. createdialog test
  16. AddSubRollout test.test1 test1a
  17. AddSubRollout test.test1 test1b
  18.  
  19. titles = #( "test1a", "test1b" )
  20. indexes = #( 2, 1 )
  21.  
  22. g = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
  23.  
  24. rollupWindows = for w in windows.getChildrenHWND test.hwnd where w[4] == "RollupWindow" collect w[1]
  25. format ">> %\n" rollupWindows
  26. for rollupWindowHWND in rollupWindows do
  27. (
  28. local IRollupWindow = g.getIRollup (dotnetobject "system.intptr" rollupWindowHWND)
  29.  
  30. format "\nIRollupWindow.numpanels: %\n" IRollupWindow.numpanels
  31.  
  32. local reordered = false
  33.  
  34. for i=0 to IRollupWindow.numpanels-1 do
  35. (
  36. local IRollupPanel = IRollupWindow.GetPanel (IRollupWindow.GetPanelDlg i asdotnetobject:true)
  37.  
  38. if IRollupPanel != undefined do
  39. (
  40. local rollupName = UIAccessor.GetWindowText IRollupPanel.TitleWnd
  41.  
  42. format "%: % cat:%\n" i rollupName IRollupPanel.category
  43.  
  44. local index = findItem titles rollupName
  45. format "index %\n" index
  46.  
  47. if index > 0 and IRollupPanel.category != indexes[index] do
  48. (
  49. -- show IRollupPanel
  50. IRollupPanel.category = indexes[index]
  51. reordered = true
  52. )
  53.  
  54. )
  55.  
  56. )
  57.  
  58.  
  59. if reordered do
  60. (
  61. format "reordered...\n"
  62.  
  63. IRollupWindow.updateLayout()
  64.  
  65. -- try to save rollup states
  66. for i=0 to IRollupWindow.numpanels-1 do
  67. (
  68. local IRollupPanel = IRollupWindow.GetPanel (IRollupWindow.GetPanelDlg i asdotnetobject:true)
  69.  
  70. if IRollupPanel != undefined do
  71. (
  72. try ( IRollupWindow.SaveState (dotNetObject "System.IntPtr" IRollupPanel.HInst) ) catch (format "save failed at %\n" i)
  73. format "reordering %\n" i
  74. )
  75.  
  76. )
  77.  
  78. )
  79.  
  80.  
  81. g.ReleaseIRollup IRollupWindow
  82.  
  83. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement