(Solved) Message structure of GM_HANDLESCROLL ?

This forum is for general developer support questions.
Post Reply
User avatar
TSK
Beta Tester
Beta Tester
Posts: 225
Joined: Mon Dec 20, 2010 1:15 pm
Location: Home land of Santa C., sauna, sisu and salmiakki

(Solved) Message structure of GM_HANDLESCROLL ?

Post by TSK »

What is the message structure GM_HANDLESCROLL receives in a BOOPSI class dispatcher ?
Last edited by TSK on Fri Feb 12, 2016 5:10 pm, edited 1 time in total.
Keep the party going !
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Message structure of GM_HANDLESCROLL ?

Post by broadblues »

Same as GM_HANDLEINPUT GM_GOACTIVE etc
User avatar
TSK
Beta Tester
Beta Tester
Posts: 225
Joined: Mon Dec 20, 2010 1:15 pm
Location: Home land of Santa C., sauna, sisu and salmiakki

Re: Message structure of GM_HANDLESCROLL ?

Post by TSK »

So it's struct gpInput. But how do I get how much wheel was rotated and to which direction ?
Keep the party going !
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1479
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: Message structure of GM_HANDLESCROLL ?

Post 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)
cheers
tony
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Message structure of GM_HANDLESCROLL ?

Post 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
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 600
Joined: Sat Jun 18, 2011 2:40 am
Location: Portsmouth, UK
Contact:

Re: Message structure of GM_HANDLESCROLL ?

Post 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.
User avatar
TSK
Beta Tester
Beta Tester
Posts: 225
Joined: Mon Dec 20, 2010 1:15 pm
Location: Home land of Santa C., sauna, sisu and salmiakki

Re: Message structure of GM_HANDLESCROLL ?

Post by TSK »

@broadblues, tonyw

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

Thanks both of you !
Keep the party going !
Post Reply