Using the mouse scroll wheel

Discussions related to mouse, keyboard, fonts and Graphical User Interface
p_m21987
Posts: 177
Joined: Mon 02 Apr 2018, 21:51

Using the mouse scroll wheel

Post by p_m21987 »

Hello,

I've been wondering, how do you check if the user has rolled the scroll wheel? I know it's possible since SDLIDE allows you to scroll by turning the wheel, but I had a look through the SDLIDE code and couldn't immediately recognise anything that looked like it was checking the wheel.

I also looked at the BB4W manual, but the information I could find about the mouse didn't seem to mention the wheel.

Does anyone know?

Thanks.
PM
DDRM

Re: Using the mouse scroll wheel

Post by DDRM »

Hi Patrick,

You can read the mouse scroll wheel with GET or INKEY: wheel up returns 140, and wheel down returns 141.

Best wishes,

D
p_m21987
Posts: 177
Joined: Mon 02 Apr 2018, 21:51

Re: Using the mouse scroll wheel

Post by p_m21987 »

Hi DDRM,

Thanks for the information. This reminds me of another question I had on mind recently. Once you've read a key from the keyboard buffer with GET, is it possible to re-insert that key value back into the keyboard buffer?

It's probably not good programming/design practice, but I have two different routines for handling mouse input and keyboard input. I'd like my mouse routine to check for mouse wheel events in the keyboard buffer, take only those events, and then put back into the keyboard buffer everything else that was in there that wasn't a mouse wheel event, so that my keyboard routine can work on those separately.

Patrick
KenDown
Posts: 327
Joined: Wed 04 Apr 2018, 06:36

Re: Using the mouse scroll wheel

Post by KenDown »

The Wiki contains (or contained) a couple of methods for "typing" key presses into the input buffer. Whether any of them would work with non-ascii characters I'm not sure.

I have been able to fudge the issue by having PROCdialog1 and PROCdialog2 which are called depending on where the click or keypress is coming from. Then, if I want to insert my own click or keypress I simply use
click%=123:PROCdialog1
or
key%=141:PROCdialog1

It's not elegant but it works.