Rebuild PopUp-menu options when the user clicks to open
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I've tried searching through most of the popup menu-related questions and didn't find anything similar. Essentially, I'd like to be able to dynamically populate a popup menu every time the user clicks it.
My current approach involves setting the menu's Enable property to ' inactive' so that it appears enabled but still calls my ButtonDownFcn callback. The user clicks the inactive menu, my callback reloads/adds options, and then sets the menu's Enable property to ' on'.
The problem is that the user has to click the menu twice to actually get it to open due to changing it's Enable property.
Is there any way to force the menu to open within my ButtonDownFcn callback so that it behaves normally for the user?
4 commentaires
Jan
le 14 Août 2018
I do not understand, what "when the user clicks on it, just before the menu actually opens" exactly means. But I assume, you find the wanted callback in the Java level: https://undocumentedmatlab.com/blog/uicontrol-callbacks
Réponses (1)
Adam Danz
le 13 Août 2018
Modifié(e) : Adam Danz
le 13 Août 2018
Here are some ideas for solution
1) Create a small "refresh" button near the menu; the user can click it to refresh the list of files.
2) Create a timer function that continually checks the directory in the background every 'x' seconds and updates the menu whenever there is an update in the directory.
3) Any time the user interacts with the popup menu, it checks for changes in the directory and updates the list (after the user already clicked - which is weird).
If any of those solutions are viable and you need help getting started, I'd be glad to help.
0 commentaires
Voir également
Catégories
En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!