[Top] [Prev] [Next] [Bottom] [Contents]

Activator Code

The Activator Code interface is the place where supporting C/C++ code for an Activator is added. Each Bound Activator maps to a function call in the generated CGI code. The Activator Code interface is a code template for this function.

States of the Activator Code Interface

Figure 2-29 The Activator Code Interface

About the Activator Code Interface

Area Description
Global This section is used for C/C++ code that is global to the module that contains the Activator's function. Any valid code can go here, including functions used in supporting operations not specific to the Activator and its Object Bindings.
Initial Code entered in this section goes at the top of the function. Local variables can be added here as well as code that comes before any Object Bindings are executed.
Before This section's code is written just before the associated Object Binding is executed. When an Object Binding is selected in the Object Bindings list, that Object Binding's Begin code is displayed. By selecting Object Bindings in the Object Bindings list, code can be inserted to execute between each Object Binding.
Bind Invokes an instance of the Object Bind Editor with the selected Object Binding automatically loaded.
Object Bindings A list of all the Object Bindings associated with the Activator. The order the Object Bindings appear in the list is the order in which they will be executed at run-time.
After This section's code is written just after the associated Object Binding is executed. When an Object Binding is selected in the Object Bindings list, that Object Bindings After code is displayed. By selecting Object Bindings in the Object Bindings list, code can be inserted to execute between each Object Binding.
Final Code entered in this section goes at the bottom of the function. Code that comes after all the Object Bindings are executed goes here. An example of code to insert here is code that deallocates memory that was allocated in a previous section.
Shuffle-Up This is used to reorder the Object Bindings list. Shuffle-Up exchanges the selected Object Binding in the Object Bindings list with the column above it. The order of the Object Bindings is the order they will be executed.
Shuffle-Down This is used to reorder the Object Bindings list. Shuffle-Down exchanges the selected Object Binding in the Object Bindings list with the column below it. The order of the Object Bindings is the order they will be executed.

Usage Example

If you have a Sapphire project that allows a user to fill out an HTML form and then display the results to an HTML result template, you can display on your Web Browser what the user has selected.

Use the Sapphire Activator Code from the Object Bind Editor. In the "Function Initialization Code" initialize some variables and then assign these variables using SaGetInputValue. You can then use a simple printf statement to print the variables in the "After the Object Binding Code" by using the following sample code:

/* Start of initial Code */
char *var1, *var2, *var3;
var1=SaGetInputValue("formvar1");
var2=SaGetInputValue("formvar2");
var3=SaGetInputValue("formvar3");
/* Users Final Code is entered here */
printf("you entered the following: %s,%s,%s\n", var1, 
var2, var3);

How to Invoke the Interface

1. The Project Window's Selected Activators Pop-up
2. The Project Window's Selected Activators Button Bar
3. The Object Bind Editor's Edit menu
4. The Object Bind Editor's Activator Code button

Text Editors

Note that in every occurrence of the button, a simple text editor is invoked. This text editor enables the developer to add large amounts of code more easily than entering directly into each code section. It also provides the ability to read an external test file and save it into the associated code section. The text editor is fixed and you cannot integrate your own. However, insertion of your preferred HTML tag editor is supported.



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.