BPSoftware.com
Home   Utilities   Purchase   FAQ   Support   Contact        
Shareware Utilities
 APrintDirect
 AIconExtract
 AFile Attribute Manager
Freeware Utilities
 AddrMon
 AFileSync
 ASysIcon
 B&P Table Utilities
 BPACLer
 BPSNMPMon
 BPSNMPUtil
 CharCount
 Delphi® Components
 MacAddr
Miscellaneous
 BPSoftware Blog
 Purchase Shareware
 Support

 Subscribe!

Sunday, May 14, 2006
myCursor Template

Well, for a brief moment, it seems I can come out from underneath the rock mountain that was placed atop my head. The more I use them, the more I like the code templates that are part of BDS® 2006. They can be a great savings when it comes to those repetetive 'code blocks'. Not only is the 'code block' inserted, but you can also have some dynamic content in them as well with the help of good the good ole' SyncEdit.
Generally, when I code a processing procedure/function I prefer to change the cursor to signify that something is 'happening' to the user. I often use the following code:
var
myCursor: TCursor;
begin
myCursor:= Screen.Cursor;
Screen.Cursor:= crHourglass;
try


finally
Screen.Cursor:= myCursor;
end;
end;


This code is simple enough, however it becomes easier with a good old 'scr' template. As you can see creating templates is rather simple and a great time saver.

Labels: ,

posted by Brad Prendergast at 12:00:00 PM
Comments:
John Kaster has also added a nice Try ..except .. finally live template in CodeCentral.
posted by Blogger Brad Prendergast Sunday, May 14, 2006 3:35:00 PM  
I would suggest that almost any template with more than 2 real (non-language-syntax) lines of code has the potential of being a bad template, since that code should be shared instead of generated many times. Sometimes, syntax limitations will prevent this, but for this case, one method of sharing this code for many common cases is documented here. Even that method could be simplified to a single function call with no params and a single variable per use if you don't need to support multiple cursor types.
posted by Anonymous Erik Monday, May 15, 2006 12:07:00 AM  
Please upload this to CodeCentral! CodeCentral should be the first place BDS users look for user donated Code Templates!
posted by Anonymous Anonymous Tuesday, May 16, 2006 2:46:00 PM  
Links to this post:

Create a Link

Recent Posts
 In time for Easter
 ErrorProvider
 Ho Hum
 Where is the registry in .NET?
 Managing my Newsgroups
 Meaningful Information
 Rock Paper Scissors
 HTML Element
 ARP! ARP!
 Rightly So

 Subscribe!


Labels



Archives
 October 2005
 November 2005
 December 2005
 January 2006
 February 2006
 March 2006
 April 2006
 May 2006
 June 2006
 July 2006
 August 2006
 September 2006
 December 2006
 January 2007
 February 2007
 March 2007
 September 2007
 October 2007
 November 2007
 July 2008
 November 2008
Powered by Blogger