Open instantiator opened 1 year ago
Debugging help and commentary from @jamisonderek
So the issue is:
widget_alloc
does...view_set_input_callback(widget->view, ...)
then later you do...
view_set_input_callback(widget_get_view(app->widget), widget_input_callback);
which does..
void view_set_input_callback(View* view, ViewInputCallback callback) { furi_assert(view); furi_assert(view->input_callback == NULL); <<<<<
For your issue,
gui_widget_view_input_callback
calls all of the widget's input handlers. Ideally you would create something new likewidget_element_button_action
that would invoke a callback when a button was pressed. Unfortunately,widget_add_element
is static. 😦
Working through this, the issue is that:
furi_assert(view->input_callback == NULL);
(here).Therefore, under circumstances where furi_assert
is enforced (eg. the dev
firmware?) it's not possible to assign an alternate input callback.
It also doesn't seem possible to modify any of the various structs directly:
It's also not possible to craft a new element type, and add it to the widget, as:
static
(ie. private).So, the only option seems to be to add a button:
An alternative is to modify the firmware to give some more flexbility to developers.
Modify the firmware to support definition of new elements, and their addition to widgets, ie.
widget_add_element
to not be static
Widget
and WidgetElement
to be accessibleAlter View
to permit direct alteration of the input callback, ie.
furi_assert(view->input_callback == NULL);
constraint in view_set_input_callback
Filed the simplest possible PR against the firmware: https://github.com/flipperdevices/flipperzero-firmware/pull/2623
When running on the
dev
firmware, the app causes the Flipper to hang when attempting to show the resistor editing scene.To reproduce
ufbt
over to thedev
SDKdev
firmwareNB. Back button + left will restart the Flipper.