[comp.sys.mac.programmer] How do you find out what the current cursor is?

ari@eleazar.dartmouth.edu (Ari Halberstadt) (01/29/91)

Don't ask me why I need to know this (I can't tell you since the
product isn't released yet). I simply have to find out the pattern for
the current cursor so I can save it, do some processing, and finally
restore it.  Thanks in advance.

gourdol@imag.imag.fr (Arnaud Gourdol) (02/01/91)

In article <1991Jan28.190943.6152@dartvax.dartmouth.edu>
ari@eleazar.dartmouth.edu (Ari Halberstadt) writes:
>Don't ask me why I need to know this (I can't tell you since the
>product isn't released yet). I simply have to find out the pattern for
>the current cursor so I can save it, do some processing, and finally
>restore it.  Thanks in advance.

I understand why you need to do so, as I had the same need as your.
The solution I had was to use a global variable containing the id of the
current cursor, and define a NSetCursor proc :

procedure NSetCursor(cursorID : integer);
begin
	if gCurrentCursordID = cursorID then
    EXIT(NSetCursor);

{ Do the stuff to set the cursor }
   ...
 gCurrentCursordID := cursorID;
end;

This imply that you avoid calling InitCursor. I think it is possible to access
in some more or less legal way the cursor pattern but what for color cursors
(they are complex structures with pixHandle and such)? And even if YOU do not
use color cursors, the user of your app may use some nice inits that does so.

Also, one important thing about cursors and Multifinder: do not forget to save
and restore your cursor on suspend/resume events.

Ooops. I noted by carefulling between the lines of your post that your product
may well be something else than an application. In that case, I wish you much
fun. Probably a patch or two (SetCursor, SetCCursor and InitCursor) would prove
useful.

Arnaud.