Automating the Creation of Methods with the Class Explorer

From Appmethod Topics
Jump to: navigation, search

Go Up to Object Pascal Class Explorer Topics

Using the Object Pascal Class Explorer you can automate the creation of methods.

To automate the creation of methods:

  1. Open the Object Pascal Class Explorer window by choosing View > Class Explorer.
  2. In the Class Viewer pane, right-click a class or an interface into which you wish to add a new method.
  3. On the context menu, choose the Add Method item. The Add Method dialog box appears.
  4. Into Method name type the name for the method to be added.
  5. In the Add to class combo box, select the class or interface to which you wish to add the method. By default, the class/interface currently selected in the Class Viewer pane is prompted. You can, however, change this to any other available class/interface selecting it from the drop-down list in the combo box. Select the @unitclass to add the method to the global scope. Notice that when you add a new method into an interface, then only the method declaring code is generated. (No implementation code is generated.)
  6. In the Arguments field, type in the list of arguments, if any. Arguments should be typed exactly as they appear between the parentheses in the method declaration.
  7. In the Method type group, select the type of the method. You can select among: function, procedure, constructor, and destructor.
  8. In the Return type combo box, select the type of the return value. You can select one of the predefined types from the drop-down list in the combo box or you can type in any other existing type.
  9. In the Visibility group, select one of the the visibility specifiers. The selected visibility specifier will be applied to the method being created.
  10. Click OK. The code for the declaration and default implementation of the specified method is inserted into the specified class or interface.

See Also