Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » Disable / hide menu item.

Author: davetcc
26/12/2019 09:49:44
I’ve actually been thinking of this for a while and it’s just slipped through the cracks of each release.

This isn’t implemented at the moment but is trivial to implement, I can add this to the next release that is due out in a few days time.

Could you feed back with how you think it would work:

My thoughts are:

Disable flag: stop editing and grey out on graphical displays, show remotely as greyed out.
Visible flag: completely remove item from display and remote.

Author: davetcc
26/12/2019 09:50:42
Is it possible to hide a menu item at runtime that has been created using the Menu designer?

To outline my use case -

- I am reporting the value of several sensors on the menu, however, each installation may or may not use all sensors.
- I would therefore like to hide menu items that are not used.
- Sensors are enabled / disable via a simple configuration file within the code so we already know whether the sensor is in use or not.

I guess what would be good, is something along the lines of

view source

print?
1 menuFoo.disable


I've had a look through the API but cannot see such a function.

Is it possible to do what I am trying to do?

With thanks in advance.

/DM

Author: DeeEmm
26/12/2019 09:56:21
Yes, I think that would work very well.

For my immediate use case I just want to completely remove the item from the display, but I can also foresee other uses where it might be good to simply 'grey it out' but keep it visible.

/DM

Author: davetcc
27/03/2020 09:12:31
We are finally (after a couple of months of significant effort) at the point where we can release 1.4 of the library, this version will include visibility, that works both locally on the menu and remotely.

TcMenuLib - the library itself has now got support for this on master, and the UI's will be following along very shortly, probably within a week or so.

In terms of enabled status: There is already a method of making something non-editable, set the read-only flag. In a future version, we could give the option of a different rending color for this.

Limitations:

If you change the visibility of an item after the display has been initialized (think after setupMenu() in setup), you must completely refresh the menuMgr by calling setCurrentMenu() with whatever menu you want to display (or the root menu). See the examples, keyboard ethernet and Ada32 Ethernet have been updated with this support. Also, the changes will only take effect remotely after a new remote connection.

Edit - link to tcMenuLib: https://github.com/davetcc/tcMenuLib

Author: davetcc
04/05/2020 16:28:42
This is now available in both the Windows store and Java designer versions. There's a few major changes in 1.4.1, but you can easily go back to 1.3.5 in the event of issues.

https://github.com/davetcc/tcMenu/releases/tag/1.4.1




Register / Login  |  Desktop view  |  Jump to top of page