SelectionType of Mousebutton is empty
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Barbara Kammerl
il 1 Ott 2021
Commentato: Barbara Kammerl
il 1 Ott 2021
Hello!
For context: i'm a beginner and want to design an app in Matlabs App Designer where the user needs to click on a small image in the apps window (which is otherwise empty). There needs to be two different actions weather the right or left mousebutton is pushed. With the right mousebutton there should'nt be any difference weather the mouse is positioned above the image or not.
I found several solutions that use 'get' to get the 'SelectionType' in the function WindowButtonDownFcn. However in my case whatever i push wherever i am, the resulting variable 'clickType' is instead of 'alt' or 'normal' just an empty 0x0 double value. What am i doing wrong? Is there a way i can just add a different callback function for the right mouseclick? Or is there maybe a more elegant way to approach this?
Thanks in advance!
function WindowButtonDownFcn(app, event)
figHandle = ancestor(app, 'figure');
clickType = get(figHandle, 'SelectionType');
if strcmp(clickType, 'alt')
% Do something for right Mouseclick
else
% Do something else
end
end
0 Commenti
Risposta accettata
Steven Lord
il 1 Ott 2021
Likely your figHandle variable is empty. If you're looking to determine how the mouse button was pressed in your app window why not ask your app window (whose handle is app) what its SelectionType property value is?
4 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Develop Apps Using App Designer in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!