home *** CD-ROM | disk | FTP | other *** search
- gadutil.library/GU_CoordsInGadBox gadutil.library/GU_CoordsInGadBox
-
- NAME
- GU_CoordsInGadBox -- Check if a coordinate pair is within a gadget.
-
- SYNOPSIS
- IsInBox = GU_CoordsInGadBox(coords, gad)
- D0,SR(Z) D0 A0
-
- BOOL GU_CoordsInGadBox(ULONG, struct Gadget *);
-
- FUNCTION
- Check if a coordinate pair is within a gadget's border. This
- function may be used to make coordinate sensitive AppWindows
- (allows the user to drop a file on a string gadget etc.).
- To use this function, you must save the coordinates from the
- recieved message (AppMessage, IntuiMessage) to have something
- to compare against.
-
- INPUTS
- coords - a combined LONG of both the X and Y coordinates to
- compare against. The X coordinate should be in the
- upper word of the parameter.
-
- gad - the gadget to check the coordinates against.
-
- RESULT
- IsInBox - TRUE if both given coordinates was within the gadget's
- outer box (X coord is between gadx and gadx+gadw,
- Y coord is between gady and gady+gadh). Otherwise this
- function will return FALSE.
-
- EXAMPLES
- Assembly language:
- move.l am_MouseX(a0),d0 ; Get X and Y coordinates
- move.l mystrgad(pc),a0
- move.l GadUtilBase(pc),a6
- jsr _LVOGU_CoordsInGadBox(a6)
- beq.b .notinbox ; Not in gadget box
-
- ; Do what you want to do if the coordinates are
- ; within the gadget box
- .notinbox:
- ; Here, you may want to check for some other gadgets
-
-
- C:
- long coords;
- coords = (LONG)appmsg->MouseX << 16 | appmsg->MouseY;
- if (CoordsInGadBox(coords,mystrgad) = TRUE)
- {
- /* Do what you want to do if the coordinates
- are within the gadget box */
- }
- else
- {
- /* Here, you may want to check for some other
- gadgets */
- }
-