Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Determining if the Cursor is Hidden Or Not

Q How do you determine whether the cursor is hidden or not?

A Currently the best way to determine that is to use a low memory global that has been removed from LowMem.h. The reason that it has been removed is that future OS may handle this differently.

Using low-memory globals has never really been approved of but in older interface files, they were documented. However the Universal Interfaces were designed as a way ahead into future operating systems. Access to some low-mems were changed to accessor functions for safety and others were removed. Therefore this means the low-mems without functions were felt to be changeable and no longer safe to use.

The following definitions were taken from an older Interface file:

enum {
    CrsrRect = 0x83C,   /*[GLOBAL VAR]  Cursor hit rectangle [8 bytes]*/
    TheCrsr  = 0x844,   /*[GLOBAL VAR]  Cursor data, mask & hotspot [68 bytes]*/
    CrsrAddr = 0x888,   /*[GLOBAL VAR]  Address of data under cursor [long]*/
    CrsrSave = 0x88C,   /*[GLOBAL VAR]  data under the cursor [64 bytes]*/
    CrsrVis  = 0x8CC,   /*[GLOBAL VAR]  Cursor visible? [byte]*/
    CrsrBusy = 0x8CD,   /*[GLOBAL VAR]  Cursor locked out? [byte]*/
    CrsrNew  = 0x8CE,   /*[GLOBAL VAR]  Cursor changed? [byte]*/
    CrsrState = 0x8D0,  /*[GLOBAL VAR]  Cursor nesting level [word]*/
    CrsrObscure = 0x8D2 /*[GLOBAL VAR]  Cursor obscure semaphore [byte]*/
  };

As you can see, CrsrVis is a flag that tells whether the cursor is hidden or not.

The following routine uses this flag to determine the hidden state of the cursor.

int IsCursorHidden()
{
    int retVal = 0;
    unsigned char cursorVisible;
 
    cursorVisible = *(unsigned char*)CrsrVis;
    if (cursorVisible)
        retVal = 0;
    else
        retVal = 1;
    return (retVal);
}

Updated: 27-September-96