Dynamically change MenuItem name #379
-
I have the following usecase:
I'd like to customize menu item names, e.g. rename "Sensor 1" to "Sensor (top)", ... but only when some conditions are met. I support multiple usecases in a single firmware and I'd like to make this as flexible as possible. Is it possible to change the actual item name programatically? As an alternative, I could probably define RuntimeMenuItems but besides the name change, I'd like to keep everything as-is, including the EEPROM address. Any hint is much appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
See the dynamicMenuItem example and the core menu item docs, they both describe how to do this. Basically it comes down to choosing the info block in RAM option in designer for those items. |
Beta Was this translation helpful? Give feedback.
-
All is working perfectly. I let TcMenu generate code and then I figured out what to do. Your example just confirmed that I replace the string correctly. |
Beta Was this translation helpful? Give feedback.
-
@davetcc what about project name? It is shown in the top status bar and I'd like to customize its title as well. Is something like this supported? For context, I build a firmware with several flavors. These are part of the same codebase and I apply customizations based on flavor definition. So if there is one flavor, I'll enable some submenus, hide others, apply different display strings etc. Changing project name to flavor name is the last thing I need. It's a nice to have feature. |
Beta Was this translation helpful? Give feedback.
See the dynamicMenuItem example and the core menu item docs, they both describe how to do this. Basically it comes down to choosing the info block in RAM option in designer for those items.