
Just remember, love is live, and hate is living death!
Black Sabbath: A National Acrobat
“Transparent” TEdit on TTabSheet
14 Dec 2011 | No Comments | posted by CCRDude | in General Development
From time to time, I encounter the same issue. I’ve got a TPageControl, a TTabSheet on it, and a simply TEdit that replaced a TLabel just for the purpose of the content to be copyable.
BorderStyle is set to bsNone, ReadOnly to True, ad it looks just like a label on modern Windows.
But as soon as you use this on a Windows that uses the classic style (the one that looks a bit like Windows 2000), the tabsheets do no longer have a white background, but a clBtnFace one, and since TEdit is not really tranparent, they look out of place suddenly.
I searched the Delphi-PRAXiS forum for solutions, and found a TTransEdit component there – but that one, I had already discarded years ago, and again didn’t solve the issue for me.
Annoyed by all these struggles, I went another route. I added UXTheme to the uses clause, and simply updated the color based on theming.
procedure TformNTProcess.FormCreate(Sender: TObject);
begin
FProcessImageName := '';
FTerminated := false;
if not UseThemes then begin
editImageName.Color := clBtnFace;
editImageNameNT.Color := clBtnFace;
end;
end;
So far, this works much better and reliable than replacing all TEdit with TTransEdit. Granted, it does not provide transparency for background images, but it solves the TTabSheet theming issue better than a nonperfect transparency solution.
Certified Delphi Developer
28 Oct 2011 | No Comments | posted by CCRDude | in Delphi, General Development
When upgrading to Delphi XE, or maybe some weeks later, I noticed the offer of a free certification that came with buying the upgrade. So I visited the Delphi Developer Certification website, read the study guide, and had a split opinion.
I’m a low level coder. If I use databases, I use SQLite or WySQL libraries directly, without the overhead of Delphis database components. Some questions deal with this. Guessing how many areas there are and that you need only 80% of correct answers to pass, I decided I could have some lack of knowledge here.
Another area are generics and anonymous methods. Before upgrading from Delphi 2006, I never cared about them, so I had to learn. Not that difficult, I reserved half a day and knew everything I needed.
Meanwhile, time has passed, since work is more fun than exams, and I requested the serial for the exam the last day possible, and took the exam again the last possible day. Wouldn’t have needed to, since answering the majority of questions took 15 minutes, with another 15 minutes spent on 5 questions I was unsure about.
If you also have a free go at the test, I can only recommend taking it. Even if you don’t prepare, you won’t loose anything, but if you spend some time on preparation and have a few years of background, I think it’s easy to pass.
TrayIcons in the Window 7 registry
23 Sep 2011 | No Comments | posted by CCRDude | in Delphi
In this post at the German speaking Delphi-PRAXiS forum, tray icon visibility on Windows 7 was discussed. While I quite like Microsofts decision to let the user decide which icons spam their desktop, I can understand the technical challenge to know how the new IconStreams registry value (at HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify\) is defined. I therefore did a bit of trial and error debugging and wrote ReadIconStreams.dpr, a small tool that reads and displays this information for the current user.
To sum things up, after a header of 20 bytes, we have repeated records of this type:
TIconStreamRecord = packed record
FilenameRaw: array [0 .. 263] of WideChar;
VisibilityRaw: DWord;
Reserved0: array[0..3] of byte;
LastVisibleTooltipRaw: array [0 .. 253] of WideChar;
Reserved1: array [0 .. 591] of Byte;
Reserved2: DWord;
end;
Filename and Tooltip are Rot13 encoded, in a strict form (only letters are moved). Visibility is 0 to 2, with 0 being Only Notifications, 1 Hides Icons and Notifications, and 2 shows both. There’s more data in there, but that is irrelevant for this question and open for some future fun.
