Some inconveniences and reduced efficiency during use, hoping add target obj searching and so on

What do you want to achieve?

I encountered some inconveniences and reduced efficiency during use. I hope they can be improved. They are just small details, not big functions. It shouldn’t be difficult haha

In the software, after using “ADD EVENT”, it is inconvenient to find the target obj in the drop-down box. I hope there can be a small input box for searching. After entering the first few characters of the name of the target obj, you can find it. This is very convenient

Generate code, in the ui folder, for each function in ui_events.c and .h, I hope it has the __weak modifier, so that I can declare and define the function with the same name in my own file, I don’t want fill in my own program code directly in ui_events.c

I also encountered what seemed to be a bug. Add the UNCHECKED event to button A, execute any action, and then add a click event to button B. When button B is clicked, remove the CHECKED flag of button A. Start the simulation, click button B, and the action of the UNCHECKED event of button A is not executed. I don’t know if it is my usage error or a software bug.

Do you see alternative options and workaround to achieve it?

no

Mention some use cases

A search-box for/beside the dropdown when adding widgets to events is a good idea for big projects with many objects, thanks for the suggestion. (This could be useful in other dropdown-menus too.)

About ui_events.c functions: There’s a checkbox with label ‘Don’t export function’ below the custom ‘CALL FUNCTION’ function name entry field. If you check it the function will not get exported and you can use your external function without clashes. If no function is exported from SquareLine Studio, the ui_events.c is not even created.
But your idea about using some ‘weak’ symbol is good as well, just it should be done in a cross-platform way in SquareLine Studio exported code. I suspect __weak to be a platform-specific only present for certain MCU toolchains, on GCC I could do it with __attribute__((weak)) between function return type and function name, like void __attribute__((weak)) eventFunction (lv_event_t * e) { } in ‘ui_events.c’
Not sure about the support of this attribute on all embedded toolchains though, so for now thicking the checkbox should suffice and is more efficient not to define functions at all in ui_events.c when they’re at other place.

I created an example project with the setup you mention, and you’re right, when you set a state of a widget (like a checkbox) to UNCHECKED programmatically it doesn’t seem to create an LV_EVENT_VALUE_CHANGED in the object which is the target of the change. Only manual state-change triggers that event. That seems to be how LVGL works, and unfortunately there’s no event like LV_EVENT_STATE_CHANGED which could probably be triggered when the state changes to UNCHECKED…

1 Like

thanks
looking forward software upgrading
and for the third question, may it be fixed, that seems obviously bug

This is how it seems to work in LVGL8, a quick search at LVGL forum (with keywords ‘value changed manual event’ gave this topic for example: Changing state of object in event of another one - How-to - LVGL Forum
At the end of the topic kisvegabor, author of LVGL, confirms that ‘manual’ (aka programmatic) change of value ( by e.g. lv_slider_set_value() function ) won’t fire a LV_EVENT_VALUE_CHANGED event on the target object, and he tells it’s a design decision in LVGL for flexibility.
Zebra067’s comment before that statements contains a workaround, namely firing the event (beside the value-change) explicitly by lv_event_send( obj, LV_EVENT_VALUE_CHANGED ) in your button B object’s event handler. I just tried it and it really works.
We currently follow the design decision of LVGL not to add this automatically (there must be a serious reason not to do it by default) but we’ll discuss whether a checkbox should be added beside this kind of event (one object changing value/state of another) to export this explicit event-sending too if it’s checked/enabled in SquareLine Studio UI. Until that you can create a custom ‘CALL FUNCTION’ function in ui_events.c for button B where you can set the state of button-A and send the VALUE_CHANGED event to it as well.)
(For normal buttons, unlike checkboxes, the ‘CHECKABLE’ flag should be set too.)