diff options
| author | ruki <[email protected]> | 2020-11-26 22:45:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-11-26 22:45:43 +0800 |
| commit | d1f2ddce09ce709b1fd07e9ba25449f095325652 (patch) | |
| tree | e31005972cba778ef5a7e5b28abcd6ecff183842 | |
| parent | 6426a1e2f0dea74ee3d82abe9f8b7aa46ed9ef9f (diff) | |
improve textedit/mouse
| -rw-r--r-- | xmake/core/ui/dialog.lua | 3 | ||||
| -rw-r--r-- | xmake/core/ui/panel.lua | 2 | ||||
| -rw-r--r-- | xmake/core/ui/textedit.lua | 5 |
3 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/ui/dialog.lua b/xmake/core/ui/dialog.lua index b92995f06..d3114a941 100644 --- a/xmake/core/ui/dialog.lua +++ b/xmake/core/ui/dialog.lua @@ -63,6 +63,9 @@ function dialog:init(name, bounds, title) self:buttons():bounds_set(rect:new(0, v:height() - 1, v:width(), 1)) self:_update_buttons_layout() end) + + -- mark as block mouse + self:option_set("blockmouse", true) end -- get buttons diff --git a/xmake/core/ui/panel.lua b/xmake/core/ui/panel.lua index d70cefa8f..3a9b6c042 100644 --- a/xmake/core/ui/panel.lua +++ b/xmake/core/ui/panel.lua @@ -58,7 +58,7 @@ function panel:init(name, bounds) -- try focused first local current = v:current() - if current and current:option("mouseable") and current:bounds():contains(x, y) then + if current and current:option("mouseable") and (current:option("blockmouse") or current:bounds():contains(x, y)) then return current:action_on(action.ac_on_clicked, x, y) end diff --git a/xmake/core/ui/textedit.lua b/xmake/core/ui/textedit.lua index 4c06ed564..98219637b 100644 --- a/xmake/core/ui/textedit.lua +++ b/xmake/core/ui/textedit.lua @@ -26,6 +26,7 @@ local event = require("ui/event") local border = require("ui/border") local curses = require("ui/curses") local textarea = require("ui/textarea") +local action = require("ltui/action") -- define module local textedit = textedit or textarea() @@ -42,6 +43,10 @@ function textedit:init(name, bounds, text) -- mark as selectable self:option_set("selectable", true) + -- mark as mouseable + self:option_set("mouseable", true) + self:action_set(action.ac_on_clicked, function () return true end) + -- disable progress self:option_set("progress", false) |
