Friday, April 13, 2007

Documentation/Help In Delphi 2007 Part IV

For me the most interesting topic about the help system is the F1 key in the IDE. Another embarrassment is when we moved to the Galileo IDE, the first product we released was C#Builder, so the F1 code was changed quite a bit. Specifically it was changed for C# and not general purpose or personality aware. So I looked back at the Delphi7 code base, took some of that code and added a bunch more so help is a whole lot smarter. I made the Object Inspector, Editor, and Form Designer personality aware so you will be more likely to go straight to the content you are looking for instead of having to choose the personality you want documentation for every time you press the F1 key.

When you press F1 on a component in the Form Designer the code checks to see if the component is in the help, if it isn't, by using the RTTI, the process is repeated with the parent class until help is found on the component or if TComponent then no help is found.

When you press F1 in the Object Inspector the same process is performed as above only looking for the property or event on the given component. If that search fails then just the component name is searched for. If all that fails then no help is found.

When you press F1 on a dialog the ContextID is used to find help. We format the string with "BDS5:" so we can also search for context IDs as keywords from the .NET side of the IDE.

The most interesting things happen when you press F1 in the editor. For this work I had to add a few things to the compiler because I go through the kibitz compiler to get scoping and type information. I also added the ability for the editor to use the compiler associated with the file in question. The kibitz compiler doesn't support certain parts of a .pas file, so when the kibitz compile fails a token parser is used.

Part I
Part II
Part III
Part IV

No comments:

Post a Comment