Comments (8)
Ah, I didn't realize that's what you meant. Yes, that works.
from lvgl.
Hey @xamix,
I came to the same conclusion about that line in lv_obj.c.
LV_STATE_FOCUS_KEY
is the state that themes and styles are are supposed to add an outline for when it's set. POINTERs focus objects the same way ENCODERS and KEYPADS do, except that ENCODERS and KEYPADS set the LV_STATE_FOCUS_KEY
state on the object.
This seems to work for getting the outline with a POINTER indev.
static void pointer_click_event_cb(lv_event_t * e)
{
lv_obj_t * obj = lv_event_get_param(e);
lv_obj_add_state(obj, LV_STATE_FOCUS_KEY);
}
lv_indev_add_event_cb(pointer_indev, pointer_click_event_cb, LV_EVENT_CLICKED, NULL);
from lvgl.
Hi @liamHowatt,
Thank you for your workaround.
However it is not as simple as it since we also need to remove this LV_STATE_FOCUS_KEY
on the previous clicked object, otherwise multiple object will have the outline enabled.
Also at start when nothing was already clicked, then nothing is outlined even if something is currenty focused.
Regards.
from lvgl.
Hi,
LV_STATE_FOCUS_KEY
is added only when a keypad or encoder focused the widget, however LV_STATE_FOCUSED
is always added and removed for any kind of focusing. So - if I understand the issue correctly - all you need to do, is using LV_STATE_FOCUSED
instead of LV_STATE_FOCUS_KEY
.
from lvgl.
xamix
we also need to remove this
LV_STATE_FOCUS_KEY
on the previous clicked object, otherwise multiple object will have the outline enabled.
I am seeing only one set of things outlined at once when I run that snippet. The object(s) being unfocused automatically have that state removed so they aren't outlined anymore.
xamix
Also at start when nothing was already clicked, then nothing is outlined even if something is currenty focused.
Are you basically asking for the outline to be set when anything is focused regardless of the indev?
This does that.
diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c
index 682706ed3..0b1f0453b 100644
--- a/src/core/lv_obj.c
+++ b/src/core/lv_obj.c
@@ -648,8 +648,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
lv_indev_t * indev = lv_indev_active();
if(indev == NULL) indev = lv_event_get_indev(e);
- lv_indev_type_t indev_type = lv_indev_get_type(indev);
- if(indev_type == LV_INDEV_TYPE_KEYPAD || indev_type == LV_INDEV_TYPE_ENCODER) state |= LV_STATE_FOCUS_KEY;
+ state |= LV_STATE_FOCUS_KEY;
if(editing) {
state |= LV_STATE_EDITED;
lv_obj_add_state(obj, state);
Maybe we could make this a configurable thing.
kisvegabor
So - if I understand the issue correctly - all you need to do, is using
LV_STATE_FOCUSED
instead ofLV_STATE_FOCUS_KEY
.
Setting LV_STATE_FOCUSED
in the callback didn't create the outline effect for me.
from lvgl.
Setting LV_STATE_FOCUSED in the callback didn't create the outline effect for me.
In lv_theme_default.c
I've replaced all LV_STATE_FOCUS_KEY
s with LV_STATE_FOCUSED
, not created a default group, and I saw the outlines as the widgets ere clicked.
from lvgl.
We need some feedback on this issue.
Now we mark this as "stale" because there was no activity here for 14 days.
Remove the "stale" label or comment else this will be closed in 7 days.
from lvgl.
As there was no activity here for a while we close this issue. But don't worry, the conversation is still here and you can get back to it at any time.
So feel free to comment if you have remarks or ideas on this topic.
from lvgl.
Related Issues (20)
- lv_api_map_v8.h has no consideration for things that are enabled/disabled
- Buggy Demos in 9.x HOT 3
- tiny_ttf ignores cache_size in lv_tiny_ttf_create_file_ex function HOT 1
- Play lottie example HOT 8
- More color depths HOT 3
- 9.1 Input Device Documentation HOT 2
- macOS buiold failure
- LVGL Integration strategy for Zephyr HOT 3
- Better sync between LVGL and Zephyr for runtime hw rotation HOT 2
- Animation and keyboard input conflict
- Setting system time under Linux affects ticks HOT 1
- screen refresh rate is very low HOT 5
- Problem with lv_demo_widgets demo(Instrument panel) after porting code to hardware HOT 1
- Button Matrix cannot be removed from lv_conf.h HOT 1
- Tiny TTF causes crash in certain situations HOT 1
- Tiny TTF should be caching stbtt_FindGlyphIndex HOT 26
- Line 11 of src/libs/tiny_ttf.c declared incorrectly HOT 1
- Docs build break HOT 1
- 8.4/9.1 Hardware based display rotation input devices HOT 5
- LV_COLOR_16_SWAP removal and performance 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 lvgl.