Advertisement
BIOSFERA

Untitled

Oct 17th, 2017
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. local buffer = require("doubleBuffering")
  2. local GUI = require("GUI")
  3. local event = require("event")
  4. event.shouldInterrupt = function() return false end
  5. event.shouldSoftInterrupt = event.shouldInterrupt
  6.  
  7. --------------------------------------------------------------
  8.  
  9. local mainContainer = GUI.fullScreenContainer()
  10.  
  11. mainContainer:addChild(GUI.panel(1, 1, mainContainer.width, mainContainer.height, 0x002440))
  12. local layout = mainContainer:addChild(GUI.layout(1, 1, mainContainer.width, mainContainer.height, 1, 1))
  13. local label = layout:addChild(GUI.label(1, 1, 40, 1, 0xE1E1E1, ""):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top))
  14. local input = layout:addChild(GUI.input(1, 1, 40, 5, 0xE1E1E1, 0x444444, 0x888888, 0xE1E1E1, 0x262626, nil, "Напишите ваш отзыв здесь"))
  15.  
  16. layout:addChild(GUI.button(1, 1, 40, 3, 0x336DBF, 0xE1E1E1, 0xE1E1E1, 0x336DBF, "Отправить отзыв")).onTouch = function(mainContainer, object, eventData)
  17. if input.text:len() > 0 then
  18. local file = io.open("/Otzivi.txt", "a")
  19. file:write("Отзыв от пользователя " .. eventData[6] .. ": " .. input.text .. "\n")
  20. file:close()
  21.  
  22. input.text, label.text = "", "Ваш отзыв отправлен"
  23. mainContainer:draw()
  24. buffer.draw()
  25.  
  26. event.timer(2, function()
  27. label.text = ""
  28. mainContainer:draw()
  29. buffer.draw()
  30. end, 1)
  31. end
  32. end
  33.  
  34. --------------------------------------------------------------
  35.  
  36. mainContainer:draw()
  37. buffer.draw(true)
  38. mainContainer:startEventHandling()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement