Disabling Cntrl+Left Click = Right Click

Apparently Matlab evaluates the following events as identical (within a callback function designed to handle mouse buttondown events):
Control + Left click => 'alt'
Right click => 'alt'
They are indistinguishable. Is there any way to have the following operation instead:
Control + Left click = 'normal', just with a control modifier on the figure
Right click = 'alt'?
Thank you!

回答 (1 件)

Robert Cumming
Robert Cumming 2014 年 7 月 28 日

0 投票

You can use the keypressfcn to register if ctrl is pressed and modify your call back in. I'd mouse button

2 件のコメント

Stephen
Stephen 2014 年 7 月 28 日
Either I don't understand your answer, or that doesn't quite work out for me. What I'm seeing is this:
When clicking:
control + Right Mouse Button
I see SelectionType as 'alt', modifier 'control', within the callback; exactly what I would expect.
When clicking:
Control + Left Mouse Button
I again see SelectionType as 'alt' (even though left mousebutton was used), and modifier of 'control'. In other words, I don't understand any way to distinguish between the two events and modify the callback in. I am trying to do one action on Control+RightClick and a completely different action on Control+LeftClick
Based on the docs, this operation seems to be a feature (somehow...): http://www.mathworks.com/help/matlab/ref/figure_props.html (under SelectionType).
Robert Cumming
Robert Cumming 2014 年 7 月 28 日
I'm not near a copy of Matlab just now, but you should be able to use the keypressfcn to register if a key is pressed. Link that with your mouse call back to distinguish the difference between the two modes.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

質問済み:

2014 年 7 月 28 日

コメント済み:

2014 年 7 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by