4D v16.3

Using comments

Home

 
4D v16.3
Using comments

Using comments  


 

 

The Explorer allows you to write comments about objects in your database. Using comments is particularly appropriate for databases being developed by multiple programmers and is generally good programming practice. Your comments are displayed in the preview area of the Explorer.

The following objects accept comments:

  • Folders
  • Methods (database methods, component methods, project methods, form methods and triggers)
  • Forms
  • Fables
  • Fields
  • Plug-ins

A comment can be entered as styled text (i.e., the characters can have different font styles or colors, etc.) that can be modified and viewed at any time in the Explorer. It can contain a description of an object with which it is associated as well as any information necessary to understand how the object functions in the database. The comments you create are stored in the database’s structure.

Moreover, 4D allows you to generate automatic comments, which means that 4D automatically enters comments when an object is created or modified.

Compatibility note: Since version 12 of 4D, comments inserted in the method header using the // characters are displayed as help tips when the method is referenced in another method (see the "Using help tips" paragraph in WA SET EXTERNAL LINKS FILTERS). This function, which is particularly useful for documenting user methods, is not compatible with comments placed in the Explorer. If you want to use method headers in this way, then do not enter comments in the Explorer.

You create, view, and modify comments from the Explorer. To add a command when the preview area is displayed, select the object in the list of the Explorer and then click the Comments button located below the preview area.

When the Comments option is selected, the preview area is replaced by the Comments area and you can then enter or modify the text displayed.

4D Server: The Locking icon located in the bottom left corner of the area, indicates whether the comment is already being edited by another user. If this is the case, the pencil has a slash through it and the comment can only be viewed.

The text is saved as soon as you click outside of the entry area. You can enter up to 32,700 characters of text for each object You can use the standard text editor commands (Copy, Paste, Select All, etc.) available in the context menu or by using keyboard shortcuts in the Comments area. You can also navigate the text in the comments area by using navigation keys as you would for any other text area.

You can enhance the style of the comments (add bold or italics) and change the font attributes (font, font style, font size, or color) using a context menu. To modify the style of the comments’ text:

  1. In the Comments area, select the text that you want to modify.
  2. Click in the area with the right mouse button.
    A hierarchical pop-up menu appears:
  3. Select the attributes that you want to apply to the text.

It is possible to activate an automatic commenting system that can be used for methods and forms in the database. When this system is activated, a comment is automatically associated with every method or form created or modified in the database. An automatic comment can consist of both static text (such as “Modified by”) and variables (such as the current date, current time, and current user as specified in the 4D passwords).

Automatic comments are defined for the application on the General page of the Database Settings dialog box (see ). As with standard comments, you can view them using the Explorer.

To activate the automatic commenting system:

  1. Display the Database Settings by selecting the Database Settings... command in the Design menu or by clicking the Settings button in the 4D tool bar.
  2. On the General page, check the Activate Automatic Comments option
  3. Enter the set text of the comments.
    You can insert static text and variable elements using the Date, Time and User name buttons located below the area. You can also directly enter the following variables:
    #D for the date
    #H for the time
    #N for the current user

For example, if you enter the following values:

The automatic comment will be added to the comments for all new methods and forms, as well as all existing methods and forms that are modified after automatic commenting is turned on:

Note: If your database doesn’t have a password system, #N returns the string “Designer.”

4D Server: Automatic comments can be modified by any client workstation that has access to the Database Settings. You can also modify these parameters in the Database Settings of the server machine. Every modification made to the automatic comments page is immediately taken into consideration by each client workstation as soon as an object is modified and its comments are accepted.



See also 

Writing a method

 
PROPERTIES 

Product: 4D
Theme: Explorer

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)