Guest User

Untitled

a guest
Oct 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. local widget = require "widget"
  2.  
  3.  
  4. local onItemRelease = function( event )
  5. print( "You touched item: " .. event.target.id )
  6.  
  7. end
  8.  
  9. --
  10.  
  11. local itemData = {
  12.  
  13. {
  14.  
  15. title = "First Item",
  16. onRelease = onItemRelease,
  17. icon = {
  18. image = "myicon.png",
  19. width = 32,
  20. height = 32,
  21. base = system.ResourcesDirectory,
  22. padding = 15,
  23. paddingTop = 20
  24. }
  25. },
  26.  
  27. {
  28. -- CATEGORY (just one key)
  29.  
  30. categoryName = "My Category"
  31. },
  32.  
  33. {
  34. -- ANOTHER ITEM:
  35.  
  36.  
  37. title = "Second Item",
  38. onRelease = onItemRelease,
  39. icon = {
  40. image = "myicon.png",
  41. width = 32,
  42. height = 32,
  43. base = system.ResourcesDirectory,
  44. padding = 15,
  45. paddingTop = 20
  46. }
  47. }
  48. }
  49.  
  50. --
  51.  
  52. --print(table.getn(itemData))
  53. local myList = widget.newTableView{ rowHeight = 60, width = 600}
  54.  
  55. --populate list from table:
  56. myList:sync( itemData )
Add Comment
Please, Sign In to add comment