FindDItem
FindDItem See which item is at a specified point
#include <Dialogs.h> Dialog Manager
short FindDItem( theDialog, thePoint );
DialogPtr theDialog ; the dialog to query
Point thePoint ; in local coordinates
returns dialog item number-1 (or -1 if none)
FindDItem looks down the dialog's item list to determine which item is
located at the specified point. It can be useful in selecting a cursor type to
match the mouse pointer position.
theDialog is the address of a 170-byte DialogRecord structure. It identifies
which dialog window you wish to check. It is actually a WindowPtr
(a.k.a GrafPtr), normally obtained via NewDialog or
thePoint is a point (a mouse position) in the local coordinates of theDialog .
Returns: a 16-bit integer; one less than the item number of the item
whose enclosing rectangle is at thePoint or -1 if no item is there. If
items overlap, the arithmetically lowest of the item numbers is
returned.

Notes: FindDItem could be used by a function that wants to know which item the
mouse is currently pointing to. The item number is returned whether it is
enabled or not.
Note that TechNote #112 corrects an error in IM. The return value is
0-based, so you must add one to the return value in order to get an item
number for use in subsequent Dialog Manager calls.
Remember to use GlobalToLocal if thePoint is in global coordinates (as
obtained from GetNextEvent). If you use GetMouse, the returned point
is local to the current grafPort; you may need to make sure theDialog is
the active port before calling GetMouse.
In the following example, a dialog filter uses this function to change the
cursor to an iBeamCursor while the mouse is pointing at an editText item.
See ModalDialog for details on dialog filters.
Example
#include <Dialogs.h>
#include
#include
Cursor editCursor;
curH=GetCursor( iBeamCursor );
editCursor = **curH; /* copy image to local variable */
pascal Boolean myDlgFilter( DialogPtr theDlg, EventRecord * theEvent, short
*theItem )
{
short i;
Point mPt;
GetMouse( &mPt ); [TOKEN:12074] theDlg is the active window... */
i=FindDItem( theDlg, mPt ); /* ... so mPt is in local coords */
if ( (i==TEXT_ITM1) || (i==TEXT_ITM2) ) /* is it an editText item ? */
SetCursor( &editCursor );
else
SetCursor( &arrow );
/* ... (etc.) ... */
}