summaryrefslogtreecommitdiff
path: root/xmake/core/ui/label.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-20 00:45:29 +0800
committerruki <[email protected]>2018-01-19 22:32:58 +0800
commitba7696ff7174d8d07e6aec4138b9cce5f0952ca4 (patch)
treeef52c41eca271695dad3c802efc8be8c0bdf8b8a /xmake/core/ui/label.lua
parent35ca390ac845a86c78e34059946207f8f980ed5e (diff)
add text changed
Diffstat (limited to 'xmake/core/ui/label.lua')
-rw-r--r--xmake/core/ui/label.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/ui/label.lua b/xmake/core/ui/label.lua
index 2615414c1..d2f571c6c 100644
--- a/xmake/core/ui/label.lua
+++ b/xmake/core/ui/label.lua
@@ -25,6 +25,7 @@
-- load modules
local log = require("ui/log")
local view = require("ui/view")
+local event = require("ui/event")
local curses = require("ui/curses")
-- define module
@@ -66,7 +67,14 @@ end
-- set text
function label:text_set(text)
- self._TEXT = text or ""
+ text = text or ""
+ if self._TEXT ~= text then
+ local action = self:action("text.changed")
+ if action then
+ action(self, event.text {text})
+ end
+ end
+ self._TEXT = text
self:invalidate()
return self
end