Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "color"
- pww, pwh = platform.window:width(), platform.window:height()
- toolpalette.register({
- {"Couleur",
- {"bleu", function() setTBcolor(color.blue) end},
- {"vert", function() setTBcolor(color.green) end}
- }
- })
- toolpalette.enableCopy(true)
- toolpalette.enableCut(true)
- toolpalette.enablePaste(true)
- function on.construction()
- TB = D2Editor.newRichText()
- :setFontSize(45)
- :resize(pww-1, pwh-1)
- :move(0,0)
- :setBorder(1)
- :registerFilter({
- charIn = function(c)
- print(c)
- return false -- on ignore l'event, on le laisse se propager
- end,
- arrowKey = function(a)
- print(a)
- return false -- on ignore l'event, on le laisse se propager
- end,
- tabKey = function(a)
- print("tab reçu")
- return true -- on catche l'event, on ne le laisse pas se propager
- end,
- })
- end
- function setTBcolor(color)
- TB:setBorderColor(color)
- :setTextColor(color)
- :setText(TB:getText() or "") -- Why doesn't TI automatically refreshes the text, good question...
- end
- function on.resize(w, h)
- pww, pwh = w, h
- TB:resize(pww, pwh)
- platform.window:invalidate()
- end
- function on.getFocus()
- TB:setFocus(true)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement