I was wanting to send an int defined as a const in globals.xml. Since event_cb in C code is a void*, it would be great to be able to convert over a defined into to a void*. This currently doesn't work as the global #define isn't a pointer.
XML:
<element name="event_cb" access="add" type="void" help="Attach an event callback">
<arg name="callback" type="event_cb" help="Callback function"/>
<arg name="trigger" type="lv_event" default="clicked" help="Event to trigger callback"/>
<arg name="user_data" type="string" default="NULL" help="Optional user data as a string"/>
</element>
Use case:
In global.xml:
<consts>
<int name="HOME_SCREEN_ID" value="1" />
</consts>
What I would like to be able to do in my screen.xml:
<event_cb callback="set_screen" trigger="clicked" user_data="#HOME_SCREEN_ID" />
The reason for this is so that I can do a big switch case instead of a few hundred strcmp()'s to handle things like my screen transitions or passing one of 400 different error codes.
I was wanting to send an int defined as a const in globals.xml. Since event_cb in C code is a void*, it would be great to be able to convert over a defined into to a void*. This currently doesn't work as the global #define isn't a pointer.
XML:
Use case:
In global.xml:
What I would like to be able to do in my screen.xml:
The reason for this is so that I can do a big switch case instead of a few hundred strcmp()'s to handle things like my screen transitions or passing one of 400 different error codes.