SETMOUSECURSOR

Graphics Function: Sets the shape of the mouse cursor for the window in focus.

Module:   USE DFLIB
  USE DFWIN

Syntax

oldcursor = SETMOUSECURSOR (newcursor)

newcursor
(Input) INTEGER(4). A Windows HCURSOR value. For many predefined shapes, LoadCursor(0, shape) is a convenient way to get a legitimate value. See the list of predefined shapes below.


A value of zero causes the cursor not to be displayed.

Results:

The result is of type INTEGER(4). This is also an HCURSOR Value. The result is the previous cursor value.

The window in focus at the time SETMOUSECURSOR is called has its cursor changed to the specified value. Once changed, the cursor retains its shape until another call to SETMOUSECURSOR.

In Standard Graphics applications, units 5 and 6 (the default screen input and output units) are always considered to be in focus.

The following predefined values for cursor shapes are available:

Predefined Value Cursor Shape
IDC_APPSTARTING Standard arrow and small hourglass
IDC_ARROW Standard arrow
IDC_CROSS Crosshair
IDC_IBEAM Text I-beam
IDC_ICON Obsolete value
IDC_NO Slashed circle
IDC_SIZE Obsolete value; use IDC_SIZEALL
IDC_SIZEALL Four-pointed arrow
IDC_SIZENESW Double-pointed arrow pointing northeast and southwest
IDC_SIZENS Double-pointed arrow pointing north and south
IDC_SIZENWSE Double-pointed arrow pointing northwest and southeast
IDC_SIZEWE Double-pointed arrow pointing west and east
IDC_UPARROW Vertical arrow
IDC_WAIT Hour glass

A LoadCursor must be done on these values before they can be used by SETMOUSECURSOR.

Compatibility

STANDARD GRAPHICS QUICKWIN GRAPHICS LIB

Examples

! Build as QuickWin
    use dflib
    use dfwin
    integer*4  cursor, oldcursor
    open(8,file='user')

    write(8,*) 'The cursor will now be changed to an hour glass shape'
    write(8,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_WAIT)
    oldcursor = SetMouseCursor(cursor)
    read(8,*)

    write(8,*) 'The cursor will now be changed to a cross-hair shape'
    write(8,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_CROSS)
    oldcursor = SetMouseCursor(cursor)
    read(8,*)

    write(8,*) 'The cursor will now be turned off'
    write(8,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(0)
    read(8,*)

    write(8,*) 'The cursor will now be turned on'
    write(8,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(oldcursor)
    read(8,*)
  stop
  end

! Build as Standard Graphics or QuickWin
    use dflib
    use dfwin

    integer*4  cursor, oldcursor
    write(6,*) 'The cursor will now be changed to an hour glass shape'
    write(6,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_WAIT)
    oldcursor = SetMouseCursor(cursor)
    read(5,*)

    write(6,*) 'The cursor will now be changed to a cross-hair shape'
    write(6,*) 'Hit <return> to see the next change'
    cursor = LoadCursor(0, IDC_CROSS)
    oldcursor = SetMouseCursor(cursor)
    read(5,*)

    write(6,*) 'The cursor will now be turned off'
    write(6,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(0)
    read(5,*)

    write(6,*) 'The cursor will now be turned on'
    write(6,*) 'Hit <return> to see the next change'
    oldcursor = SetMouseCursor(oldcursor)
    read(5,*)

  stop
  end