Comments (14)
Great, thank you very much for your contribution, I will review this patch.
from ltui.
I have published v2.1 and upload it to luarocks.
from ltui.
So... reading through the src files of pdcurses I found out it was only missing a definition to support ncurses' mouse API. I've committed a single line that theoretically would solve it. I still don't have a windows machine set up, so if you would kindly do the testing it would be awesome. Sorry for the delay, I just didn't have the time till now.
from ltui.
ok, I will test it.
from ltui.
Hi, me again
After some work I finally got the mouse working with all view objects (AFAIK) and tests
Since this is an optional feature I thought it would be fit to present it with a customization system.
The ideia is to fool the Lua's loading system by placing a ltui.lua
file in a higher priority directory as, for example, the directory where the tests are called. It may also be nice for newcomers (like me) to have an example on how to customize the package to attend individual needs.
https://gist.github.com/laelnasan/92129fecd1e231c6492cd3babd3a0f29
from ltui.
Great!
Can you help submit pr to directly modify these views of ltui instead of customizing the views.
We can add options.mouseable = true/false
to the init() function of each view to selectively enable the mouse feature.
from ltui.
That would be a bit of a grind, because every call to an init() of a child of panel would have to be changed, specially the instantiation of the objects inside dialogs would have to be conditioned to the property.
In the solution I presented, I change the behaviour of the classes at loading time so that all children inherit the changes automatically.
Not saying it cant be done, but I can't see an easy way to do it
from ltui.
I think I may have found a workaround... I just don't know if it fits the coding style: to use a metatable to dynamically load the ltui/* modules and set a global ltui.options
Then one could write something like:
local ltui = require('ltui')
ltui.options = {mouseable = true}
local app = ltui.application
local label = ltui.label
...
from ltui.
ltui.options = {mouseable = true}
like this:
Lines 37 to 41 in 987b002
from ltui.
yes, but that is a option of the instantiated object, right? not the class per se. and how do we identify when the entire application is mouseable or not?
from ltui.
ow, I think I get it now
from ltui.
yes, but that is a option of the instantiated object, right? not the class per se. and how do we identify when the entire application is mouseable or not?
Each view component should allow the user to control whether it can enable the mouse if this view support mouse.
from ltui.
but if the default behaviour doesn't take a global property then the user must modify every single object instantiated to get it working, is that it? I am not trying to convince you, just making sure I understand the idea.
from ltui.
but if the default behaviour doesn't take a global property then the user must modify every single object instantiated to get it working, is that it? I am not trying to convince you, just making sure I understand the idea.
We can also use application:option_set()
and view:application():option()
to set/get global default option to all sub-views.
from ltui.
Related Issues (20)
- TextBox completion % not showing in proper location while in 80 cols mode HOT 1
- 输入框只能输入一次 HOT 4
- is there utf8 support? HOT 5
- Add Doc Comments to Allow Docs Generation HOT 2
- circular behaviour of views in a panel HOT 2
- where has c++ or python lib like as this ? HOT 1
- making TUI with C HOT 2
- 运行测试程序报错 HOT 1
- ltui/scrollbar not found HOT 1
- Problems Running frontpage window example HOT 1
- error: src/core/lcurses/lcurses.c:71:10: fatal error: 'luaconf.h' file not found HOT 2
- No document? HOT 3
- Unexpected label behaviour
- xmake run test 失败 HOT 4
- Error - unable to load ltui.lcurses - undefined symbol COLORS HOT 16
- Error in Windows 10 HOT 1
- error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.1/ltui.so' HOT 6
- Missing top white line in most widgets HOT 2
- Widget not drawing box correctly on size different from initial size HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ltui.