listview_test.monkey2 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #Import "<std>"
  2. #Import "<mojo>"
  3. #Import "<mojox>"
  4. #Import "assets/monkey2.png"
  5. Using std..
  6. Using mojo..
  7. Using mojox..
  8. Class MyWindow Extends Window
  9. Method New()
  10. Super.New( "Simple Mojo Gui App",640,480,WindowFlags.Resizable )
  11. Local icon:=Image.Load( "asset::monkey2.png" )
  12. Local list:=New ListView
  13. For Local i:=0 until 100
  14. list.AddItem( "Hello there!~nThis is a wide listview!~nWith an icon!",icon )
  15. list.AddItem( "there" )
  16. list.AddItem( "this" )
  17. list.AddItem( "is" )
  18. list.AddItem( "listview" )
  19. list.AddItem( "Hello there this is a wide listview!" )
  20. list.AddItem( "there" )
  21. list.AddItem( "this" )
  22. list.AddItem( "is" )
  23. list.AddItem( "listview" )
  24. list.AddItem( "Hello there this is a wide listview!" )
  25. list.AddItem( "there" )
  26. list.AddItem( "this" )
  27. list.AddItem( "is" )
  28. list.AddItem( "listview" )
  29. Next
  30. list.ItemClicked+=Lambda( item:ListView.Item )
  31. Local index:=list.IndexOfItem( item )
  32. Print "Item "+index+" clicked"
  33. End
  34. ContentView=list
  35. End
  36. End
  37. Function Main()
  38. New AppInstance
  39. New MyWindow
  40. App.Run()
  41. End