Ask Your Question
0

Detecting Mouse wheel delta at the same time as a CTRL key

asked 2017-02-18 14:39:13 -0600

JimboStlawrence gravatar image

Hi,

Thanks to LBerger for his/her reply to my query last night (can't post the link).

I can't reply/send thanks for another day because of "new-user rules".

The above worked, but I've now hit a new issue. I can happily detect mouse_move and ctrl/shift/alt keys combinations, but not together with the mouse_wheel delta.

Normally, one might use something like:

 if ( event == EVENT_MOUSEMOVE && flags == EVENT_FLAG_ALTKEY)

but this doesn't work with MOUSEWHEEL

 if (event == cv::EVENT_MOUSEWHEEL && flags == cv::EVENT_FLAG_CTRLKEY)

I think this might be something to do with MOUSEWHEEL using the flags variable. Is there any other way to do this, as I'd like to use the MOUSEWHEELto do more than one thing depending on which key combination is pressed at the same time as rolling the mousewheel...

Best,

Jimbo

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-02-18 15:09:43 -0600

LBerger gravatar image

updated 2017-02-18 15:15:26 -0600

You can't do like this because there is another value in flags variable . you have to use binary operator :

if (event ==cv::EVENT_MOUSEWHEEL && (flags & cv::EVENT_FLAG_CTRLKEY))

flag is used to store mouse wheel delta too

you can do like this too :

 if (event ==cv::EVENT_MOUSEWHEEL && (flags&0xFFFF==cv::EVENT_FLAG_CTRLKEY))
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-18 14:39:13 -0600

Seen: 1,625 times

Last updated: Feb 18 '17