< Button | CodeSamples | Checkbox >
---% Code tested with Luxinia 0.95 build Nov 15 2006
---% at 11/16/06 22:35:27
-- create a textfield at 10,10
tx = TextField:new(10,10,100,20)
tx:setText("OK")
-- overload the onKeyTyped event
function tx:onKeyTyped (keyevent)
-- call the parent function first
TextField.onKeyTyped(self,keyevent)
-- if enter was pressed, let's print out the text
-- and reset the textfield
if keyevent.key == "\n" then
print(tx:getText())
tx:setText("")
end
end
-- add it to the rootcontainer
Container.getRootContainer():add(tx)

