Title Bar Size
I develop under Windows XP I have always been annoyed with how much space the title bar takes up under windows XP if you turn the themes on. When you are on a small monitor it can use precious pixels.
This is what it normally looks like

But it can be resized smaller.

You just change the display settings here.

Debug only what you want to debug
Write this down:
{$D-,L-}
If you add this compiler directive to your Delphi unit the IDE wont try to step into it when you debug.
This is extremely useful if you have units the debugger steps into often, usually because they respond to messages or do painting, but you know they are bug free and do not need to be debugged.
If you do need to step into the unit just comment out the complier directives.
I guarantee you will be more efficient debugging once you use this directive. You can get advance by wrapping the compiler directive above in another directive to allow it to be conditionally applied depending on what you are debugging.
{$IFDEF DEBUG_ALL
{$D+,L+}
{$ELSE}
{$D-,L-}
{$ENDIF}
Note: All of these directives apply to the whole unit and cannot be used to wrap a procedure or code section.
Just 1 line of code.
I was fixing/debugging/enhancing some code and came across this 1 line of code.
PrintSendStatement(1,sessionStatementGrid);
The line was so good yet so bad all at once. This is what I was able to work out just by looking at this line of code.
Firstly it was calling a procedure named PrintSendStatement. Which seems like a well named procedure I can guess exactly what it does. The code that prints statements and the code that sends statements must be very similar so one procedure that does both seems reasonable. I have no idea the scope of the called procedure but from it's name it does not seem relevant. Score: +1
The second parameter is the number 1. This just kills me. I can see another line that calls the same procedure with a zero as the first parameter. Without further digging I have no idea what zero and one mean other than guessing one prints and the other one does not. A constant would have been super cool here. It would have taken maybe 30 seconds for the original developer to do. Now it will take me and every other developer for the rest of time 30 seconds to look it up. Score -2
The third parameter is a grid. Which surprised me as I would have expected a different colection or a single variable to be passed. A grid is a weird collection to use so it told me something. It told me that PrintSendStatement probabley had a very local scope and it needed a grid as a parameter. No-one would choose a grid as a parameter so it must be required. Why? Grids allow the user to select or multiselect records. I can infer that PrintSendInvoice will print or send the select records in the grid. Score +1. But I'm taking off another point because if PrintSendInvoice is local then constants really should have been used, the developer can't fall back on the excuse 'I copied the code and that is the way it was'.
Total Score : -1.
So now I have to dig into PrintSendStatement and see what it does. I didn't want to do this. I was fixing something else. I really need a timesheet code to charge back the original developer and bill him/her.
Should I put constants in now?
-
Yes: That will save time for all developers going forward.
-
No: I'm not here to touch that code. Plus I'd have to search for all the ones and zeros to keep things consistent. This could take a while.
-
Compromise: Just add comments at this location to help the next developer without creating any new bugs.
What would you do?
King Blogger
In the land of the information starved the blogger is king.
Finding Delphi Apps
This is an old trick. If you want to know if an app was written in Delphi. In the task bar right click on it. If the menu only has three choices: Restore, Minimise, Close then it is most likely a Delphi app.
This is not 100% accurate but it is right most of the time. There is a fix for it which is why it is not right all the time.
Day 2ish of Delphi 2005
Now I am getting this trying to install some packages. I have already spent 2 hours on it.
---------------------------
Error
---------------------------
Cannot load package 'rtl70.' It contains unit 'ZLib,'which is also contained in package 'rtl90'
---------------------------
OK
---------------------------
None of my google searches have found a reason for it and I do not like any of the work arounds.
Update: It seems to be a path issue.
Update2: This is what I did to fix it.
Find all my Delphi 7 BPLs in my system32 folder. Then I moved them to a new folder on my desktop. Basically moved them out of my path. Once I did this Delphi asked me to recompile another BPL and then it was all done.
I have not had to use Delphi 7.0 any more so I have not moved the components back but I am sure it would work.
Day 1 of Delphi 2005
Notes from my first day of Delphi 2005.
-
My 1024x786 LCD is not big enough.
-
Changing the colors of the IDE code editor is a lot lot harder int Delphi 2005. It is not as WYSIWYG as previous versions.
-
I need to upgrade to 512MB from 256MB RAM. Although I need this before Delphi 2005
-
Upgrading my old code is simple of far.
2005
It is 2005 and I now have Delphi 2005 to play with.
New Template
If you are reading the RSS version of this page take a look at my new template. This blog was published with a Delphi app called PWAIN