IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► eMag   Print This    All Groups  
View Group Edition:
Full Edition Your Edition || Prev Next || Subscription Center

Prestwood IT Newsletter Feb 2012 Issue - Delphi Edition

Subscribe!

Start subscribing now! It's free!

Each month on or after the 1st, and only once a month, we will send you content from up to 5 community groups. If you select this Delphi group, you'll receive the following content below mixed in with the other groups you elect to include.

Prestwood eMag
Our monthly opt-in coupons+newsletter.
portal.prestwood.com
  February 2012 - Delphi Edition (762 of 4,803 subscribers receive this group's content.) Year 14 Issue 2  
Your full service technology partner!
From The Editor

Prestwood IT Wins Best of Citrus Heights 2011

Prestwood IT received two Best of Citrus Heights 2011 plaques at the annual Best Of luncheon. Prestwood IT won for best company in both Web Design and Computer Services categories. The event was sold out with over 150 attending.



Expert guidance from working professionals!




 Delphi Group Top 
Visit Group | My Group Settings
Language Details topic (classic post):
Using MessageBox
by Mike Prestwood
MessageBox is similar to ShowMessage but gives you more control over how it displays. This one is a favorite of developers because it is a Windows API function wrapped in a Delphi method. This is important because many Windows development languages support the MessageBox function.

Language Basics topic (classic post):
Delphi Parameters (var, const)
by Mike Prestwood

Object Pascal allows parameters of the same type to be listed together, separated by commas, and followed with a single data type (more params of different data types can follow, after a semi-colon). The default for parameters is by value. For by reference, add var in front of the parameter. Object Pascal also offers constant parameters where you add const in front of the parameter. A constant parameter is like a local constant or read-only parameter the compiler can optimize. You cannot assign a value to a constant parameter, nor can you pass one as a var parameter to another routine.


 Monthly Delphi Lesson
Language Basics Topic:
Code Snippet of the Month

In Delphi, you define constants similar to how you define variables but use the Const keyword instead of the Var keyword. Declare global constants in a unit's interface section and unit constants (scope limited to unit) in the implementation section. Declare local constants above the begin..end block.

Const 
  kFeetToMeter: Double = 3.2808;
  kMeterToFeet: Double = .3048;
  kName: String = "Mike";
 
//Local constants:
procedure SomeProcedure;
const
  kPI: Double=3.1459;
begin
end;
OOP Topic:
Definition of the Month: Strict Visibility
The Strict specifier tightens up the scope for private and protected. With Strict Private, members within a class are visible ONLY within the class declared and Strict Protected are visible only within the class declared and descendent classes. Without strict, private and protected members can also be seen by all classes declared in the same unit (friendly classes). The Strict specifier was introduced with Delphi for .Net preview in Delphi 7 in an update to the .Net compiler preview and with Win32 in Delphi 2005 to fully comply with the .NET CLS. Delphi's traditional private specifier maps to the CLR's assembly visibility and the protected specifier maps to the CLR's assembly or family visibility.
Delphi for Win32 Topic:
Resource Link of the Month: GExperts

I recommend GExperts for one simple reason: I'm addicted; I can't live without it.

GExperts is a collection of incredibly useful plug-ins for the Delphi IDE. There are too many to list, so I'll mention just a couple of my favorites:

Replace Components: Select one or more controls on a form, choose GExperts "Replace Components," and you're presented a dialog that allows you to select a replacement component from a very smart drop-down. As GExperts replaces the selected component(s), it also preseves as many properties as possible.

Component to Code: Select a component on one of your forms or data modules, select GExperts "Component to code," and all the code necessary to create that component in explicit code is magically placed on the clipboard.

MessageDlg builder: While in the Delphi code editor, simply hit Crl-D. GExperts pops up a dialog in which you can type in text to be displayed, choose which buttons to include, choose an icon for your MessageDlg, and even test it. Clicking OK inserts the appropriate MessageDlg call right into your code.

Oh. Did I mention that GExperts is free? Don't start Delphi again without first downloading and installing GExperts. You'll be hooked, too.

OOP Topic:
Question: Why do I have to specify virtual when creating an abstract method? Why not just abstract?

Answer:

For abstract methods, you must specify either regular virtual with the virtual keyword or dynamic virtual with the dynamic keyword. In Delphi for Win32, virtual methods are optimized for speed and dynamic methods are optimized for size. The Delphi help indicates to use virtual for most situations. 

It is true that the compiler could make virtual the default and therefore optional but requiring one or the other is consistent with Object Pascal's strong typing.

Using Data Topic:
Tip of the Month
Before adding many new entries to a TStringList, set its Sorted property to false. Add all your entries. Finally, set the Sorted property back to True (if desired). Sorting is expensive, in terms of macnine cycles. By leaving the Sorted property set to True, you force the TStingList to re-sort itself after each entry. This can significantly slow things down. This applies to TStrings, as well, and all components that have a TStrings property, like TListBox, etc.


Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2021 Prestwood IT Solutions.   [Security & Privacy]