Glenn Crouch from ESB Consultancy just posted about this on the ADUG list. It’s basically a “deal of the day”-type site for Delphi-related tools and components. Right at the moment it has LMD DockingPack at 50% off (for the next few hours anyway). Seems to have a few different vendors promoting their products on it. Worth keeping an eye on I think.
Posts Tagged ‘Delphi’
Searching in Delphi Part 1 : Regular Expressions
Being able to find elements in your code quickly and easily is critical to being productive in any IDE. Spend too long looking for things and you start to lose your train of thought. Over the years Delphi has introduced lots of different ways to search your code, some of them simple text-based matching, some of them much more capable search engines that actually understand the structure of your code. However, I regularly meet developers who aren’t aware of many of them, beyond doing a simple search using the Search | Find (Ctrl-F) menu option, or the same across multiple files using Search | Find in Files (Shift-Ctrl-F).
Delphi/C++Builder 2010 Updates 4 and 5 available
Just an FYI, the Delphi/C++Builder 2010 Updates 4 and 5 are available. These are cumulative, so regardless of whether you installed Update 2, update 1, or nothing, you can install these.
Read Me : http://dn.embarcadero.com/article/40174
Bug List : http://dn.embarcadero.com/article/40204
Install by running “Check for Updates” or downloading from the registered users page.
MS Multitouch Mouse demos – Could be cool for Delphi 2010 Multitouch apps on the desktop.
These could make a lot more sense for multitouch on the desktop than actually reaching out to the screen.
NB: The link has an apostrophe in it, which seems to cause issues with some browsers. Chrome deals ok, but IE not so much.
When you click on the link and it fails, if the last portion of the URL looks like this, 2009-10/microsoft-multitouch-mice-demo’d, try replacing it with this, 2009-10/microsoft-multitouch-mice-demo%E2%80%99d
Worst case, the video (but not the article) is here
Reminder about the Delphi 2010 event in Brisbane Tuesday night
Just a reminder about the Delphi 2010 event in Brisbane tomorrow night. This is kind of the re-start of ADUG Brisbane, so if you are in town, come along and support the group.
Drag-and-drop Gutter Icons in Delphi 2010
Sticking with the theme of small but useful features in Delphi 2010, did you know you can now drag-and-drop various code-editor gutter icons?
Let’s say you’ve set a breakpoint, and right-clicked to adjust its properties, such as pass count, thread, group and various other settings. Then you realise you actually wanted this on a different line instead. In the past you’d have to create a new breakpoint and set all those properties yet again.
Refactoring Support for Attributes in Delphi 2010
I mentioned earlier that a lot of work in this release had gone into smaller features and feature tweaks. One of the results is that the IDE keeps giving me pleasant surprises. I’ll try to do something without even really thinking about whether it should work or not, and find that it not only works, but that it goes a little further than I might have thought.
One example is around Refactoring support for Attributes. If you look at my first, simple example of Attributes, one of the many things wrong with it is that the Attribute name is terrible. Unless I never plan on writing more than one Attribute, MyAttribute is probably not the best choice.
More Attributes in Delphi 2010
In my previous post on Attributes in Delphi 2010, I showed a basic view of the mechanics involved in creating, applying and querying Attributes. I didn’t really cover an example of why you might use them.
Probably the most common example given is for persistence, and indeed, someone over on the Wings of Wind website has posted an example along those lines. I’d like to show off a different use for them: Validation.
Casting an Interface Reference to the Implementing Class in Delphi 2010
Not all the new features in Delphi 2010 are big. In fact, the team have spent a lot of time implementing many small features, fixes and tweaks. Some of these may not seem to amount to much individually, but they not only add up to significant impact, but greatly add to the polish of the product. I expect this will be one of those releases that keeps serving up little delights and surprises for a long time.
One of the features in Delphi 2010 that I expect will spawn much debate is the ability to cast an interface reference back to the type of class that implements it.
RTTI and Attributes in Delphi 2010
RTTI (Runtime Type Information) has had a major overhaul in Delphi 2010. RTTI is a central piece on which the Delphi IDE is written, and as such has been around since the first release, however I’ve heard from a number of people over the years that they’d tried to use RTTI and found it too difficult and arcane, especially compared to the Reflection API’s in Java and .NET. That’s a real shame, as the ability to write code to query the details of other objects, without knowing the type up-front, is really powerful.
However, I think that complaint will be a thing of the past with this new API. It’s been not only extended to make it more capable, it is also now much more approachable and easy to use.
One of the new features that I’m very excited about is support for Attributes in Win32. I’m working on a larger example, but here’s a quick run through of creating and then querying custom attributes.
Custom attributes are simply classes that descend from TCustomAttribute. They can have properties, methods, etc, like any other class:
MyAttribute = class(TCustomAttribute)
private
FName: string;
FAge: Integer;
public
constructor Create(const Name : string; Age : Integer);
property Name : string read FName write FName;
property Age : Integer read FAge write FAge;
end;
No real surprises here, and the constructor is implemented exactly as you’d expect.
Next, we can apply our attribute to our class:
TMyClass = class
public
[MyAttribute('Malcolm', 39)]
procedure MyProc(const s : string);
[MyAttribute('Julie', 37)]
procedure MyOtherProc;
end;
Here I’ve applied it to both methods, but note I’ve supplied different parameters to the Attribute. Also note the order of the parameters matches the order in the constructor. This is not just limited to methods, you can apply attributes to properties, entire classes, all sorts of things.
Of course, there’s no point adding attributes if you can’t read them from somewhere, so here’s some sample code that uses the new RTTI API to query for our attributes, and display the details in a listbox:
procedure TForm3.Button1Click(Sender: TObject);
var
ctx : TRttiContext;
t : TRttiType;
m : TRttiMethod;
a : TCustomAttribute;
begin
ListBox1.Clear;
ctx := TRttiContext.Create;
try
t := ctx.GetType(TMyClass);
for m in t.GetMethods do
for a in m.GetAttributes do
if a is MyAttribute then
ListBox1.Items.Add(Format('Method = %s; Attribute = %s, Name = %s, Age = %d',
[m.Name, a.ClassName, MyAttribute(a).Name,
MyAttribute(a).Age]));
finally
ctx.Free;
end;
end;
First I grab a reference to the RTTI Context, and load it with the ClassType of my class. I then do a for..in over the methods in my class, and for each method do a for..in over the attributes. Then I check if the attribute is my custom attribute, and if so, grab the values of Name and Age and show them in a list box.

As I mentioned earlier, I’m working on another example which is a little more useful, but hopefully this gives you a little taste of some of the new stuff coming in 2010. Also, don’t forget to watch the preview videos at http://www.embarcadero.com/rad-studio-2010/, and subscribe to get notified when new ones are published.