Powered by discountASP.NET
referal ID: sdtref
Why recommend discountASP.NET?

Archives
Steve Trefethen Steve's RSS Feed Subscribe or via email
What's this?
Contact me Send mail to the author(s)
About Me
View my LinkedIn profile

Add to Google
Subscribe with Bloglines
MCP Microsoft Certified Professional

Falafel Software
ActiveFocus Project Management Solution by Falafel Software
Online or OnSite TestComplete Training
Blogroll
Recent Comments
My Online Tools
Stats
Total Posts: 460
This Year: 65
This Month: 1
This Week: 2
Comments: 1616
Tags
Disclaimer
The posts on this weblog are provided �AS IS� with no warranties, and confer no rights. The opinions expressed herein are my own personal opinions and do not represent my employer�s view in any way.
My most popular blog posts (Q1 2008)
# Tuesday, October 31, 2006
« Programming language survey on codeproje... | Main | Using Microsoft's Windows RSS Platform f... »

Using code browsing in the Delphi IDE

Posted @ 8:18AM by Steve Trefethen

Categories: Delphi

Tags:

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.

Tuesday, October 31, 2006 10:36:01 AM (Pacific Daylight Time, UTC-07:00)
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
Tuesday, October 31, 2006 1:36:46 PM (Pacific Daylight Time, UTC-07:00)
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.
JB
Tuesday, October 31, 2006 1:48:16 PM (Pacific Daylight Time, UTC-07:00)
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
Tuesday, October 31, 2006 4:12:14 PM (Pacific Daylight Time, UTC-07:00)
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.
Ideon
Wednesday, November 01, 2006 3:42:45 AM (Pacific Daylight Time, UTC-07:00)
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.
Fritz
Wednesday, November 01, 2006 9:32:17 AM (Pacific Daylight Time, UTC-07:00)
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!
Sebastian
Wednesday, November 01, 2006 10:23:28 AM (Pacific Daylight Time, UTC-07:00)
Hi Sebastian,
Code browsing is:

- Alt-Left Arrow: browse back
- Alt-Right Arrow: browse forward
- Alt-Up Arrow: browse to symbol
- Ctrl+Left mouse click: browse to symbol

There is no Ctrl+Shift up/down in code browsing.

If you look on this page:

http://homepages.borland.com/strefethen/index.php?pagename=Main.KeybindingInformation

The code browsing keys listed are correct.

-Steve
Wednesday, November 01, 2006 1:03:13 PM (Pacific Daylight Time, UTC-07:00)
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
Sebastian
Wednesday, November 01, 2006 1:25:14 PM (Pacific Daylight Time, UTC-07:00)
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
Tuesday, May 22, 2007 1:35:13 PM (Pacific Daylight Time, UTC-07:00)
There are detailer than out button million copies of his convalescences in print.
Tuesday, May 22, 2007 1:37:23 PM (Pacific Daylight Time, UTC-07:00)
There's cockney criticism you can come up with that he hasn't put into a.
Friday, June 27, 2008 3:57:58 AM (Pacific Daylight Time, UTC-07:00)
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

Basil
Friday, June 27, 2008 7:41:03 AM (Pacific Daylight Time, UTC-07:00)
Basil,
Since Delphi is a compiled language there is no way to view source code for event handlers at runtime.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strong) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Live Comment Preview