Monday, December 31, 2007
Sarah's company has an old application that still uses a Paradox database. As the end of the year approaches, the boss has asked Sarah to write some one-time-only code to clean out records older than 10 years. Sarah sets to this fairly simple task and, having her database connection all set up, writes the following [...]
Friday, December 28, 2007
When you try to compile this code, you get an error message that isn't much help. The compiler stops on the message handler declaration with the error "Invalid message parameter list."
What the compiler wants to see is the message parameter modified as a var parameter:
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
{...and...}
procedure TMoveableForm.WMNCHITTEST(var Msg: TWMNCHITTEST);
{etc...}
Monday, December 24, 2007
Have you ever wanted to drag a form around the screen by a part of the form other than the caption bar? It's easy, just handle the WM_NCHITTEST message, and return HTCAPTION.
The code will look like this:
First, your form needs a new message handler that handles the WM_NCHITTEST message.
TMoveableForm = class(TForm)
{...snip...}
protected
procedure WMNCHITTEST(Msg: TWMNCHITTEST); [...]
Friday, December 21, 2007
When I decided to start this site, the idea was for it to be fun and educational. That is, I wanted people to learn something that would make them better programmers.
I don't claim to know everything about Delphi, and I knew full well that at some point, I would do something wrong, and people [...]
Monday, December 17, 2007
John's team was updating the user interface in their application, and John was given the assignment to work on a dialog box for assigning roles to people. To assign roles now, you have to type the name of each role you want to assign into a TMemo, called mmoRoles, and John's manager has asked [...]
Thursday, December 13, 2007
Welcome to the Delphi Puzzles site, sponsored by TwoDesk Software Company.
What's going on here?
This site is inspired by the puzzles used to teach good habits and skills in the game of chess. For centuries, chess masters have created puzzles such as the Knight's tour or the 8 Queens Problem. Since chess is a game of [...]