How to create different callbacks for left and right click on a figure object?
59 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 23 Mar 2012
Modifié(e) : MathWorks Support Team
le 7 Juil 2020
I have an axes and I wish to execute two different functionalities on left and right click on the figure.
For example, when I right click I want to the open the UICONTEXT MENU, and when I left click I want the figure to update with new data, or open another GUI.
Currently, when I right click it open the UICONTEXT menu and also fires open a new GUI.
How do I create different functionalities for the left and right click of the mouse?
Réponse acceptée
MathWorks Support Team
le 14 Sep 2020
Modifié(e) : MathWorks Support Team
le 7 Juil 2020
The figure contains the 'SELECTIONTYPE' property which changes depending up on the type of click and ENABLE property of the particular UICONTROL/ figure object.
Detailed description of values that this property can take can be found at the following link in the documentation:
In your GUI, create cases in the BUTTONDOWNFCN of the UICONTROL/FIGURE OBJECT based on the value of 'SELECTIONTYPE' that you desire so that you can place code for action after left or right clicks in the appropriate case.
I have attached an example to demonstrate this behavior, look at the BUTTONDOWNFCN of the AXES. Here the figure does not fire the action for left click on a right click event.
I have also attached an example that demonstrates how to do this for other objects, such as a line object.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks 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!