Using code browsing in the Delphi IDE

Are you familiar with the code browsing features in the IDE? Code browsing was added several releases ago but I’m not sure if people are familiar with how it works. The idea is pretty simple, leverage standard web browser techniques to allow people to browse their code. The IDE supports both keyboard and mouse navigation for code browsing and from the code editor the options are as follows:

  • Using the mouse, hold down the Control key and click a symbol
  • Using the keyboard position the editor caret on the symbol and press Alt-Up arrow

To complete the browsing metaphor the IDE also supports the standard browse forward/backwards shortcuts of Alt-Left arrow and Alt-Right to navigate the code browsing history just like a web browser.

I’m guesing but probably a much less well known method of code browsing is supported is in the Code completion listbox. To see this, simply position the editor caret inside of a method body and invoke code completion. Once the list appears control click an identifier from the list to browse to that symbol. So, if you find something in the list and you’re wondering “hey, where/what is that?” just control-click it to find out.

UPDATE: In response to a comment to this post I just wanted to mention that IMO code browsing works better in BDS 2006 than any previous release and I know there were a number of bugs fixed specifically related to code browsing.

13 thoughts on “Using code browsing in the Delphi IDE

  1. Hi Steve,
    as far as I am concerned, you guessed correctly: I didn’t know that ctrl-click also works in the completion listbox. Thanks for mentioning it.
    Actually I have found lately that there are quite a few littles gems of the Delphi IDE that I didn’t know about. Some of Nick’s demos were quite an eye opener for that too.
    twm

  2. It doesn’t work very well in Delphi 7 – may have been improved in later versions. It only works about half the time, but always takes a very long time (maybe 30 seconds) to complete on my project. When it works, it still helps, but half the time I end up wasting my time, and then have to find the symbol manually anyway.

  3. Hi JB,
    It’s been awhile since I’ve worked in D7 but I believe you’re right and it undoubtedly works better in BDS 2006. In the 1000’s of bugs that we fixed in BDS 2006 there were a number related directly to code browsing and I use it all the time now.
    -Steve

  4. AFAIK in D7 code browsing strictly depends on debug symbol being available or something alike. If the application was compiled without them it does not work well, or does not work at all.
    Because Borland since Delphi 1 decided that saving/loading differen t compiler configuration was not needed because developers like to open the project options box every time and activate/deactivate all those little checkmarks, sometimes you get a non-working code browser.

  5. Didn’t know about the keyboard shorcut. Always bugged me that I had to use the mouse to navigate to some position (as opposed to VS where I just press F12)… good to know, thanks.

  6. So Ctrl+Shift+Up/Down belongs to Code browsing technically? From the IDE shortcut listing on your homepage, I got the impression it would belong to Class Completion, since its in that category there.
    Would actually be good to know to make sure QC report are in the correct area!

  7. Steve,
    thanks for clarifying. I confused those. So I assume Ctrl+Shift+Up/Down (navigate between declaration and implementation) is part of Class Completion.
    Oh and BTW: I tried Alt+Up in a Code Completion window and unfortunately it didn’t browse to the symbol, so it seems this is not supported.
    Even stranger if I then used Up+Down to select a different CC entry, the entry was getting blank. Should I QC the latter/former/both?
    Thanks
    Sebastian

  8. Hi Sebastian,
    You’re welcome, and yes the Ctrl-Shift Up/down are part of class completion.
    Alt+Up doesn’t work in the code completion list only Ctrl-Clicking does to browse to that symbol. Alt+Up only works within the code editor while the cursor is on a symbol.
    This last issue sounds like a bug and logging that to QC would be great.
    -Steve

  9. Oh..Thanks, Today only i know can browse code using Ctrl+Click on code completion..Thanks.
    Is there any way to browse the code file programmatically ?
    ..i mean, i have a form with a TButton, i would like to browse the buttonclick event handler at runtime by just doubleclick on button..
    Thanks
    Basil

Comments are closed.