Tutorial

Note
You may want to print this topic, because you will have to switch back and forth between help files.
This "tutorial" demonstrates how to create a WinHelp help file for the ToolsAPI.
  1. Start Time2HELP.
  2. The first time you start Time2HELP, you must fill in some central settings, such as where the help compiler is located (it tries to find it itself, but you may have to assist it).
  3. Run the New Library Help Project Wizard (File | New | Library Help Project).
  4. For this demonstration, you will create a help project for the ToolsAPI , which source ships with Delphi Professional, Enterprise and Architect. If you don't have the source code for ToolsAPI, or don't have Delphi, please select some of your own source instead. In the following text, we assume that you are building a help file for ToolsAPI, if you're not, please substitute with your own directories and names.
    Note If you prefer to use DocComments instead of having the documentation in external files, select one of your own libraries/units instead of the ToolsAPI.
  5. Enter your company name, and the name of your library, e.g. 'ToolsAPI'.
  6. Select the directory where you want to keep you ToolsAPI Library Project file. (You may delete this project when you have finished this "tutorial").
  7. Accept the default name for the Library Project file (i.e. ToolsAPI).
  8. Press the Next button. If the directory you specified to keep the Library Help Project file doesn't exist, press Yes when being requested to create it.
  9. Select the ....Delphi\Source\ToolsAPI directory as your Source Library Directory using the Browse button.. Accept the default Documentation Files Directory.
    If you intend to document Borland's source code (!), you may prefer to store your Documentation Files somewhere else, so you do not inadvertently delete them if and when you remove the current installation of Delphi.
  10. Press Next, and select [none] in the Topic File Template list box. Then press Finish.
  11. Now the New Output dialog appears, select WinHelp and press OK.
  12. In the Template Selection dialog that appears, just press OK, and the new library project wizard is finished.
  13. To create the help file, Select WinHelp in the combo box on the main toolbar, and press the Build button next to it, or press F9 (as in Delphi).
  14. First, a parsing process of your source files is performed. In case it is having trouble parsing perfectly legal OPascal code, you should make a copy of your source files, use Time2HELP on this copy, and comment out the sections it is having trouble with. Please also paste the lines which it is having trouble with into an email and send it to us (support@time2help.com)
  15. Next, a library symbol database is built and saved into a .T2H file (having the same filestem as your .HPJ file).
  16. The .topics files are then generated, these are the "source" files for the second phase of processing.
  17. The second phase is converting the .topics files into .RTF files.
  18. Now Time2HELP will invoke the MS Help Compiler, and it will build and run your help file (if everything went ok).
  19. Browse your help file for a while. Many of the classes in the ToolsAPI are abstract/interface classes, so many methods of these classes don't have implementation. One class which has method implementations is TPropertyEditor, a class which should be familiar to component writers. If you check Include Implementation in the WinHelp properties inspector (Outputs/WinHelp in the Project tree view) and set Max Visibility/Scope to private, you should find the implementation of e.g. the TPropertyEditor.Edit method.
    Using Time2HELP to browse "unknown" code is very useful, e.g. you may make help files of some of the VCL units if you really need to look at the implementation of methods, or if you suspect there are routines, classes etc which didn't get into the standard help files.
  20. Now, it is time to test run the Time2HELP Browser. You can start the Time2HELPBrowser from the windows Start menu (under Programs | Time2HELP), or by double clicking the .t2h file located in the WinHelp folder under your project folder in the Windows Explorer.
  21. You should now see a listing of all the units contained in your ToolsAPI. You may double click any of them to view the Help topic for the unit. Double clicking a name should load the corresponding topic for the other lists as well. You will find alphabetical lists of all the (public) classes and (public) routines in the ToolsAPI. This is very useful if you know you have a routine named xxx, but have forgotten which unit it lives in.
  22. Click on the Inheritance Diagrams tab. Click on a class in the left list box, for example the TCaptionProperty class name. You should see which classes (declared in the ToolsAPI library) TCaptionProperty inherits from.
  23. Note that it doesn't show all subclasses of TObject, not even all the subclasses of TStringProperty declared in the ToolsAPI library. The black color of the TCaptionProperty node indicates that all subclasses of TCaptionProperty in the ToolsAPI are shown in this diagram (which happens to be none), but above the TCaptionProperty class, only the "projection" to TObject is shown.
  24. Right-click on TStringProperty on the diagram. Now the diagram shall expand to show all subclasses of TStringProperty defined in this library (ToolsAPI).
    Left-click on any class except TObject, and the help file should be loaded at this class.
    (Note: if you get the message 'Topic doesn't exist', close the active help window, then Time2HELPBrowser will reopen the correct help file.)
  25. Writing some documentation
    (NOTE If you want to use DocComments instead of keeping the documentation in external files, most of the rest of the items doesn't apply to you, read the topic about DocComments before continuing.)
    In the Project tree view in Time2HELP loaded with the ToolsAPI Library Help Project, double click the Delphi Source Directories folder. Now double click the ToolsAPI folder. Finally, double-click the DsgnIntf icon. You may be asked whether you want to create a directory specified to hold the Documentation files, if so, press Yes. Now your documentation file for DsgnIntf is generated (because it didn't exist) and is loaded.
  26. Double-click the DLUnitDoc book (or single-click the plus sign) to "expand" the unit documentation. You see the elements 'Classes', 'Constants', 'Interfaces', 'Routines', 'Summary', 'Desc', 'Types' and 'Variables'. On the right, you see (nearly) the full text of this "UnitDocumentation" file. You will enter your descriptions in 'Desc' elements.
  27. Click on the 'Desc' item, and enter some meaningful words about the DsgnIntf unit, or paste in the following text:
    This unit contains the <See Class=TPropertyEditor> class and various (implemented) property editors that Delphi uses in the Object Inspector. It also contains objects which enable you to create your own custom property editors and routines which enable you to register your editor with your custom component.<p>This help file was generated with <b>Time2HELP</b>!
  28. You have some formatting tags at your disposal when writing descriptions, e.g. <B>, <I>, <Font>, <P>, <Br> and some help file related tags as <Jump> and <Popup> etc. You also have a special tag to jump between "code objects", the <See> tag. You may look at the enclosed help source files for Time2HELP to see examples of real usage. Look at the topic Document Type Definitions for documentation of the available tags.
  29. Now when feeling that you have documented sufficiently (!), save your documentation file by pressing Ctrl+S.
  30. Press F9 to build your help file, now your description is merged into the help file.
  31. Locate the DsgnIntf unit and see that your description came out satisfactorily.
Note
When you add new classes etc to a unit, Time2HELP integrates them into the UnitDocumentation file. If you rename anything, you must rename it manually in the UnitDocumentation as well. (Time2HELP currently doesn't remove or rename anything.)


HTML generated by Time2HELP
http://www.time2help.com