Spirik / GEM

Good Enough Menu for Arduino
GNU Lesser General Public License v3.0
239 stars 36 forks source link

Can´t add a GEMItem to more than one GEMPage? #50

Closed manuelgonzalvez closed 2 years ago

manuelgonzalvez commented 2 years ago

Hi, im' working on a rather big menu (as for today, about 90 GEMPages, 450 GEMItems), & having issues with ESP32 memory for other tasks. some of that items are references to the same object in struct, but execute different methods ( hence they go on different pages) . if I bind a GEMItem to certain page, i cannot bind it to a different one afterwards.

any hints about this? is it a known limitation? thanks!

Spirik commented 2 years ago

Hi, Manuel! Wow, that's a really big menu you have there=)

Unfortunately, indeed, there is a limitation caused by inner implementation: Menu Item can not be nested inside multiple Menu Pages at the same time. This is due to the fact that GEMItem stores internally a pointer to the parent GEMPage and a pointer to the next GEMItem on that page, thus forming a linked list of menu items. So it can not be a part of a multiple linked lists at the same time.

manuelgonzalvez commented 2 years ago

Thanks!