mrc@Tomobiki-Cho.CAC.Washington.EDU (Mark Crispin) (10/03/89)
I would like to change the cursor in my application to a wait cursor when I know the program is going to do something time-consuming. I didn't see any method in Application that seemed to set the application's cursor. The spec sheet for Cursor didn't seem to be very helpful; the push and pop methods are interesting, but isn't it a bit backwards to be doing this from the cursor instead of the application? [Yes, I know, everything on the NeXT is backwards :-)] What I want to do is something like: [NXApp pushCursor:NXWait]; // save current cursor, put up wait ... time-consuming code -- [NXApp popCursor]; // restore cursor Even better would be some way to say that whenever any button is pushed the wait cursor should be put up until the button's method finishes, or even better, a way to say "put up a wait cursor any time we're not in the event loop"... Mark Crispin / 6158 Lariat Loop NE / Bainbridge Island, WA 98110-2020 mrc@CAC.Washington.EDU / MRC@WSMR-SIMTEL20.Army.Mil / (206) 842-2385 Atheist & Proud / 450cc Rebel pilot -- a step up from 250cc's!!! tabesaserarenakerebanaranakattarashii...kisha no kisha ga kisha de kisha-shita sumomo mo momo, momo mo momo, momo ni mo iroiro aru uraniwa ni wa niwa, niwa ni wa niwa niwatori ga iru
aozer@next.com (Ali Ozer) (10/07/89)
In article <3883@blake.acs.washington.edu> Mark Crispin says: >I would like to change the cursor in my application to a wait >cursor when I know the program is going to do something >time-consuming. > >I didn't see any method in Application that seemed to set the >application's cursor. The spec sheet for Cursor didn't seem to be >very helpful; the push and pop methods are interesting, but isn't it a >bit backwards to be doing this from the cursor instead of the >application? [Yes, I know, everything on the NeXT is backwards :-)] > >What I want to do is something like: > > [NXApp pushCursor:NXWait]; // save current cursor, put up wait > ... time-consuming code -- > [NXApp popCursor]; // restore cursor Cursor's push and pop methods are the way to go; essentially you need to do: #import <appkit/Cursor.h> -methodWhichTakesALongTime:sender { [NXWait push]; ... [NXWait pop]; return self; } To do what you want, you can add the pushCursor: and popCursor methods to your subclass of Application; it's trivial enough if you use the knowledge that you can send "pop" to any cursor, not the one you pushed (This is a feature that will most probably work all the time.): - pushCursor:cursor { [cursor push]; return self; } - popCursor { [NXArrow pop]; // Doesn't matter what cursor, so you can // get away with this... return self; } Ali Ozer, NeXT Developer Support Ali_Ozer@NeXT.com