diff options
| author | ruki <[email protected]> | 2018-01-20 00:45:29 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-19 22:32:58 +0800 |
| commit | ba7696ff7174d8d07e6aec4138b9cce5f0952ca4 (patch) | |
| tree | ef52c41eca271695dad3c802efc8be8c0bdf8b8a /xmake/core/ui/boxdialog.lua | |
| parent | 35ca390ac845a86c78e34059946207f8f980ed5e (diff) | |
add text changed
Diffstat (limited to 'xmake/core/ui/boxdialog.lua')
| -rw-r--r-- | xmake/core/ui/boxdialog.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/core/ui/boxdialog.lua b/xmake/core/ui/boxdialog.lua index 92ec704e5..65112e65d 100644 --- a/xmake/core/ui/boxdialog.lua +++ b/xmake/core/ui/boxdialog.lua @@ -45,6 +45,20 @@ function boxdialog:init(name, bounds, title) self:text():bounds().ey = 3 self:text():invalidate(true) self:text():option_set("selectable", false) + self:text():option_set("progress", false) + + -- text changed + self:text():action_set("text.changed", function (v, e) + if e.text then + local lines = #e.text:split('\n', true) + if lines > 0 and lines < self:height() then + self:box():bounds().sy = lines + self:text():bounds().ey = lines + self:box():invalidate(true) + self:text():invalidate(true) + end + end + end) -- select buttons by default self:panel():select(self:buttons()) |
