Detecting which mouse button is pressed in a UIFigureWindowButtonDown callback
20 次查看(过去 30 天)
显示 更早的评论
In App Designer, how how can I detect which mouse button (Left, Right, Middle) was pressed in a UIFigureWindowButtonDownUIFigureWindowButtonDown callback?
3 个评论
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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!