gridview_test.monkey2 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #Import "<std>"
  2. #Import "<mojo>"
  3. #Import "<mojox>"
  4. Using std..
  5. Using mojo..
  6. Using mojox..
  7. Class MyWindow Extends Window
  8. Field mainView:GridView
  9. Field gameView:Label
  10. Field view1:Label
  11. Field view2:Label
  12. Method New()
  13. Super.New( "GridView",640,480,WindowFlags.Resizable )
  14. 'Create GameView
  15. gameView=New Label
  16. gameView.Layout="fill"
  17. gameView.Text="GameView"
  18. gameView.TextGravity=New Vec2f( .5 )
  19. Local gameViewStyle:=gameView.Style.Copy()
  20. gameViewStyle.BackgroundColor=Color.Red
  21. gameView.Style=gameViewStyle
  22. 'Create View1
  23. view1=New Label
  24. view1.Layout="fill"
  25. view1.Text="View1"
  26. view1.TextGravity=New Vec2f( .5 )
  27. Local view1Style:=view1.Style.Copy()
  28. view1Style.BackgroundColor=Color.Green
  29. view1.Style=view1Style
  30. 'Create View2
  31. view2=New Label
  32. view2.Layout="fill"
  33. view2.Text="View2"
  34. view2.TextGravity=New Vec2f( .5 )
  35. Local view2Style:=view2.Style.Copy()
  36. view2Style.BackgroundColor=Color.Blue
  37. view2.Style=view2Style
  38. 'Create Main GridView
  39. mainView=New GridView( 8,8 )
  40. mainView.AddView( gameView,0,0,8,4 )
  41. mainView.AddView( view1,0,4,4,4 )
  42. mainView.AddView( view2,4,4,4,4 )
  43. ContentView=mainView
  44. End
  45. End
  46. Function Main()
  47. New AppInstance
  48. New MyWindow
  49. App.Run()
  50. End