Using the mouse scroll wheel

Discussions related to mouse, keyboard and Graphical User Interface
Post Reply
Patrick M
Posts: 60
Joined: Mon 02 Apr 2018, 21:51

Using the mouse scroll wheel

Post by Patrick M » Tue 12 Jun 2018, 11:20

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
P.M.

DDRM
Administrator
Posts: 59
Joined: Mon 02 Apr 2018, 18:04

Re: Using the mouse scroll wheel

Post by DDRM » Tue 12 Jun 2018, 11:44

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

Patrick M
Posts: 60
Joined: Mon 02 Apr 2018, 21:51

Re: Using the mouse scroll wheel

Post by Patrick M » Tue 12 Jun 2018, 12:39

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
P.M.

KenDown
Posts: 33
Joined: Wed 04 Apr 2018, 06:36

Re: Using the mouse scroll wheel

Post by KenDown » Mon 25 Jun 2018, 11:29

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.

Post Reply