Component Menu

Allows you to hide or show an object, make a widget into a gadget, rename the topLevelShell's creation routine, and re-specify the creation routine parameters.

Select Component from the Resource Editor menu bar to display the Component menu:

Component Menu

Hide/Show

The object is displayed during your Builder Xcessory session. By default, Show is set. When you select Hide, the object is immediately removed from your display. A hidden object will not be shown in the generated code.

Make Gadget/Widget

Allows you to toggle between the widget and gadget variants of various Motif Primitives. The Class Name, as it appears on the Resource Editor, is updated dynamically.


Note: Make Gadget is insensitive if Java is the selected language.

Storage Location


Note: This feature is applicable for C only. In C++, object instances will be protected data members of a C++ class.

Builder Xcessory allows you to declare widgets outside the scope of the creation file. These widgets are accessible from anywhere within your program. While this is not recommended programming practice, we recognize that there are instances in which this capability is useful.

Select Storage Location from the Component menu of the Resource Editor to display the Storage Location dialog:

Storage Location Dialog from the Component Menu

Scope

Set the Scope text field to one of the following:

· Local

Default Widget ID Scope type. The widget is declared within the scope of the creation routine and is accessible only within the scope of the creation routine.

· Global

Creates a globally defined widget ID for simple instances or a widget structure for class instances. The declaration is placed outside of the creation routine in a definition file, allowing you to access the widget ID from anywhere else within the program.
Definitions are written to the definition file, creation-c.h for C, or main-uil.h for UIL. You can then include these files in other modules requiring access to these widget IDs.

· Other

Assumes that your entry in the Widget ID Scope text field (with the widget instance name again the default) is defined in outside of the creation file. Also assumes that the value is accessible from within the creation routine.
For example, setting Widget ID Scope type to Other and specifying param->one in the Widget ID Scope text field outputs a declaration of the form:
param->one = XtCreateWidget(...)
where param is assumed to be a pointer to a structure with member one of type Widget. Using this method, you can pass a pointer to a structure of all your widget IDs to the creation routine and make direct assignments to the structure members.

Widget

Specify widget ID names in the Widget text field for widget instances. The widget instance name is used as the default.

Class instances

For class instances, the Widget label changes to the name of a structure that contains all widget IDs in that class instance. You can specify any ID name in the Widget text field.The class instance name is used as the default.


Note: When editing classes in Classes View, Storage Location is insensitive. You are editing a template for a hierarchy of widgets rather than the widgets themselves. You must set Storage Location on a class instance in Instances View.

Storage location buttons

The following table lists and describes the buttons on the Storage Location dialog:

Button

Description

OK

Sets the specified storage location and widget ID name for the currently selected widget, and dismisses the dialog.

Apply

Sets the specified storage location and widget ID name for the currently selected widget.

Reset

Reads the last widget ID and storage location for the currently selected widget into the dialog.

Dismiss

Removes the Storage Location dialog.

C++, ViewKit, and Java Generation

Changing Storage Location does not alter the C++, ViewKit, or Java code generated by Builder Xcessory. All widget instances are automatically declared as protected members of the class and are accessible from within class instances. If you want to access these widget instances, add a public method to the class definition.

C Generation

When you set Storage Location for a class instance, if you generate C code, the structure itself is passed for types Local and Global. A pointer to the structure is passed for type Other (the location must be valid).

UIL Generation

In contrast to C generation, no structure is generated for class instances when you generate UIL. Only the widget ID of the uppermost widget instance in the class instance is stored. You can access other widgets using the XtNameToWidget call. Widget instances which are not within classes are generated just as in C.

Creation Routine

Select Creation Routine on the Component menu of the Resource Editor to display the Creation Routine dialog:

Creation Routine Dialog from the Component Menu


Note: The Creation Routine dialog is only available for children of topLevelShells.

A widget's Creation Routine is the routine in the creation-c.c file, called by the main-c.c routine, which creates the widget. You can rename this routine and specify the type and name of the parameter passed to the routine.

Procedure Name

Click the arrow button to the right of the Procedure Name text field to view a combination box containing all currently defined procedure names. Enter the name into the Procedure Name text field.

Parameter Type

If you enter a new Procedure Name, the default parameter type is None. If you choose an existing routine, the Parameter Type field displays the type assigned to the routine in the Procedure Manager. To change this type, the following conditions must apply:

· The procedure is not already referenced elsewhere.

· The type has not been applied to the widget.

Parameter Name

The Parameter assigned to the Creation Routine can be an identifier or an actual value corresponding to the Parameter Type. New identifiers entered in the Parameter text field will be created and displayed in the Identifier Manager with the appropriate Parameter Type. Constants are not valid Creation Routine parameter values.

Creation Routine dialog buttons

The following buttons are on the Creation Routine dialog:

· Apply

Sets the procedure as the creation routine.

· Delete

Clears the contents of the Creation Routine dialog text fields.

· Reset

Reads the last applied values back into the Creation Routine dialog.

· Dismiss

Removes the Creation Routine dialog.

Example

For example, if you specify the following for the child of a topLevelShell:

Creation Routine Example

A Creation Routine with these values generates the following function declaration:

Widget CreateWids(Widget parent, AStruct* a_param)

You can use the Creation Routine dialog to specify parameters which pass widget IDs between callbacks.

Class Source File


Note: In Java, you cannot edit this field because the file name must match the class name.

Click on Class Source File on the Component menu of the Resource Editor to display the Class Source File dialog:

Class Source File Dialog

Base Class File

Base name to which the C++ and C source and header suffixes will be appended. Set to the Base Class Name by default. For example, files generated from Base Class File "Foo" will be Foo.C (for the source file) and Foo.h (for the header file).

Derived Class File

Base name to which the derived class C++ source and header files will be appended. The default value is the Derived Class. For example, files generated from Derived Class File "foo" will have the default names FooDerived.C (for the source file) and FooDerived.h (for the header file). By default, not displayed.


Note: Builder Xcessory generates and displays derived files only if you set Generate Derived Files on the Code Generation tab of the C++ Language Settings dialog (from the Browser Options menu).

Generate Class

Select Generate Class to generate source code for the selected class. Set on by default. When linking a class into your application from a library, you can turn off source code generation.

Include By Reference

Select Include By Reference to forward reference a class without including its header files. Set on by default. If set off, includes the header of nested classes.


Note: This feature is available only when you select C++ or ViewKit as your current language.

 

Documentation: