Category
There's an old story about a question that was posed during a family meal asking what was the best modern convenience in the home. The younger generation were saying things like ice makers in refrigerators and microwave ovens. The grandmother of the family listened for awhile then gave her input: indoor plumbing!
It's too easy to take some of the basic conveniences of life--or features of an IDE--for granted, and assume they will always be present. This article continues a set of Delphi Productivity Tips but goes back to some of the basics of the Delphi IDE that I realized are probably more important--but I don't always think about because I figured every development environment should have.
I do most of my work on Windows machines (both real and virtual) where I use an ergonomic keyboard and a big mouse with multiple buttons and a scroll wheel. I also have a Mac Mini that I use for supporting iOS development but don't use it that often. It's on my crowded desk and I need access to it but didn't want to take very much desk space away from my main working machine for the keyboard and mouse so had to plan carefully.
For typing, I found a great multi-function Bluetooth-enabled keyboard from Logitech that doubles as a stand for my iPad. It has a dial in the upper-left to switch between 3 different BT-connected devices and I've configured it to work with my Mac Mini, my iPad, and Android phone. It doesn't have a numeric keypad but that's a small inconvenience for the space savings in this case.
The mouse I chose is a trackball, also from Logitech. It's very usable, has multiple buttons, and its slim design fits nicely among other peripherals on my desk.
Soon after getting the Mac Mini, I decided to expand its usefulness with a Windows virtual machine adding to the ones that were tapping out the resources on my main Windows machine. This led me to start using the Mac a little more than I had before and I soon found my keyboard and mouse choices, which were fine for the minimal Mac and iPad use, were clumsy for getting around Windows like I was used to--especially after installing and starting to use Delphi.
Like many new keyboards, the function keys come with "convenience features" that launch the home page of your default browser, copy and paste items, and perform other common tasks that for some strange reason are thought to be too difficult to do yourself (doesn't everyone know how to copy/paste?). You have to hold down a "fn" button to use the keys as general purpose function keys.
When I first started using Delphi on my new Windows VM on the mac and tried to use a function key, it would do strange things like start a windows search instead of set a break point or mute the speaker instead of launch the program. Fortunately, Logitech has software that resets the function keys to their originally intended purpose, so that was a pretty quick thing to install and get setup.
The other thing this keyboard has is some mappable keys on either side of the space bar. I'm accustomed to the left side of a Windows keyboard to contain a Ctrl
, Windows Start
, and an Alt
button; Macs' standard keyboards have a Ctrl
, Alt
, and a Cmd
(or "flower") button to the left of the space bar. I found myself constantly starting Windows Feedback Hub (Windows
+F
) instead of pulling down the File menu until I remapped those, switching them around on the Mac keyboard to my preference.
These two things alone made programming in Delphi with this new keyboard usable. Before those changes, I was about ready to delete the virtual machine because it was so frustrating and awkward. That brought to light how important basic keyboard layout is to coding productivity.
To a lesser extent, the trackball is, in my opinion, much less productive for coding than a mouse with a scroll wheel. I'm constantly scrolling up and down through a file, looking at different sections or code. With a scroll wheel on a regular mouse, the cursor doesn't have to move--I can scroll up within the file without actually going there, then just start typing and my screen instantly updates back to where the cursor is. With a trackball, I can do somewhat the same thing by grabbing the thumb button on the scrollbar and sliding the file up or down without changing the cursor position, but it's a lot touchier and takes longer to position the mouse pointer over the scrollbar's thumb than it does to just flip the file up with the scroll wheel.
This was another thing that hadn't really occurred to me until I started using Delphi on the Mac's Windows VM.
Speaking of these simple things, I really like the fact that most of Delphi's standard function keys have been in place for 25 years! And many of them (F1, F3, F4, F5, F7, F8, F9, F10) are the same ones I used before that in Borland Pascal when building DOS applications in the 1980s and 90s! Here are the basic function keys in Delphi today:
- F1: Help - if local help is installed
- F2: From the code editor, this focuses the list of To-Do items; if you're in the project manager it switches the filename to edit mode so you can rename it, much like Windows Explorer.
- F3: Search Again. This will repeat the last search--I use this a lot after I've done an initial search to quickly scan through several search results in the code file.
- F4: Run to this point. This will start (or continue) debugging the current project and stop where the cursor is in the code--more convenient than setting a break point if you're just going to remove it later.
- F5: Set a Breakpoint. This will stop the code at that location during debugging of the program.
- F6: This starts IDE Insight, prompting for an action in the IDE; used mostly to quickly add a component to a data module or form at design-time by typing in the name rather than looking for it in the Tool Palette.
- F7: Trace into the method at the cursor while debugging.
- F8: Step Over a method at the cursor while debugging (it doesn't skip the method but executes the entire method as if it were one statement, stopping at the statement following the method).
- F9: Start Debugging the current project, compiling first if necessary.
- F10: Activates the menu, just like hitting the Alt key does, allowing you to then use arrows to navigate the menu items if you wish.
- F11: Switches to the Object Inspector.
- F12: Toggles between form and code of a data module or form.
There are, of course, many other keyboard shortcuts and variations with the function keys using Ctrl
, Alt
, and Shift
modifiers. Learning to use these fluently saves a lot of time hunting for them with the mouse through the menus.
It's good to go back and review the basics once in a while.
Add new comment