Adding an element to a file

About this task

To add an element to a file:

Procedure

  1. In the browser, right‑click a file and select Features from the pop‑up menu to open the Features window.
  2. On the General tab, specify the type of file that is to be generated for the elements you plan to add:
    • Logical generates a specification file and an implementation file containing both declaration and definition for the mapped elements. This is the default.
    • Specification generates only a specification file containing declaration or definition according to the mapping. Typically, a specification file includes declarations.
    • Implementation generates only an implementation file containing declaration or definition according to the mapping. Typically, an implementation file includes declarations.
    • Other generates a specification file and an implementation file, or just a specification file, or just an implementation from an included external file in a build.
  3. On the Elements tab, click the New Element button to open the Select File Element window.
  4. In the Select File Element window, select the elements you want to add to the file and then click OK.
  5. If you selected Other as your type of file or want to see which element type is associated with a file, double-click the element on the Elements tab.
    • If you selected Logical as your file of type (on the General tab), all your elements are set with Specification+Implementation as the element type by default and the Element Type box is disabled.
    • If you selected Specification, all your elements are set with that element type. You can change this setting for an element if you want.
    • If you selected Implementation, all your elements are set with that element type. You can change this for an element if you want.
    • If you selected Other, you can set whichever setting is available from the Element Type list.
  6. To add a text element to a file, click the New Text Element button , to open the File Text Element window.
  7. Enter your text in the File Text Element window and then click OK.
  8. Click OK on the Features window to apply your changes.

Results

The CG::File::AddToMakefile property (which supersedes the previous GenerateInMakefileOnly property) enables you to include an external file (when the CG::File::Generate property is set to Cleared) in a build. The CG::File::AddToMakefile property works with the CG::File::Generate property. This technique is used in many of the IBM® Rational® Rhapsody® samples with GUIs to include resources (such as windows) built with MFC in a component. The external file is included in the makefile, and therefore compiled if needed (although not generated by the product). Using this property is equivalent to adding a file as an additional source under either a component or a configuration in the browser. See the definitions provided for the properties on the applicable Properties tab of the Features window.


Feedback