Since the table there is incomplete (even the Embarcadero documentation is wrong as some shortcuts can turn on and off a mode), here are the relevant shortcuts keys:
Ctrl + O + C
Turns on/offblockcolumn selection mode
Delphi 5 and up
Ctrl + O + K
Turns on/off block selection mode
Delphi 5 and up
Ctrl + O + L
Selects current line (and turns off block selection mode)
Delphi 5 and up
This is especially useful when the block selection is stuck (this happens every now and then: it’s a known bug).
A while ago, I posted [WayBack] the below StackOverflow answer. Recently a friend asked me about command-line parsing in Delphi, so here is the re-run:
Delphi contains a really nice unit called CommandParser with a [WayBack] TCommandParser class that does commandline parsing for you. Since it has [WayBack] virtually no documentation, here are a few things to get started. It works even in Delphi 2007.
TComponent that contains the properties you want to expose as commandline parameters (that is THiddenExecuteSettings in the HiddenExecuteSettingsUnit
a commandline parser controller. In our case THiddenExecuteArguments in theTHiddenExecuteArgumentsUnit (in retrospect not such a good name) that contains an InitCommandLine method that sets up a TCommandParser instance passing it your TComponent
It then executes a couple of [WayBack] AddSwitch calls to setup the parameters with both abbreviated and full commandline switches (like h and help)
ProcessCommandLine method on the TCommandParser instance to process the commandline and fill the properties of your TComponent (in my example, this is done in the ProcessCommandLine method).
Now comes the fun:
TCommandParser has a HelpText method that fully automatically assembles a helptext based upon what you fed it with the AddSwitch methods.
TCommandParser also has a SaveOptions method that allows you to save the current settings of your TComponent into a settings file.
When you have a registered Delphi, you can Ctrl-Click browse both the units and symbols of RTL, VCL, etc. But Delphi will not recompile these units.
Some third party components you cannot Ctrl-Click browse the units or symbols, unless you put the source directory in the Delphi Library Path (which causes them to be compiled each and every time).
Especially when using Delphi 2007 on Windows x64 system (8.x, 7, Vista, 2012 Server, 2008 Server, …), the Delphi specific .Targets files used by msbuild are simply installed to the wrong location.
Interfaces are great, but they can be a pain to debug. Forgetting one weak link can lead to Access Violation hell. I seem to remember a utility that would let you visualise the links between interfaced objects, but can’t remember what it was called. Anybody know?
Do you have any clever interface debugging tips or tricks?
Mixing object and interface references leads to complex situations, especially when some classes make refcounting go away (not limited to UI components) so refactoring is a good idea, it at all possible:
When the mix of interface reference counting and TObject gets so complex, that the source code is no longer obvious, maintenance costs sometimes become too high and another solution might be better.