Just found this great answer by vcldeveloper to autoscroll a readonly logging memo in Delphi which works from Delphi 1 and up (:
For such a simple task, you don’t need to buy a commercial component! All you need to do is to send an EM_LINESCROLL message to that memo control, to make it scroll to the last line:
procedure ScrollToLastLine(Memo: TMemo);
begin
SendMessage(Memo.Handle, EM_LINESCROLL, 0,Memo.Lines.Count);
end;
If your memo is read-only to users and is updated automatically by the application, you can put a call to the above procedure in its OnChange event-handler, so that whenever the text inside the memo is changed, it is automatically scrolled down to the last line.
The with clause effectively opens the scope containing field identifiers of the specified record variable, so that the field identifiers may occur as variable identifiers. (Thereby providing an opportunity for the compiler to optimize the qualified statement.)
Screenshots of this 1975 book are below the fold.
The Delphi (actually even before that Turbo Pascal compiler) has no measurable difference between with and non-with code.
The debugger however, still does not support with, and there are other drawbacks of which one is below.
The below code example is just one of many. I show it because I recently bumped into doing some long overdue code porting to Delphi XE3.
Since I’ve been bitten by using with a couple of times before, it didn’t take me long to find the cause.
Example code where FIConData is of type NOTIFYICONDATAW that used to compile fine:
with FIconData do
begin
cbSize := SizeOf(FIconData);
Wnd := Self.Handle;
uID := $DEDB;
uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
hIcon := Application.Icon.Handle;
uCallbackMessage := WM_CAS400NTIcon;
StrCopy(szTip, PChar(Caption));
end;
A cool page for historic perspective is R3R: Pascal Features in Popular Compilers, hopefully someone will update it to more modern versions of the mentioned compilers.
Few people know about a Delphi language feature that has been present since Delphi 1: prepending the type definition with a type keyword to make the type getting a new identity.
Each time I use it, I have to do some browsing for the consequences, and this time I wrote down some notes and created a small example program (source is also below).
WebSphere MQ has Queues where you can put and get messages. It also has Queue Managers to which you connect, and that provide queuing services and manages queues.
Both Queues and Queue Managers have names that can be up to 48 (single byte) characters long.
Those names mean totally different things, so though the have similar data types, they have a different identity.
I found out in the mid 1980s that people I was communicating with internationally (back then the internet was forming and you already had BITNET Relay chat and email) were using different date formats than I did.
Ever since that, I’ve used the YYYY-MM-DD format of writing dates, encouraging others to use as well and as soon as I found out that was a standard, started to evangelize ISO 8601 (there is an ISO 8601 category on my blog), which – at the time of writing this – had had revisions in 1998 (on 1998-06-15), 2000 (on 2000-12-15) and 2004 (on 2004-12-01).
A lot later I found out that back in 1971, this date format was a recommendation, and in 1976 already a standard. Not nearly as old as Esperanto though (:
Speaking about languages:
At the end of last century, after Delphi 5 added year 2000 support (which made the 16-bit Delphi 1 disappear from the box as the effort to prove the product including all libraries was year 2000 proof), Delphi went cross platform.
The Delphi team working on both Kylix 1 and Delphi 6, the also added a DateUtils unit which provides a lot of cuntionality, including support for weak numbers. The first test version always assumed week 1 was the one with januari first in it. As ISO 8601 also indicates how the first week of a year should be determined, a couple of people (Jeroen W. Pluimers, Glenn Crouch, Rune Moberg and Ray Lischner) provided code that fixed this and a few other things in the unit. We even got mentioned by Cary Jensen!
Delphi is not the only environment having ISO 8601 support. XML has, .NET has, etc: it is now wide spread.
So follow your tools, and start using it yourself as well (:
Too bad the ISO 8601 standard text is not available publicly:
Few people know the name Peter Sollich, as he always chose not to be a public figure (for instance, he is absent on the Outstanding Technical Achievement video).
Peter has been very important for both the Delphi and the .NET worlds: he was the original author of the 32-bit product that became the Delphi x86 compiler.
A few interesting links came up when using his name in some Google searches.
I just watched this interview with Anders Hejlsberg for the first time. This is truly an amazing interview. It’s rather long, about 1 hour, but it is so worth it. I’m not giving anything away… you’ll have to just watch and enjoy.
I am giving a few things away: trip down memory lane, putting big parts of software development history into perspective,
Since Anders has been so versatile, influential and still humble, this is a must watch for anyone in the software field. To quote Research Channel:
This episode features industry luminary, Anders Hejlsberg. Before coming to Microsoft in 1996 he was well noted for his work as the principal engineer of Turbo Pascal and the chief architect of the Delphi product line. At Microsoft, he was the architect for the Visual J++ development system and the Windows Foundation Classes (WFC). Promoted to Distinguished Engineer in 2000, Anders is the chief designer of the C# programming language and a key participant in the development of Microsoft’s .NET Framework. In this show, Anders is joined by a surprise guest. This episode of ‘Behind the Code’ is hosted by Barbara Fox – former senior security architect of cryptography and digital rights management for Microsoft.
(PS: how a video published in the C# 3 era can be so current <g>).
And if you feel for more, here, here, here, here and here are some more, are a few lists of videos where Anders speaks.
From a historic perspective, I like these most:
However, over the course of Delphi versions, compiler platforms and bitness, and not forget Free Pascal and Turbo Pascal/Borland Pascal, the matrix has become huge.
The really cool thing is that this API has been stable since 1995, and still allows you to subclass windows controls or create your own controls in a very simple way.
Note that Allen does not cover DestroyWnd or DestroyWindowHandle, but those are just counterparts of CreateWnd and CreateWindowHandle.
In normal Delphi application code, you have less Destroy overrides than Create overrides, and the same holds for control development.