tboox / ltui

🍖 A cross-platform terminal ui library based on Lua
https://tboox.org
Apache License 2.0
818 stars 49 forks source link

mouseable buttons and panels #19

Closed laelnasan closed 3 years ago

laelnasan commented 3 years ago

Mouseable by default if the curses implementation has support. To disable set app:option_set("mouseable", false) globally or per view


waruqi commented 3 years ago

app:option_set("mouseable", false)

I don't see any relevant code

waruqi commented 3 years ago

I merged your patch and fixed some code styles. You can see https://github.com/tboox/ltui/pull/20

But button/ac_on_clicked I haven't completely fixed it. Is there a better way to implement it?

I think we should register ac_on_enter in the subview to call your own _do_select

            if v:parent()._do_select then
                return v:parent():_do_select()
            end
waruqi commented 3 years ago

I will close this pr first, you can continue to improve it on mouse.

laelnasan commented 3 years ago

app:option_set("mouseable", false)

I don't see any relevant code

It is a reference to an instance of application, it being a child of panel would return nil on not option("mouseable")