Detecting which mouse button is pressed in a UIFigureWindowButtonDown callback
显示 更早的评论
In App Designer, how how can I detect which mouse button (Left, Right, Middle) was pressed in a UIFigureWindowButtonDownUIFigureWindowButtonDown callback?
3 个评论
Shubham Gupta
2019-10-23
Did you take a look at the following answer?
Andrei Veldman
2019-10-23
Alexander Melin
2022-7-19
The newer (possibly more elegant) solution uses the event information. Using the UIFigure UIFigureWindowButtonDown callback, the event object passed to the callback has information on the source of the event (mouse click), in this case the UIFigure. Then you can directly access the SelectionType property. For example
% Window button down function: UIFigure
function UIFigureWindowButtonDown(app, event)
switch event.Source.SelectionType
case 'normal'
% Do left button stuff
case 'alt'
% Do right button stuff
case 'extend'
% Do center button stuff
end
end
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!