ContextMenu for each ListBoxItem

3 vues (au cours des 30 derniers jours)
Cyrano Chatziantoniou
Cyrano Chatziantoniou le 1 Avr 2021
Commenté : J. Alex Lee le 1 Avr 2021
Hi, I'd like to create a ContextMenu for a ListBox in my app where the callbacks are aware of which item in the ListBox was selected. Is there a way to create the ContextMenu for each item, or can I only do it for the entire ListBox?
If the latter, how could I figure out which item I chose when entering the menu?
  6 commentaires
J. Alex Lee
J. Alex Lee le 1 Avr 2021
@Cyrano Chatziantoniou, for example another list box that dynamically populates depending on the value of the first list box would be a simple one. I think the number of clicks would be the same as your original idea, but maybe you have to move the mouse cursor a little bit farther away...
anyway it's hard to know without knowing more about what you want to accomplish
J. Alex Lee
J. Alex Lee le 1 Avr 2021
actually, the context menu itself can be nested, so probably the most obvious way would be just to start with a context menu and use context menus all the way down...but again, depends on what exactly the behavior/outcome is that you are after.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 1 Avr 2021
Modifié(e) : Jan le 1 Avr 2021
For the Java based listboxes in figures (not uifigures), see: https://undocumentedmatlab.com/articles/setting-listbox-mouse-actions
  1 commentaire
Bruno Luong
Bruno Luong le 1 Avr 2021
Pitty that a lot of java-based tricks from undocumented matlab won't work with MATLAB app.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by