Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 6 - Dialog Manager / Dialog Manager Reference
Dialog Manager Routines / Manipulating Items in Alert and Dialog Boxes


FindDialogItem

To determine the item number of an item at a particular location in a dialog box, use the FindDialogItem function. The FindDialogItem function is also available as the FindDItem function.

FUNCTION FindDialogItem (theDialog: DialogPtr; thePt: Point) 
                         : Integer;
theDialog
A pointer to a dialog record.
thePt
A point, specified in coordinates local to the dialog box.
DESCRIPTION
If the point specified in the parameter thePt lies within an item, FindDialogItem returns a number corresponding to the position of that item in the dialog box's item list resource. If the point doesn't lie within the item's rectangle, FindDialogItem returns -1. If items overlap, FindDialogItem returns the item number of the first item, in the item list resource, containing the point.

This function is useful for changing the cursor when it's over a particular item.

The FindDialogItem function returns 0 for the first item in the item list resource,
1 for the second, and so on. To get the proper item number before calling the GetDialogItem or SetDialogItem procedure, add 1 to FindDialogItem's
function result, as shown here:

theItem := FindDialogItem(theDialog, thePoint) + 1;
Note that FindDialogItem returns the item number of disabled items as well as enabled items.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996