/script_binding/lua/demo_entry.lua

http://ftk.googlecode.com/ · Lua · 40 lines · 28 code · 12 blank · 0 comment · 0 complexity · 63e4f3642d13d234fcd7e13715dcc0fa MD5 · raw file

  1. function OnQuit(button)
  2. Ftk.Quit()
  3. return RET_OK
  4. end
  5. function AppInit()
  6. win=FtkAppWindow.Create()
  7. win:SetText("Demo entry")
  8. win:SetAttr(FTK_ATTR_QUIT_WHEN_CLOSE)
  9. width=win:Width()
  10. height=win:Height()
  11. entry=FtkEntry.Create(win, 10, 30, width - 20, 30);
  12. entry:SetText("Single line editor")
  13. entry=FtkEntry.Create(win, 10, 80, width - 20, 30)
  14. entry:SetText("Single line editor, that means you can input a one line only.")
  15. entry=FtkEntry.Create(win, 10, 130, width - 20, 30);
  16. entry:SetText("Single line editor, ?????????????.")
  17. button=FtkButton.Create(win, width/4, height/2, width/2, 60)
  18. button:SetText("Quit")
  19. button:SetClickedListener("OnQuit")
  20. entry=FtkEntry.Create(win, 10, height-60, width - 20, 30)
  21. entry:SetText("Single line editor, that means you can input a one line only.")
  22. win:SetFocus(button)
  23. win:ShowAll(1)
  24. return 1
  25. end
  26. Ftk.Init(1, {"entry"})
  27. AppInit()
  28. Ftk.Run()