The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 4,262 other subscribers

Archive for July, 2009

Delphi – FastMM: Using FastMM4 for debugging your memory allocations – part 1: Introduction

Posted by jpluimers on 2009/07/29

I’m using FastMM in our projects when debugging memory allocations.

It is a great tool, but documentation is sparse.
Hence this post: point to some introductory articles and add some of my own experiences.

Later on, I will show some more advanced use.
These posts are already available in this series:

  1. Delphi – FastMM: Using FastMM4 for debugging your memory allocations – part 1: Introduction
  2. Delphi – Using FastMM4 part 2: TDataModule descendants exposing interfaces, or the introduction of a TInterfacedDataModule

So now lets get on with the introduction:
Read the rest of this entry »

Posted in Delphi, Development, FastMM | 23 Comments »

Delphi – backwards compatibility: using {%File to add non-Delphi files to your project in the .dpr

Posted by jpluimers on 2009/07/27

When you add a non-Delphi file to your project, the current (Galileo based) IDE’s add them only to your .dproj file.
But older Delphi’s used to add them to the .dpr file using the (undocumented) {%File pseudo-directive.

When including the file ..\src\Defines.inc, you need this pseudo-directive: {%File ‘..\src\Defines.inc’}

The .dpr import wizard knows about it: if you have a lonely .dpr file using the {%File pseudo-directive, it will be correctly reflected in the .dproj file.
Read the rest of this entry »

Posted in Delphi, Development, FastMM | Leave a Comment »

Delphi – indexed properties

Posted by jpluimers on 2009/07/23

Sometimes, indexed properties can make your life much easier: they allow you to redirect single properties to central Get/Set methods.

You don’t see it used very often, but when you need it, it is very handy.
There is even some online help on it (look for “Index Specifiers”) it gives you the basics, but no compiling example.

For me it works best when I have a complete, but concise example.

So here is one: TMyIndexedPropertyComponent that has property Range1Value through Range4Value of type TRange, all centralized to one pair of read/write methods: GetRangeValue and SetRangeValue.
Read the rest of this entry »

Posted in Component Development, Delphi, Development, Package Development, Software Development | 2 Comments »

Delphi – Frames as visual Components – changing your inheritance

Posted by jpluimers on 2009/07/22

Did you ever get this error message when creating TFrame descendants?
Message

---------------------------
Error Reading Form
---------------------------
Error reading TDioptreFrame.ClientHeight: Property ClientHeight does not exist. Ignore the error and continue?
NOTE: Ignoring the error may cause components to be deleted or property values to be lost.
---------------------------
Ignore   Cancel   Ignore All
---------------------------

It is odd: TFrame descendants do not have a ClientHeight property!

If you press Cancel, then you get this error message.

Message

---------------------------
Error
---------------------------
Error creating form: Error reading TDioptreFrame.ClientHeight: Property ClientHeight does not exist.
---------------------------
OK
---------------------------

I did, and here is a reason why it can happen.
Read the rest of this entry »

Posted in Component Development, Delphi, Development, Package Development, QC, Software Development | 15 Comments »

Delphi – Frames as visual Components – don’t forget your Sprig!

Posted by jpluimers on 2009/07/16

I have been using Delphi Frames as visual components for quite some time now.
They make it really easy to use the Delphi IDE to visually design your component.
This makes the development process for creating visual components much easier and faster.

There are some things you need to watch when doing this, so I’ll devote a few blogs posts on this topic over the next couple of months.

A few of the things are:

  • When you put components on your frame, and later drop that frame as a component on a Delphi form or frame, the components are visible in the Structure Pane.
  • The Visible property is ignored at design time.
  • You need to watch resizing.
  • Frames do not have OnCreate and OnDestroy events.
  • Error messages about a missing ClientHeight property.
  • You can still drop other components on your frame.
  • … probably some more that I forgot right now…

The first blog on this series is about the first issue:

When you put components on your frame, and later drop that frame as a component on a Delphi form or frame, the components are visible in the Structure Pane.

The bad thing about this is that you can now delete the components on the frame using the structure pane.
This leads to all sorts of problems (mostly access violations).
Read the rest of this entry »

Posted in Component Development, Delphi, Development, Package Development, Software Development | 5 Comments »