Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

MousePointer, MouseIcon

These properties let you determine what kind of icon the mouse uses at any given time. You can use any icon you want. If it’s in the set provided, you only need to set MousePointer. To use any other icon, you set MousePointer and MouseIcon.

Usage

oObject.MousePointer = nMousePointer
nMousePointer = oObject.MousePointer

oObject.MouseIcon = cIconFile
cIconFile = oObject.MouseIcon

A value of 0 for MousePointer uses the default for the object. A value between 1 and 14 (12 in VFP 3) chooses one of the standard mouse pointers. Both Help and FoxPro.H contain the list. Most of them are pretty familiar, including the various sizing pointers and the hourglass. A couple of them, though, we’ve never seen in any application we’ve used.

Sometimes, you need a pointer that isn’t in the list. Fortunately, in VFP 5 and later, there’s a way to get one. Set MousePointer to 99 and set MouseIcon to the file you want to use. ICO, CUR and ANI files work, but other kinds of graphics don’t. (You can specify the others, but you won’t see them. They’re ignored.)

Think hard before you use MouseIcon. Remember that users can change pointers in the Mouse applet, and a user may have chosen a particular set of pointers because they’re big enough or dark enough for him to see. An icon you specify may not be visible to every user.

The specified MousePointer doesn't always display the way you expect. For spinners and combo boxes, the desired image displays only when the mouse is over the border or the arrows; the icon is an I-beam when the mouse is over the text area of the controls. For edit boxes, MousePointer is used for the text area but an arrow is used for the scrollbars. In a grid, MousePointer is used only when the mouse is over the border, the record mark column, delete mark column, and the squares in the upper-left and lower-right corners. For controls in a grid, only the control that has focus will show the desired MousePointer.

When an object is being dragged, its DragIcon takes precedence over the MousePointer or MouseIcon of any object you drag it over.

Example

This.MousePointer = 10

#INCLUDE FOXPRO.H
oObject.MousePointer = MOUSE_HOURGLASS

This.MousePointer = 99
This.MouseIcon = HOME(4)+"CURSORS\Bullseye.Cur"

See Also

DragIcon, #Include, MouseMove