Review of Delphi 2010 in TechRepublic
You can read a nice review of Delphi 2010 in TechRepublic.
Summary
If you want to do Windows development, and you want to work with native code in a native style, I think that Delphi 2010 is a very productive tool. It combines a lot that really saves time (such as DataSnap and IDE Insight) with the power and flexibility of native code. If you need support for certain functionality (especially touch-related items), it is the only shipping product on the market that does these things.
Every time I work with the Embarcadero team, I feel like they are writing the tools that they would love to use; they really are “developers’ developers,” and they understand the development process very well and implement it as tools quite nicely.
If you don’t mind learning a new system, a new language, and a new way of doing things, Delphi 2010 is worth a long look for .NET and Visual C++ developers.
Delphi 2010
Plateau for MonoTouch
Plateau is a new component library for MonoTouch. Its original intent was to provide table cells that work more or less like the Settings app, for those who want to put a settings page inside their application.the Plateau library is written in Delphi Prism, the premiere Object Pascal language for .Net and Mono. Plateau is licensed under the BSD license.



Whole Word Search Function in Delphi
To search a whole word in a string, you can use the SearchBuf function declarated in the StrUtils.pas unit .
function SearchBuf(Buf: PAnsiChar; BufLen: Integer; SelStart: Integer; SelLength: Integer; SearchString: AnsiString; Options: TStringSearchOptions): PAnsiChar; overload;
Buf is the text buffer to search.
BufLen is the length, in bytes, of Buf.
SelStart is the first character of the search when Options indicates a backward search (does not include soDown). The first character in Buf has position 0.
SelLength is the number of characters after SelStart that the search begins when Options indicates a forward search (includes soDown).
SearchString is the string to find in Buf.
Options determines whether the search runs forward (soDown) or backward from SelStart or SelStart+SelLength, whether the search is case sensitive (soMatchCase), and whether the matching string must be a whole word (soWholeWord).
If SearchBuf finds a match, it returns a pointer to the first character of the matching string in Buf. If it does not find a match, SearchBuf returns nil (Delphi) or NULL (C++).
The next function return true or false if find a word in a string.
function ExistWordInString(aString:PWideChar;aSearchString:string;aSearchOptions: TStringSearchOptions): Boolean; var Size : Integer; begin Size:=StrLen(aString); result := SearchBuf(aString, Size, 0, 0, aSearchString, aSearchOptions)<>nil; end;
Use it this way
Case-insensitive
ExistWordInString('Go Delphi Go','Delphi',[soWholeWord,soDown]); //Return True
ExistWordInString('Go Delphi, Go','Delphi',[soWholeWord,soDown]); //Return True
ExistWordInString('Go ,Delphi, Go','Delphi',[soWholeWord,soDown]); //Return True
ExistWordInString('Go DELPHI Go','Delphi',[soWholeWord,soDown]); //Return True
ExistWordInString('Go Delphi Go','Delphi',[soWholeWord,soDown,soMatchCase]); //Return True
ExistWordInString('Go DELPHI Go','Delphi',[soWholeWord,soDown,soMatchCase]); //Return False
ExistWordInString('Go DelphI Go','Delphi',[soWholeWord,soDown,soMatchCase]); //Return False
Delphi 2010 Help Update 1 released
Embarcadero has released the Delphi 2010 Help Update 1. you can find more info here.
Improvements in Help Update 1
In the VCL:
- Documentation has been completed for the StdConvs unit.
- Documentation has been completed for the GestureMgr unit, which was new in the RTM release.
- Documentation has been added for the following new units:
- Documentation has been added for many of the DataSnap APIs. See the DSConnect, DSHTTP, DSProd, and DSServer units.
- New resurfaced intrinsic ROUTINES are documented.
- The documentation team has fixed approximately 25 bugs reported on customer forums and in direct customer feedback.
In the IDE topics:
- The documentation team has fixed approximately 20 bugs reported in QC, RAID, or direct customer feedback.
- The View > History command is now documented.
ShineOn 1.0.1.0 released
ShineOn is a library to assist porting Delphi/Win32 and Delphi for .NET projects to Delphi Prism by providing a subset of RTL and core VCL classes that can be used instead of replacing all RTL/VCL calls with native FCL alternatives.
ShineOn is an open source effort, More information can be found in the Prism Wiki, here.
You can download ShineOn from Here
Bye.
Convert Enum to String using Delphi
To convert a Enum type in a string, you can use the GetEnumName function declarated in the TypInfo unit.
See this example
uses TypInfo; type Language = (Delphi,Delphi_Prism,CBuilder); var StrLanguage : String; begin StrLanguage := GetEnumName(TypeInfo(Language),integer(Delphi)) ; end;
Convert String to Enum using Delphi
To convert a string in a Enum type, you can use the GetEnumValue function declarated in the TypInfo unit.
See this example
uses TypInfo; type Language = (Delphi,Delphi_Prism,CBuilder); var aLanguage : Language; begin aLanguage := Language(GetEnumValue(TypeInfo(Language),'CBuilder')) ; end;
Convert String to Enum using Delphi Prism
To convert a string in a Enum type, you can use the Enum.Parse function.
See this example
type Language = (Delphi,Delphi_Prism,CBuilder); var aLanguage : Language := Language(Enum.Parse(typeof(Language), 'Delphi', true));
Blaise Pascal Magazine #8 is available now
A new edition of Blaise Pascal Magazine is available

- Delphi 2010 – what a feeling! – Bob Swart page 7 - Gestures could be the new ’must’ in our computers future
- Counters – David Dirkse page 11 – Learning counting again, – could wel be a hobby…
- Virus in Delphi? – Nick Hodges page 14 – Nick explains how to get rid of the virus and block it.
- Dezign for databases – Marco Roessen page 16 - A fantastic alternative for its expensive competitors, and it’s even cheaper.
- Changing the looks of T-Field – Henk Schreij page 18 – Diving deeper into the possibility’s
- Using Free Pascal and Lazarus to create applications for OSX – Jeremy North page 20 – Working on the Mac is hot
- Writing Delphi Components II: Custom Properties and Windows Controls – Marco Cantù page 22 – In the new Delphi versions it looks all different.
- My Top Five Delphi 2010
- New Features – Pawel Glowacki page 24 - Except for guestures ther is a lot of news…
- Fast Graphic deformation by using Scanlines – Peter Bijlsma page 28
- Control your own image or blow it up! Berlusconi on the edge
- Wide Information Bus (Introduction) – Fikret Hasovic page 33 - What is it and what the use for it?
- Freehand Drawing (Introduction) – David Dirkse page 36 - shows how to create your own paint program
Detect Aero Glass using Delphi
To detect if Aero Glass is enabled we must use the DwmIsCompositionEnabled function.
See this example
program DetectAeroDelphi;
{$APPTYPE CONSOLE}
//Author Rodrigo Ruz 2009-10-26
uses
Windows,
SysUtils;
function ISAeroEnabled: Boolean;
type
_DwmIsCompositionEnabledFunc = function(IsEnabled: PBoolean): HRESULT; stdcall;
var
Flag : Boolean;
DllHandle : THandle;
OsVersion : TOSVersionInfo;
DwmIsCompositionEnabledFunc: _DwmIsCompositionEnabledFunc;
begin
Result:=False;
ZeroMemory(@OsVersion, SizeOf(OsVersion));
OsVersion.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO);
if ((GetVersionEx(OsVersion)) and (OsVersion.dwPlatformId = VER_PLATFORM_WIN32_NT) and (OsVersion.dwMajorVersion >= 6)) then //is Vista or Win7?
begin
DllHandle := LoadLibrary('dwmapi.dll');
if DllHandle <> 0 then
begin
@DwmIsCompositionEnabledFunc := GetProcAddress(DllHandle, 'DwmIsCompositionEnabled');
if (@DwmIsCompositionEnabledFunc <> nil) then
begin
DwmIsCompositionEnabledFunc(@Flag);
Result:=Flag;
end;
end;
FreeLibrary(DllHandle);
end;
end;
begin
try
if ISAeroEnabled then
Writeln('Aero Glass enabled')
else
Writeln('Aero Glass disabled');
Readln;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end.