Skip to content

Creating Element Alias for Toggle Button - Compile Error #511

@ee-boi

Description

@ee-boi

Describe the bug

I am trying to add an element alias to reuse a toggle button from one page to another. I followed the tips & tricks page instructions here, and the alias line I entered in the GUIslice.h include file is:

gslc_ElemAdd(&m_gui, E_PG_RUN2, gslc_GetElemFromRef(&m_gui, m_pElemToggle1), GSLC_ELEMREF_DEFAULT);

but I am getting the below error while compiling.

Device hardware

Expected behavior

Should compile fine? Not sure why it is complaining about an int conversion.

Initialization messages

In file included from include/GUISLICE_REV2_GSLC.h:18,
                 from src/main.cpp:15:
include/GUISLICE_REV2_GSLC.h: In function 'void InitGUIslice_gen()':
.pio/libdeps/adafruit_metro_m0/GUIslice/src/GUIslice.h:453:53: error: invalid conversion from 'int' to 'gslc_teElemRefFlags' [-fpermissive]
  453 | #define GSLC_ELEMREF_DEFAULT  (GSLC_ELEMREF_SRC_RAM | GSLC_ELEMREF_VISIBLE)
      |                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     int
include/GUISLICE_REV2_GSLC.h:663:80: note: in expansion of macro 'GSLC_ELEMREF_DEFAULT'
  663 |   gslc_ElemAdd(&m_gui, E_PG_RUN2, gslc_GetElemFromRef(&m_gui, m_pElemToggle1), GSLC_ELEMREF_DEFAULT);
      |                                                                                ^~~~~~~~~~~~~~~~~~~~
In file included from include/GUISLICE_REV2_GSLC.h:18,
                 from src/main.cpp:15:
.pio/libdeps/adafruit_metro_m0/GUIslice/src/GUIslice.h:3471:102: note:   initializing argument 4 of 'gslc_tsElemRef* gslc_ElemAdd(gslc_tsGui*, int16_t, gslc_tsElem*, gslc_teElemRefFlags)'
 3471 | gslc_tsElemRef* gslc_ElemAdd(gslc_tsGui* pGui,int16_t nPageId,gslc_tsElem* pElem,gslc_teElemRefFlags eFlags);
      |                                                                                  ~~~~~~~~~~~~~~~~~~~~^~~~~~
src/main.cpp: In function 'bool CbCheckbox(void*, void*, int16_t, bool)':

Additional info

All help is appreciated, hopefully I am not taking advantage of your good will @Pconti31. I also have a few more issues/questions but I figured I will go one at a time for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions