From: lisch.at.tempest-sw.com@nojunkmail.com (Ray Lischner) Subject: Re: Sand Clock Date: 06 Nov 1999 00:00:00 GMT Message-ID: Content-Transfer-Encoding: 7bit References: <381729E7.184E@sbn2.nottingham.ac.uk> <38185fa3.42955182@news.mia.bellsouth.net> <8mYT3.94$OQ.16947@news.flash.net> Organization: Tempest Software, Inc., Corvallis, Oregon Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: comp.lang.pascal.delphi.misc X-Complaints-To: newsabuse@supernews.com On Fri, 05 Nov 1999 14:54:26 -0800, Tim Roberts wrote: >Then TCursorManager could look something like > >constructor TCursorManager.Create( newCursor: integer ); >begin > iSaveMe := Screen.Cursor; > Screen.Cursor := newCursor; >end; > >destructor TCursorManager.Destroy; >begin > Screen.Cursor := iSaveMe; >end; Even better, use interfaces, and let Delphi restore the cursor automatically, without needing an explicit try-finally. procedure Whatever; var cursor: ICursorManager; begin cursor := TCursorManager.Create( crHourGlass ); end; type ICursorManager = interface procedure SetCursor(Cursor: TCursor); function GetCursor: TCursor; property Cursor: TCursor read GetCursor write SetCursor; end; TCursorManager = class(TInterfacedObject, ICursorManager) constructor Create(Cursor: TCursor); destructor Destroy; override; procedure SetCursor(Cursor: TCursor); function GetCursor: TCursor; end; -- Ray Lischner, http://www.tempest-sw.com/ author of Delphi in a Nutshell