Mouse Button Press distinction

13 views (last 30 days)
Khalid Mahmood
Khalid Mahmood on 15 Apr 2021
Edited: Khalid Mahmood on 19 Apr 2021
SelectionType property of figure tells which mouse button was pressed along with modifier (ctrl or shift).
Normal: Left Mouse Button.
extend: i) Shift+LeftMouseButton OR ii) Middle Mouse Button OR iii) Both Left and Right Buttons
alt: i) CTRL+LeftMouseButton OR ii) Right Mouse button
open: Double Click Any Mouse Button.
1: Why CTRL+LeftMouseButton and CTRL+RightMouseButton return same code in mouse events? Its only in Matlab.
2: I want to distinguish between CTRL+LeftMouseButton and CTRL+RightMouseButton. How to do this?
Khalid Mahmood
Khalid Mahmood on 17 Apr 2021
  1. I forgot that my pupose was to distinguish between CTRL+LeftClick and CTRL+RightClick. Which still remains the issue
  2. I was able to use evt.Key for Keyboard keys and Modifiers (evt.Modifier) using WindowKeyPress/Release functions, which can't be done using WindowButtonDown/Up functions for all keys
Can anybody help me to distinguish between CTRL+Left Mouse Button Click and Ctrl+ Right Mouse Button Click. My code is attached

Sign in to comment.

Answers (1)

Sufia Tanveer
Sufia Tanveer on 19 Apr 2021
I have tested your code. Your code is great work. Matlab developers have somehow missed that distinction of modifier + right mouse button. I have searched help and found you are 💯% correct. What I can say is, it may have not been rectified by developers. That's why nobody else has given you answer.
  1 Comment
Khalid Mahmood
Khalid Mahmood on 19 Apr 2021
I accept your answer, but I am waiting for some senior programmer or matlab staff members to answer to be precise

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by