Gadget HintInfo

3 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Gadget HintInfo

In my new gadget class I allow setting of GA_HintInfo. I don't know if I am setting it wrong in OM_SET or not doing it right in the dispatcher at GM_HELPTEST. It shows my gadget's hint info for every gadget regardless of what theirs is.

  1.  
  2. case GM_HELPTEST:
  3. // retval=IIntuition->IDoSuperMethodA(cl,o,msg);
  4. // retval=GMR_HELPHIT;
  5. return(GMR_HELPCODE | 0x0000C0DE);
  6. break;
  7.  
  8. case GM_QUERY:
  9. if (((struct gpQuery *)msg)->gpq_Type==GMQ_HINTINFO)
  10. {
  11. *(((struct gpQuery *)msg)->gpq_Data)=(LONG )IDD->HintInfo;
  12. }
  13. // retval=IIntuition->IDoSuperMethodA(cl,o,msg);
  14. retval=GMR_NOREUSE;
  15. break;
salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
Re: Gadget HintInfo

The problem is AFAICT that you don't check that the ie_X and ie_Y coordinates are inside your gadget.

Ideally in your layout function you should have something like (IDD->Container is a struct IBox where your gadget dimensions will be stored):

  1. GadgetBox((struct Gadget *)obj, gpl->gpl_GInfo, GBD_GINFO, 0, &IDD->Container);

And then your GM_QUERY code should look like:

  1. struct gpQuery *gpq = (struct gpQuery *)msg;
  2. if (gpq->gpq_Type == GMQ_HINTINFO)
  3. {
  4. struct InputEvent *ie = gpq->gpq_IEvent;
  5. if (ie != NULL)
  6. {
  7. if (ie->ie_X >= IDD->Container.Left &&
  8. ie->ie_X < (IDD->Container.Left + IDD->Container.Width) &&
  9. ie->ie_Y >= IDD->Container.Top &&
  10. ie->ie_Y < (IDD->Container.Top + IDD->Container.Height))
  11. {
  12. *(gpq->gpq_Data) = (ULONG)IDD->HintInfo;
  13. return GMR_NOREUSE;
  14. }
  15. }
  16. }
  17. return GMR_REUSE;
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Re: Gadget HintInfo

Got it. Thanks.

Log in or register to post comments