Page 1 of 1

(Solved) Message structure of GM_HANDLESCROLL ?

Posted: Thu Feb 11, 2016 5:52 pm
by TSK
What is the message structure GM_HANDLESCROLL receives in a BOOPSI class dispatcher ?

Re: Message structure of GM_HANDLESCROLL ?

Posted: Thu Feb 11, 2016 7:06 pm
by broadblues
Same as GM_HANDLEINPUT GM_GOACTIVE etc

Re: Message structure of GM_HANDLESCROLL ?

Posted: Thu Feb 11, 2016 8:38 pm
by TSK
So it's struct gpInput. But how do I get how much wheel was rotated and to which direction ?

Re: Message structure of GM_HANDLESCROLL ?

Posted: Thu Feb 11, 2016 11:10 pm
by tonyw
Is that the best way to do it?

I use the IDCMP Hook function and collect IDCMP_EXTENDEDMOUSE messages. They appear as a struct IntuiMsg, which gives the data like this:

Code: Select all

		case	IDCMP_EXTENDEDMOUSE:
			code = intuiMsg->Code;
			qual = intuiMsg->Qualifier;

		//	check that mouse is over the window and ignore if not
			if ((intuiMsg->MouseX < 0) ||
				(intuiMsg->MouseX > win->Window->Width) ||
				(intuiMsg->MouseY < 0) ||
				(intuiMsg->MouseY > win->Window->Height))
			{
				break;
			}
			wheelData = (struct IntuiWheelData *)intuiMsg->IAddress;

			if ((code == IMSGCODE_INTUIWHEELDATA) && (wheelData != NULL))
			{
				deltaY = wheelData->WheelY;
			}
(etc)

Re: Message structure of GM_HANDLESCROLL ?

Posted: Fri Feb 12, 2016 2:00 pm
by broadblues
TSK wrote:So it's struct gpInput. But how do I get how much wheel was rotated and to which direction ?
Heres an incomplete fragment from a HandleInpt function.that should give a hint as to how to procede.

Code: Select all

		switch(gpi->gpi_IEvent->ie_Class)
		{
#if defined(__amigaos4__)
			case IECLASS_MOUSEWHEEL:
				{
							if(gpi->gpi_IEvent->ie_Qualifier & (IEQUALIFIER_RSHIFT | IEQUALIFIER_LSHIFT))
							{
								igd->igd_Top += gpi->gpi_IEvent->ie_Y *  ((struct Gadget *)o)->Height;
							}
							else
							{
								igd->igd_Top += gpi->gpi_IEvent->ie_Y * 8;
							}
							if(igd->igd_Top < 0)
							{
								igd->igd_Top = 0;
							}
							if(igd->igd_Top + ((struct Gadget *)o)->Height > igd->igd_Height)
							{
								igd->igd_Top = igd->igd_Height - ((struct Gadget *)o)->Height; 
							}

						}
					}
					retval = GMR_MEACTIVE;
				}
				break;
#endif

Re: Message structure of GM_HANDLESCROLL ?

Posted: Fri Feb 12, 2016 2:03 pm
by broadblues
tonyw wrote:Is that the best way to do it?
Definetly if you need to write a gadget that supports scrolling via the mouse wheel when being hovered over and not actually the active gadget.

If you are writing an app that needs to scroll an area independant of mouse posistion, then you way is good too.

Re: Message structure of GM_HANDLESCROLL ?

Posted: Fri Feb 12, 2016 5:10 pm
by TSK
@broadblues, tonyw

I got it working. I forgot I had the related code in my input handler already.

Thanks both of you !