-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lv_obj_set_property()
with selector
#6166
Comments
Oh, I think I figure it out: lv_property_t props[] = {
{ .id = LV_STYLE_BG_COLOR | LV_PART_INDICATOR, .color = (lv_color_t){.red = 0x11, .green = 0x22, .blue = 0x33}, },
}
LV_OBJ_SET_PROPERTY_ARRAY(obj, props); This is really neat! |
There's a small error: |
Hi @hyansuper, Thanks you for opening this issue.
I can't see in the code where/why it should work. See here. @XuNeo Is the |
my mistake, that won't work😂 |
I have looked into the issue, and found out no easy solution. Let's discuss.
typedef struct {
lv_prop_id_t id; /**< property ID, includes style ID(lv_style_prop_t) and widgets property ID.*/
lv_style_selector_t selector; /**< style selector, only used for when id is style ID*/
union {
int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/
const void * ptr; /**< Constant pointers (font, cone text, etc)*/
lv_color_t color; /**< Colors*/
lv_value_precise_t precise; /**< float or int for precise value*/
lv_style_value_t _style; /**< A place holder for style value which is same as property value.*/
};
} lv_property_t;
lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value, lv_style_selector_t selector);
lv_property_t lv_obj_get_property(lv_obj_t * obj, lv_prop_id_t id, lv_style_selector_t selector);
lv_result_t lv_obj_set_property(lv_obj_t * obj, const lv_property_t * value);
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
lv_style_selector_t selector); I vote for 2, since mixing them looks really neat.
|
Do you mean to make this usable?
I am not sure, is |
The issue is that
It feels like style is a special property one widget can have. Widget can also have normal properties like label long mode etc.
I mean that we should drop style prop ID support from API |
Hi @XuNeo , I hope you keep the property API that unifies style and properties. It's ok if selectors can't be used. I can add 'LV_PROPERTY_BAR_INDICATOR_COLOR' if I need it. just like you did in lv_image.c. With lv_obj_set_property(), I can make my device swap UI easily by parsing a portable bin file that contains a list of property id-value pairs. |
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. |
Not stale. Hi @kisvegabor , What do you think of adding |
Since style is a special property, how about change the value of property for style, to include state and part selectors? typedef struct {
lv_prop_id_t id;
union {
int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/
const void * ptr; /**< Constant pointers (font, cone text, etc)*/
lv_color_t color; /**< Colors*/
lv_value_precise_t precise; /**< float or int for precise value*/
struct {
uint32_t selector;
lv_style_value_t _style;
} style;
};
} lv_property_t; The struct size will 4bytes longer of cause. |
Sounds good to me😃 |
Introduce the problem
can I set property for different state/part with code described in https://docs.lvgl.io/master/others/obj_property.html#a-step-further.
for example, I want to specify PART_INDECATOR color property in the array, how to do it?
Proposal
No response
The text was updated successfully, but these errors were encountered: