[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 

How can I catch menuItem selection change events? RSS feed
Forum Index » tcMenu Arduinio library
Author Message
Frank


Joined: Sep 11, 2020
Messages: 1
Location: Germany
Offline
Good evening Dave,

great library family, love it very much!

Is there a simple way to catch more user activity in the menu selection process?
I.e. callbacks for "MenuItem changed" or "MenuItem opend for Edit" etc ....

Use case: depending on the selected menu you might want to switch on/off an led ... just an example


Thank you for your help, much appreciated
davetcc


Joined: Jan 19, 2019
Messages: 159
Offline
Hi there,

Thanks for using the library, and the compliment.

There's a couple of callbacks that you can use to determine when things have changed. But at the moment we don't have one for edit started. However, I think that would be easy to add, please add an issue in tcMenuLib https://github.com/davetcc/tcMenuLib and I'll try and do it in a patch release, as it shouldn't be much work.

What you can do now:

Every menu item supports a callback, you can set these in the designer, and the function gets called with each an every change, for an integer edit this could be a lot of times.

You can in addition to this, add a commit handler in menuMgr, this gets called once when editing stops:

void setItemCommittedHook([](int id) {
  // do your commit code here.
});



I guess we could do something along the lines of:

void setItemEditStarting([](int id) {
  // do your edit start code here.
});


 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer