button_test.monkey2 813 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #import "<std>"
  2. #import "<mojo>"
  3. #import "<mojox>"
  4. Using std..
  5. Using mojo..
  6. Using mojox..
  7. Class MyWindow Extends Window
  8. Method New()
  9. Super.New( "Button Demo",640,480,WindowFlags.Resizable )
  10. Local label:=New Label( "Idle" )
  11. label.Gravity=New Vec2f( .5,0 )
  12. Local button:=New Button( "Click ME!" )
  13. button.Clicked=Lambda()
  14. Global n:=0
  15. n+=1
  16. label.Text="Clicked #"+n
  17. End
  18. button.DoubleClicked=Lambda()
  19. Global n:=0
  20. n+=1
  21. label.Text="Double clicked #"+n
  22. End
  23. button.RightClicked=Lambda()
  24. Global n:=0
  25. n+=1
  26. label.Text="Right clicked #"+n
  27. End
  28. Local dockingView:=New DockingView
  29. dockingView.AddView( label,"top" )
  30. dockingView.ContentView=button
  31. ContentView=dockingView
  32. End
  33. End
  34. Function Main()
  35. New AppInstance
  36. New MyWindow
  37. App.Run()
  38. End