(Solved) Message structure of GM_HANDLESCROLL ?

This forum is for general developer support questions.

(Solved) Message structure of GM_HANDLESCROLL ?

Postby TSK » Thu Feb 11, 2016 6:52 pm

What is the message structure GM_HANDLESCROLL receives in a BOOPSI class dispatcher ?
Last edited by TSK on Fri Feb 12, 2016 6:10 pm, edited 1 time in total.
Keep the party going !
User avatar
TSK
Beta Tester
Beta Tester
 
Posts: 219
Joined: Mon Dec 20, 2010 2:15 pm
Location: Home land of Santa C., sauna, sisu and salmiakki

Re: Message structure of GM_HANDLESCROLL ?

Postby broadblues » Thu Feb 11, 2016 8:06 pm

Same as GM_HANDLEINPUT GM_GOACTIVE etc
User avatar
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Message structure of GM_HANDLESCROLL ?

Postby TSK » Thu Feb 11, 2016 9:38 pm

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

Re: Message structure of GM_HANDLESCROLL ?

Postby tonyw » Fri Feb 12, 2016 12:10 am

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
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 1314
Joined: Wed Mar 09, 2011 2:36 pm
Location: Sydney, Australia

Re: Message structure of GM_HANDLESCROLL ?

Postby broadblues » Fri Feb 12, 2016 3:00 pm

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: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Message structure of GM_HANDLESCROLL ?

Postby broadblues » Fri Feb 12, 2016 3:03 pm

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
broadblues
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 538
Joined: Sat Jun 18, 2011 3:40 am
Location: Portsmouth, UK

Re: Message structure of GM_HANDLESCROLL ?

Postby TSK » Fri Feb 12, 2016 6:10 pm

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


Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 3 guests