/script_binding/lua/demo_msgbox.lua

http://ftk.googlecode.com/ · Lua · 62 lines · 46 code · 16 blank · 0 comment · 4 complexity · 6a45ec5b649be72062ad32f8c0086e58 MD5 · raw file

  1. function OnTips(button)
  2. ret=Ftk.Tips("The dialog will quit in 3 seconds.");
  3. return RET_OK
  4. end
  5. function OnWarning(button)
  6. ret=Ftk.Warning("Warning",
  7. "December 31, 2008: patchwork.kernel.org is now available for general use. It is currently only monitoring the Linux Kernel mailing-list, but should be useful to kernel developers in dealing with patches flying across the wire.",
  8. {"Yes", "No"})
  9. print("Ret=" .. ret)
  10. return RET_OK
  11. end
  12. function OnQuestion(button)
  13. ret=Ftk.Question("Question", "Are you sure to quit?", {"Yes", "No", "Help"})
  14. print("Ret=" .. ret)
  15. return RET_OK
  16. end
  17. function OnInfomation(button)
  18. ret = Ftk.Infomation("Infomation", "September 19, 2008: mirrors.kernel.org has been flipped over to using our new GeoDNS based bind server (named-geodns). This means that, at the dns query level, our servers will attempt to direct you to the nearest / fastest kernel.org mirror for your request. This means that you no longer have to use mirrors.us.kernel.org or mirrors.eu.kernel.org to generally route you to the right place. This does mean a change to mirrors.kernel.org no longer explicitly pointing at mirrors.us.kernel.org. Additional information on named-geodns will be forth coming, check back here for an addendum soon.", {"OK"})
  19. print("Ret=" .. ret)
  20. return RET_OK
  21. end
  22. function AppInit()
  23. win=FtkAppWindow.Create()
  24. win:SetText("Demo messagebox")
  25. win:SetAttr(FTK_ATTR_QUIT_WHEN_CLOSE)
  26. width=win:Width()
  27. height=win:Height()
  28. button=FtkButton.Create(win, 0, height/6, width/3, 50)
  29. button:SetText("Tips")
  30. button:SetClickedListener("OnTips")
  31. button=FtkButton.Create(win, 2*width/3, height/6, width/3, 50)
  32. button:SetText("Warning")
  33. button:SetClickedListener("OnWarning")
  34. button=FtkButton.Create(win, 0, height/2, width/3, 50)
  35. button:SetText("Question")
  36. button:SetClickedListener("OnQuestion")
  37. button=FtkButton.Create(win, 2*width/3, height/2, width/3, 50)
  38. button:SetText("Infomation")
  39. button:SetClickedListener("OnInfomation")
  40. win:SetFocus(button)
  41. win:ShowAll(1)
  42. return 1
  43. end
  44. Ftk.Init(1, {"messagebox"})
  45. AppInit()
  46. Ftk.Run()