Visual programming tool for developing software applications5862379Abstract A visual programming method implemented on a computer having a display screen and an input device which a user employs to draw visual representations on the display screen, including the steps of defining and supporting by computer implemented steps a set of object classes including a linking object class; in response to input from the user, selecting a first object class; in response to the user using the input device to draw a first visual representation on the display screen, generating a source object, which is an instance of the first object class and having a first set of events associated therewith; in response to input from the user, selecting a second object class; and in response to the user using the input device to draw a second visual representation on the display screen, generating a destination object, which is an instance of the second object class; in response to input from the user, selecting the linking object class; and in response to the user using the input device to draw a third visual representation that connects the first and second visual representations, generating a linking object, which is an instance of the linking object class and has associated therewith a set of user selectable predefined behaviors, each of which is in the form of a set of commands that defines actions that occur to the destination object in response to an occurrence of one of the events of the first set of events. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
TABLE 1
______________________________________
Objects property
Property Description applies to
______________________________________
Name Name of the object
All
Description Description of the
All
object
Parent Name of the object
All
that contains the
object
Bottom, Top, Left,
Coordinates that
All
Right, Height,
determine the size and
Width, and Layer
position of the object
in its container
object (either an
application window or
a group box)
TabIndex Position of the object
All
in the tab order of
the application window
Visible Whether the object is
All
visible or invisible
at run time
Enabled Whether the object is
All
enabled or disabled at
run time
BackColor Background color of
All graphic
the object objects except
line and static
text; all
Windows controls
except command
button and
scroll bar
Transparent Whether the object is
All graphic
transparent or opaque
objects, check
box, and option
button
Cursor Shape of the mouse
All except link
pointer when the user
and the timer
moves it over the
object
object at run time
Text Textual data Application
associated with the
windows; all
object graphic objects
except line; all
Windows controls
except scroll
bar; data
objects
FontName, FontSize,
Characteristics of the
Many of the
FontStyle, and
font of the textual
objects that
ForeColor data in the object
have textual
data
Justify Placement of the text
Many of the
objects that
have textual
data
LineColor, Object border and
All graphic
LineStyle, and
attributes of lines
objects except
LineWidth group box; text
box and list
box; links
(LineColor only)
DDEClientData Type,
Role of the object in
Application
DDEClientItem,
a DDE conversation
windows; all
DDEClientMode, graphic objects
DDEClientServer, except the group
DDEClientStatus, box; all Windows
DDEClientTimeOut, controls; data
DDEClientTopic, objects
DDEServerActive,
and DDEServerEnable
______________________________________
Other properties apply to just one or a few ViP objects. For example, only objects with a list box (list boxes and combo boxes) have the Contents property, which specifies the items in the list box. Also some objects have properties that apply only at design time. For example, the application window only has a grid at design time and, consequently, the Grid properties only apply at design time. Events A set of events is associated with each object. An event is an action that happens to an object. An event is a predefined system or user action that can be applied to an object. For instance, a command button is an object that has a Click event, which is the action of clicking an object. The user can attach a script to an event so that the script executes in response to that event. The user or system can cause an event to occur. ViP applications follow an event-driven programming model that has two underlying principles. One principle is that each object in an application can respond to a set of events predefined for that object. Another principle is that events initiate the execution of code in an application. The class definition for each ViP object defines the events that can occur for the object. Not all events apply to all objects. The class definition for most ViP objects includes the events described in the following Table 2.
TABLE 2
______________________________________
When this happens This event is triggered
______________________________________
The object is functioning as a DDE
DDEActivity
server and the DDE conversation
starts or stops.
The object is functioning as a DDE
DDEServerPoke
server and data from a DDE client
application arrives.
The object is functioning as a DDE
DDEActivity
client and data being sent from a DDE
server changes.
The object is functioning as a DDE
DDEClientArriving
client and data from a DDE server
arrives.
The DoEvent or DoEventArgs method
User
(with User as the event) for the
object box executes.
______________________________________
Some events apply to only a few objects. The DoubleClick, LeftClick, and RightClick events apply only to graphic objects. The GotFocus and LostFocus events apply only to objects that can be the focus of an application (that is, the data object and Windows controls). Some events apply to only one object. The Timer event applies only to timer objects. Some events are notification that something is about to happen. For example, a RowValidate event occurs when the user attempts to insert, modify, or delete a row of data through a data object. The data object passes a RowValidate event script a parameter that specifies which of these operations the user is performing. The event procedure can check the values the user has entered, for example, then accept or cancel the update operation. Events may also be triggered programmatically. Changing the State property of a check box in an event procedure, for example, triggers a Click event for the check box. Using a SetFocus method to move focus to a text box triggers the LostFocus event for the object that initially had the focus, then triggers the GotFocus event for the text box. Even though events are part of the class definition of an object, merely creating an object does not mean that the application performs any processing when an event occurs to the object. In an event-driven application, such as the ViP, the user determines the application flow of control by creating procedures to perform the processing the user wants when an event occurs. ViP has two types of event procedures: link behaviors and object event scripts. Methods Methods are object-oriented functions and subroutines that the user can use in event procedures to manipulate objects. Each object has a set of methods that operate on it. For example, all the ViP objects have a Move method that changes the position of the object in the application window or the position of the application window on the screen. ViP methods perform several types of processing. Some methods retrieve the value of an object attribute. For example, a GetProperty method retrieves the ASCII representation of the value of an object property. Other methods specify the value of an object attribute. For example, a SetProperty method specifies the value of an object property. And still other methods act as a keyword. For example, a Clear method deletes all of the items in a list box or the list box portion of a combo box. In most cases, the user can use a method in both standard applications and designer tools (see description below). The Clipboard object is a unique ViP object and has only a few methods. The class definition for most other ViP objects includes the methods shown in Table 3 below.
TABLE 3
______________________________________
Objects methods
Methods Description apply to
______________________________________
Class Retrieve the class
All
name of the object.
Position and Move
Reset the All
coordinates of the
object.
ClipboardCopy,
Copy data to and
All
ClipboardPaste
from the Clipboard.
DoEvent, Execute a script
All
DoEventArgs associated with an
event for the
object.
FindProperty,
Retrieve the names
All
FindEvent, FindLink
of the properties,
events, and links
associated with the
object.
GetScript, Retrieve and All
SetScript specify a script
for an object event
at design time.
GetProperty, Retrieve and All
SetProperty specify the values
of the properties
of the object.
Repaint Redraw the object.
All
CursorCopy, Change the cursor
All except the
CursorLoad associated with the
timer object
object.
FontSelect Present the Windows
All objects that
Font dialog box to
have the font
users to that they
properties
can change the font
of the textual data
in the object.
DDEClientExecute,
Manage the DDE Application
DDEClientPoke,
conversation of the
windows; all
DDEClientRequest,
object. graphic objects
DDEUseData except the group
box; all Windows
controls; data
objects
______________________________________
Other methods apply just to one or a few ViP objects. For example, only objects with a list box (list boxes and combo boxes) have the ItemAdd, ItemDelete, ItemFind, ItemFindExact, ItemGet, ItemInsert, and ItemSelect methods that the user can use to manage list box items. Also some objects have methods that the user can only use in a designer tool when the application is being designed. For example, as mentioned above, the user can only specify the script for an object event at design time; consequently, the user can only use the SetScript method in a designer tool. Permanent and Temporary Objects ViP has two types of objects, namely permanent objects and temporary objects. An object that the user creates at design time is a permanent object. ViP saves a permanent object as part of the ViP application. An object that the user creates at run time is a temporary object. ViP does not save a temporary object as part of the ViP application. A temporary object exists only in the scope of the application in which the user creates it. For example, if the user declares a temporary object in a Public module (see discussion of Public modules elsewhere), the temporary object exists during the entire execution of the application program. If the user creates a temporary object in an event script, the temporary object exists only while ViP executes that script. Creating and deleting permanent objects ViP allows a user to create a permanent object at design time by using the ViP designer or by using a user-generated designer tool. The way in which ViP enables a user to create a permanent object varies depending on whether the user wants to create an application window or another type of object. To create a permanent application window, the Designer window is used. To create other permanent objects, the toolbox is used to draw the object on an application window. Permanent objects can also be deleted. Again, the way in which ViP enables a user to delete a permanent object varies depending on whether the user wants to delete an application window or another type of object. To delete a design-time application window, the user selects and deletes the application window from the Designer window. To delete other permanent objects, the user selects and deletes the object from the design-time application window. Creating and deleting temporary objects In a run-time script, the user can only create temporary objects and instances of previously-defined application windows. To create a temporary object, the NEW keyword with either a LotusScript DIM statement or a SET statement (see Appendices 23 and 24) is used. The script syntax varies by object. To create an instance of an application window, an OpenAppWindow function is used. Temporary objects can also be created in a run-time script. To delete a temporary object, the LotusScript DELETE statement is used. To delete an instance of an application window, a CloseAppWindow function is used. Before the user can create or delete a temporary object, an object reference for the object must first be defined (see below). Setting up objects The user can set up an object for run time by defining the initial run-time characteristics of the object. A permanent object for run time can be set up by performing one or both of the following actions: (1) specify the desired property values at design time; and (2) specify initial run-time values in a script. Since a temporary object only exists at run time, a temporary object must be set up in a script. Setting up objects at design time When the user creates a permanent object, the object has default property values. In general, ViP saves these property values with the application and the design-time values of the properties become the initial run-time values of the properties. Consequently, to set up a permanent object, all the user typically has to do is create the permanent object and then specify new values at design time for any property for which default values are not desired. At design time, the user can specify non-default property values either by using the right-click menu for the object or by using a designer tool. Setting up objects in event procedures Since a temporary object only exists at run time, ViP requires that the user set up a temporary object in a script. ViP also enables the user to set up the initial characteristics of a permanent object in a script. For example, the user must set up a permanent object in a script if the user wants to specify initial run-time values for properties that: (1) ViP does not save at design-time, (2) the user cannot specify by using design-time menus and dialog boxes, or (3) depend on run-time, user-specific information. The script that the user uses to set up an object varies depending on whether the object is a permanent object or a temporary object. If the object is a permanent object, the user typically sets up the object in the Public module or the Init event script of the application window that contains the object. If the object is a temporary object, the user must set up the object in the script in which the object is created, unless the temporary object is declared in the Public module. In this case, the user can set up the object in any script in the application. Manipulating objects at run time When an event occurs to an object, ViP executes the scripts associated with the event and manipulates objects as requested by the scripts. The scripts can be either scripts that ViP generates when the user creates a link (i.e., a link behavior) or a script that the user writes using the ScriptEditor. A script consists of LotusScript statements that retrieve or specify the values of ViP properties, ViP methods, and ViP functions. The following sections discuss referencing objects in scripts, setting property values and using methods at run time, using objects to initiate application processing, and managing data on the Clipboard at run time. Referencing objects in scripts Before the user can write statements in a script to access an object, the object must have a variable called an object reference declared for it and be associated with the object reference. An object reference is a special kind of programming variable that is used to manipulate an object, either in an application open for design or in the running application itself. The process of establishing the association between an object reference and an object is called binding. When the code is compiled, ViP automatically generates code that declares an object reference for a permanent object and binds the object reference to the object. ViP uses the value of the object's Name property as the object reference name. As a result, in a script, the user can use the value of the object's Name property to identify each permanent object in the application window. Sometimes, however, the user needs to explicitly declare an object reference and bind an object to it in a script. The user needs to explicitly perform these actions to use a temporary object; to use a single object reference to manipulate a series of permanent or temporary objects on an application window; or to use a design-time object using a designer tool. In the case of a single object reference, the user must explicitly declare an object reference; explicitly bind it to one object; use it to manipulate the object; then explicitly bind it to another object; and so on. In the case of a designer tool, while it is running, it declares and binds variables to objects in the application that is currently being designed. In all of these situations, the LotusScript DIM and SET statements are used (see Appendices 23 and 24, respectively, for more detailed descriptions of those statements and their proper usage). In general, the DIM statement is used to declare an object reference. The user can declare an object reference of a specific class, for example, Rectangle, or of the generic object class, Object. If the user declares an object reference to a special class, the user can only bind it to instances of that class. For example, if the user declares a Rectangle object reference, the user can only bind it to rectangles. If the user declares an Object object reference, the user can bind it to instances of any class. For example, if the user declares an Object object reference, the user can bind it to text boxes, rectangles, or command buttons. In the following example, the DIM statement declares MyCheckBox as a ViP object variable of the class CHECKBOX: DIM MyCheckBox AS CHECKBOX The user can also declare an object reference and create a new object by using a single SET statement. The SET statement is used with the BIND keyword to bind the object reference to an object. The user can include a path that identifies the application window that contains the object as part of the name of the object. In the following example, the SET statement binds the ViP object variable MyCheckBox with the ViP object named Checkbox1: SET MyCheckBox=BIND("Checkbox1") Setting properties and using methods at run time ViP enables the user to explicitly specify and retrieve the values of properties in object event scripts. Specifying a value for a property is called setting a property. The generic syntax to set a property in a script is shown below: ObjectReference.PropertyName=Property Value For example, if the value of the State property of a check box is TRUE, the check box is selected. In a script, the user can select a check box called Check1 by including the following statement: Check1.State=TRUE Retrieving the value of a property is called getting a property. The generic syntax to get a property in a script is shown below: PropertyValue=ObjectReference.PropertyName For example, the user can retrieve the value of the State property of a check box into a variable called Selection by including the following statement in a script: Selection %=Check1.State Many link behaviors also set property values. For example, the user can create a link from a column label in a data object to a check box with a SetStateFromCell link behavior. This link behavior selects a check box when the text of the check box matches the text of the current cell in the result set of a data object. Methods are object-oriented functions and subroutines that the user can use to manipulate objects at run time. The user can use methods in an object event script. For example, the user can use the PictureCopy method to copy a picture from one object to another object. The ExecuteQuery method executes the query defined for a data object. Some link behaviors are, in essence, augmented methods. For example, the PictureLoad method loads a picture from a file into an object. The PictureLoadFromList link behavior loads a picture into an object from a file named by the selected item in a single-selection list box or the list box of a combo box. Setting some properties and executing some methods in object event scripts and link behaviors at run time raises certain events. For example, when the SetStateFromCell link behavior (described earlier) changes the State property of a check box, it raises a Click event for the check box to occur. Using the SetFocus method to place focus on a text box causes the LostFocus event for the object that previously had focus, and it causes the GotFocus event for the text box. Initiating application processing Even though events are part of the class definition of an object, merely creating an object does not mean that the application performs any processing when an event occurs to the object. With ViP, the user determines the flow of controls in the user's application by creating procedures to respond to certain events. ViP provides two types of event procedures: link behaviors and object event scripts. This section discusses using link behaviors and object event scripts to initiate application processing. Using links As noted above, a link behavior is a LotusScript script that ViP generates when the user creates a ViP link from a source object to a destination object. The script is executed when the Cause of the link occurs (i.e., when an event is raised for the source object). The user can also modify this script. To initiate application processing by using a link behavior, the user creates a link with the link behavior that the user wants. When an event occurs to the source object, ViP executes the link behavior script for the link. Using object event scripts An object event script is a script the user writes using the Script Editor. When the user writes the script, the user specifies the particular object event that he wants the script associated with. When the object event occurs, the script executes. Managing data on the Clipboard at run time The Clipboard is a temporary storage area that is used in Windows when the user is copying or moving data. ViP includes a special Clipboard object that lets the user access the Clipboard and move ViP objects, text, pictures, and DDE links in a script. The user can access the Windows Clipboard at design time and run time; the user can only access the Clipboard as an object from a running ViP application. The Clipboard object does not resemble any other ViP objects. Each ViP application has only one instance of the Clipboard object, and ViP automatically provides that instance to each application at run time. The user does not have to create an instance of the Clipboard object, create an object reference to the Clipboard object, or bind an object reference to the Clipboard object. Characteristics of the Clipboard object Unlike other ViP objects, no events apply to the Clipboard object and the user cannot use the Clipboard object as the source or destination object of a link. Also, most of the generic ViP properties and methods do not apply to the Clipboard object. The only property that applies to the Clipboard object is Text. The only generic methods that the user can use with the Clipboard object are Class, FindProperty, GetProperty, and SetProperty. The Clipboard object also has the special methods outlined in the following Table 4.
TABLE 4
______________________________________
Method Description
______________________________________
Empty Remove all data from the Clipboard
FormatAvailable
Retrieve the name of the data formats
for the data on the Clipboard
______________________________________
Copying data and pasting data To copy and paste data to and from the Clipboard, ViP provides the user with two generic methods that apply to all objects except the Clipboard object, namely the ClipboardCopy method and the ClipboardPaste method. The ClipboardCopy method copies data from an object to the Clipboard. At run time, the user can use this method to copy the text, picture, or DDE link from an application window, chart, check box, combo box, command button, data object, ellipse, group box, line, list box, OLE object, option button, rectangle, scroll bar, static text, text box, or timer. The types of data that the user can specify varies by object. At design time, the user can also use the ClipboardCopy method to copy the internal structure of a ViP object from an application window to the Clipboard. The ClipboardPaste method pastes data from the Clipboard into a ViP object. At run time, the user can use this method to paste the text, picture, or DDE link from the Clipboard into an application window, check box, combo box, command button, data object, ellipse, group box, line, list box, OLE object, option button, rectangle, scroll bar, static text, text box, and timer. The types of data that the user can paste varies by object. At design time, the user can use the ClipboardPaste method to paste the internal structure of a ViP object from the Clipboard into an application window. LINKING VIP OBJECTS A link is a ViP object that the user can use to add functionality to an application. A link connects two other ViP objects and allows an event associated with the source object (i.e., the object the user draws the link from) to execute a script that changes or in some other way affects the destination object (i.e., the object the user draws the link to). The activities generated by the script are called the link behavior. For example, FIG. 14 shows a visual representation of a link 200 between a data object 202 and a chart object 204, as ViP displays it on the user's screen. In this case, data object 202 is the source object, chart object 204 is the destination object, and SetAndDrawChart is the link behavior. An arrow 206 displayed in the visual representation of link 200 indicates the direction in which the link is drawn. The SetAndDrawChart behavior is predefined and supplied with ViP. It is the default behavior for a link between a data object and a chart object. The default cause for this behavior is the Execute event associated with the data object. The script for the SetAndDrawChart link behavior looks like this:
______________________________________
'=====================================
'Set the data source for a chart and draw the chart.
'=====================================
dim RetCode%, I%
Dest.ChartSource = Src.Name
for I = 1 to 24
RetCode% = Dest.SetColumnUsage(I, DONTCHART)
Next I
RetCode% = Dest.DrawChart()
______________________________________
Each time the Execute event occurs for the data object, this script sets the data object as the data source and plots the data in the chart. ViP provides other predefined behaviors and cause events for this link. The user can choose another behavior to change what the link does, or another event to change the activity that causes the link to execute. Creating a ViP link The user can create a link and include it in an application only at design time. To create a link, the user draws a source object and a destination object in an application window that is open in the ViP Designer. The user then selects the link object from the Designer Toolbox, clicks the source object to anchor the link, and drags the link to the destination object. ViP displays the link and a label that identifies the default behavior for the link; if no behavior is defined for the link, ViP displays the link and a label that contains ??? (i.e., question marks). ViP also sets the default cause for the link, enables the link, and assigns default values to other link properties (including Name, LineColor, and LineWidth). The user can change these properties at design time to meet the user's design requirements. To automate the process of creating links at design time (e.g. using the same link(s) repeatedly throughout an application), the user can create a ViP designer tool application that defines the links the user needs. (See discussion below on creating designer tools.) Choosing source and destination objects Any ViP object, except the application window and the Clipboard object, can be used in a link. The objects the user chooses depend on what he wants the link to do and on what the properties, methods, and events of an object allow him to do. His choice of objects may also depend on whether the predefined behavior he needs exists for the link and, if the behavior does not exist, on whether he wants to create it. Drawing a link in the right direction Because each ViP object class has a unique combination of properties, methods, and events, the data and activities generated for a link depend on how objects are paired in the link. The predefined link behaviors provided in ViP reflect these differences. For example, in a link between a text box and a data object, the CellSetQuery behavior is available only when the user draws the link from the text box to a query cell in the data object. The behavior is not available when the user tries to draw a link from the query cell to the text box because a query call cannot function as the source of a ViP link. The CellSetQuery behavior is also not available when the user draws a link from the text box to the title bar or to a column label in the data object because the properties, methods, and events available in these links cannot be used to set a query. In the link 200 between data object 202 and the chart object 204 shown in FIG. 14, the SetAndDrawChart behavior and the Execute event are available only when the user draws the link from the title bar of the data object to the chart but they are not available when the user tries to draw a link from a column label or query cell. They are also not available when the user draws the link from the chart to the title bar because the Execute event is not available to the chart object, and the data that can be provided to a data object from a chart is different from the data that can be provided to a chart from a data object. Using objects that are alike In some cases, the properties, methods, and events available to different objects are very similar. For example, the rectangle and ellipse are two graphic objects that have the same combination of attributes, with one exception. The rectangle has a CornerRounding property. All other properties, methods, and events are the same. This means that the same types of data and activities can be generated from both objects (with the exception of data and activities related to corner rounding). The predefined link behaviors for these objects reflect this similarity. If the user creates a link from a rectangle to an ellipse and from an ellipse to a rectangle, the same predefined link behaviors are available (e.g. the PictureCopy, PictureLoad, and TextCopy behaviors). Similarly, if the user links a rectangle to a check box and an ellipse to a check box, the same predefined link behaviors are available (e.g. the TextCopy and ToggleState behaviors). This means that the user can accomplish the same task in a link by using a rectangle or an ellipse as the source object. The user can choose the one that best suits the design requirements. In addition to graphic objects such as the rectangle and ellipse, controls such as the command button and check box can often be used interchangeably in links. For example, the Directory, ItemAdd, and Select behaviors, are among others, are available for a link from a command button or a check box to a list box (see Appendices 1-20 which provides a complete list of behaviors for all of the ViP objects). Working with link behaviors ViP provides predefined behaviors for most, but not all, links that the user can create. In many cases, including the examples, discussed earlier, several behaviors are defined for a link so that the user can perform different tasks with the same pair of linked objects. These predefined link behaviors are stored in an external repository, e.g. an ascii file or a Notes Database 11 that is read into a VIPLINK.BHV file 111 (referring to FIG. 2). An example of the VIPLINK.BHV file is presented in Appendix 21, attached hereto. The VIPLINK.BHV file is a read only file to prevent alteration by the user. When a user draws a link, ViP gives the user access to the list of predefined behaviors associated with that link. For example, the user can link a text box that contains text to the title bar, to a column table, and to a query cell in a data object that is connected to a data source. As the user creates each link, the name of its default behavior is displayed in the link label. The user can then access the Link Setup dialog box (see FIG. 9) from the right-click menu for the link. The Link Setup dialog box includes two regions, namely a Link Info region 157 and a Behavior region 159. The Link Info region displays information about the link. The Behavior region allows the user to access and modify the behavior of the link. The Link Info region includes a name box 163 and an order box 164. The name box 163 displays the name of the link that is being modified. The order box 164 displays the order property of the link. The Behavior region includes a cause box 165, a behavior list box 132, and a script text box 167. The Cause box 165 identifies the event in the source object which triggers the link event, i.e., the event which executes the script attached to the link object. If the user clicks on the cause box, ViP displays a list of events that are associated with the source object. By highlighting one of the events in the list, the user can select another event which will cause the execution of the link behavior. The Behavior list box lists the behaviors for the link, with the default behavior highlighted. The user can selected another behavior from the list by clicking on it. The script text box displays the script for the selected behavior. By clicking on the script editor button 134, the user can access and modify the script that is displayed. The details of how ViP identifies the predefined behaviors for a link as it is being created by the user are as follows. When ViP starts up, it reads the contents of two .bhv files (i.e., VIPLINK.BHV and USERLINK.BHV--to be described later) into a table in memory, which is a simple relation data structure, i.e., an associative table. As the user is drawing a link between two objects, the underlying code identifies the source and destination object. As soon as it has the identity of the destination object, ViP constructs a query against the internal table in memory for all possible behaviors associated with that combination of source and destination. It organizes the results of that search into some order (e.g. alphabetical order) and it then displays the name of the first behavior as the default behavior. When the user releases the mouse button, ViP extracts the script for the default behavior and attaches it to the link event in the link object. When the Link Setup dialogue box is opened up, ViP compiles and displays within the behavior list box 132 (see FIG. 9) a list of all possible behaviors for the relevant combination of source and destination. If the user selects a behavior that is different from the default behavior, ViP extracts the relevant script for that behavior and attaches it to the link in place of the default script (using the generic SetScript method--see Appendix 32). Changing the behavior of a link At design time, the user can change the behavior of a link by selecting another behavior in the Link Setup dialog box. The user can also change link behavior by using the Script Editor to change the behavior's script or to add a new script. The script of a predefined behavior identifies all variables the behavior needs to perform its tasks. The user may, however, want to change the data that the behavior uses or to change what the behavior does. For example, the script for the Directory behavior (shown in FIG. 15) identifies the directory whose file names are copied to a list box when the behavior is executed. By default, the behavior uses the current directory. The user can, of course, specify another directory, group of files, and/or file type by changing the values for Path$, Pattern$, and/or FileType % in the Directory script. Code comments within the script indicate how to make the changes and provide examples. When the user changes values in a behavior for a link, the changes affect the behavior of that link only, and the link becomes a custom link. The changes do not affect other links with the same behavior or the copy of the behavior stored in VIPLINK.BHV in the ViP directory. Rather the customized link behaviors are stored in another separate file called USERLINK.BHV 113 (see FIG. 2). The USERLINK.BHV file is a read-write file so the user can add other behaviors, modify existing behaviors in the file and delete behaviors. ViP uses both the VIPLINK.BHV file and the USERLINK.BHV file to create the list of behaviors that is available for a link and displayed in the Link Setup dialog box. Setting the event that causes a link behavior to execute When the user creates a link that has predefined ViP behaviors, one of the events associated with the source object is set as the default cause for the link. The user can change the cause at design time in the Link Setup dialog box. For example, in a link from a command button to a list box, the Click event for the command button is the default cause for the link. This means that the Directory behavior (i.e., which is the default behavior) or another behavior the user selects from the link will execute each time the user clicks the command button at run time. If the user does not want the Click event to trigger link behavior, another event may be selected. In this case, the user can select a Gotfocus event, a Lostfocus event, or one of the DDE events associated with the command button (see Appendix 18). Any event associated with the source object in a link can be used as the cause for the link behavior. ViP processes a source event as follows. Each link registers for the source event which will trigger execution of its behavior or script. When a source event occurs, internal event processor code within ViP identifies the links that are registered for that event and propagates the event to all registered links. For each of those links, ViP raises a link event which causes the execution of the behavior or script that is attached to the corresponding link event in the link. Controlling other run-time activities In addition to setting the behavior and cause event for a link, the user can enable and disable a link, and the user can specify whether the link is triggered each time--or only the first time--the cause event occurs. The user can also control the order in which links are triggered. Enabling and disabling a link When the user creates a link, the link is, by default, enabled and set to execute every time its cause event occurs at run time. ViP enables the user to change this functionality at design time, to disable the link so that it does not execute, or to leave it enabled and set it to execute once at run time and then be disabled. The user can make these changes through the Link Setup dialog box (e.g. see FIG. 9). The Link Setup function includes a user selectable option 162 labeled "Execute link once, then disable." If the user selects this option, the Link Setup function sets a Autodisable property (see Appendix 18) in the link object to true. The Autodisable property is set to true, the link is immediately disabled after it fires. This is a very useful feature that avoids the problems that arise if loops are created within the application under design. The autodisable property prevents the loop from closing on itself and altering data among which a selection was just made. That is, the user need not worry about constructing the application to avoid closed loops within the code but can simply use the autodisable property to break any programming loops that produce undesired results. The user can also enable and disable a link at run time through a script attached to an event in the application. For example, the user can design a link that is initially disabled and then enable it at run time by setting the Enabled property of the link object to TRUE in a script: Link1.Enabled=TRUE Specifying the order in which links are executed By default, ViP executes links by object and by cause event in the order in which the links were created in an application window. For example, FIG. 16 shows an application window that contains five links, numbered from 1 to 5 to indicate the order in which they were created by the user. The first, third, and fifth links connect Command1 to the ellipse, the list box, and the time, respectively; and all three are triggered by a Click event for Command1. The fourth link connects Command1 to the list box and is triggered by a DDEActivity event for Command1. The second link connects Command2 to the list box and is triggered by the Click event for Command2. By default, the links execute as follows. When the user clicks Command1, the first, third, and fifth links execute, one after the other. When a DDEActivity event occurs, the fourth link executes. When the user clicks Command2, the second link executes. The user can change the execution order for links at design time by specifying another order number for a link in the Link Setup dialog box. Referring to FIG. 9, the Link Setup menu 130 includes an Order box 164. When the user enters another number in this box, ViP automatically renumbers all links whose order numbers are affected by the change. Managing links at design time When links are created at design time, the user can identify and keep track of them in several ways. The user can change a link's name, line color, and/or line width property to uniquely identify a link in an application window. The user can also selectively show or hide links in an application window, view information about the links the user creates, and test link functionality. Naming links The default name of a link, which represents the programmatic name of the link, consists of the prefix Link and a number that makes the link name unique in the application. The link name is displayed in the title bar of the right-click menu for a link and in the Link Setup dialog box, and can be used in scripts to retrieve the information about a link or to enable or disable a link. The user can change the name of a link at design time by changing the Name property in the Link Setup dialog box. The user cannot change the name of a link at run time. Change link color and line width ViP provides eight colors and five line widths that the user can use to group or differentiate links in an application window at design time. The default color for a link from any object to a query cell in a data object is green; the default color for all other links is red. The default line width for a link in one pixel. The user changes line color and width in a Lines & Color dialog box, which is accessible from the right-click menu of a link (see FIG. 8). Showing and hiding links The user can also manage links at design time by using a Designer Tool to selectively show or hide links in an application window that is open for design by changing the visibility property for the link. The user can choose to show all links, show links to or from selected objects, or hide all links. Customizing link behaviors The user creates a new link behavior by defining the behavior in the USERLINK.BHV file. The user does this by using any ASCII text editor to enter a name, a summary, source and destination information, comments, and a script for the behavior. When the user saves the updated file, the new behavior is available to links between the source and destination objects specified in the behavior definition. The user can modify a link behavior in two ways. To modify the behavior for an individual link, the user can change the behavior script in the Script Editor. To modify a behavior for all links in which the behavior is used, the user uses an ASCII text editor to change the definition of the behavior in the USERLINK.BHV file. If the user wants to modify a behavior supplied by ViP in the VIPLINK.BHV file, the user must copy the behavior definition from the VIPLINK.BHV file to the USERLINK.BHV file. The user can then change the name of the behavior, the summary, source, and destination information, the comments, and/or the script for the behavior in USERLINK.BHV. The original behavior in VIPLINK.BHV and the modified behavior in USERLINK.BHV are then both available for links in ViP. APPLICATION STRUCTURE ViP API A ViP application is a collection of one or more windows, called application windows, that contain objects. There is an AppWindow object that represents the application window itself. ViP objects, along with their properties, methods and events, constitute a ViP Application Programming Interface (API). The API also includes functions that are not associated with particular objects. Modules in an application Referring to FIG. 17, ViP provides two kinds of modules: application window modules 300 and Public modules 302. All the scripts written for all the objects in an application window are compiled together to form an application window module 300, which contains all of the executable LotusScript code (including ViP API functions) for the application window. One application window module exists for each window in an application. Public module 302 is generated by compiling a Public script. This script is separate from any application window and not associated with any ViP objects. It contains only variable declarations and procedure and type definitions. The user can use the public declarations and definitions the user puts in the Public script in any other script in the user's application. For instance, if the user defines a public procedure PublicProc in the Public script, the user can call PublicProc from any script in any of the user's application windows. To declare public variables or to define public types, subroutines, or functions in the Public script, use the LotusScript keyword public. The user can use the public keyword only in the Public module. ViP prevents the use of public in other modules. Special scripts in an application window module Among the scripts the user can write for the AppWindow object (i.e., the application window itself) are the Declarations, Init, and Term scripts. The Declarations script contains only variable declarations and procedure and type definitions. The declarations and definitions in the Declarations script are available to all the objects in the application window. Unlike other scripts in an application window, the Declarations script is not associated with an event. The Init script executes once when the Init event occurs (see Appendix 1), i.e., when the application window is loaded into memory. The Init script is useful for carrying out instructions that initialize the application window. For instance, if the user wants a list box to automatically contain items when the window is opened, the user puts instructions to fill the list box in the Init script (e.g. by using an ItemAdd method). The Term script executes once, when the Term event occurs (see Appendix 1), i.e., when the application window is removed from memory. The Term script is useful for carrying out instructions that do clean up work before the window is unloaded. For example, the user may want to save files or data that was modified. The ViP Connection Record The connection registry, which is an internal connections list, contains a list of connection records. There are two parts to a connection record: the physical part and the logical part. The physical part describes the physical location of the data, e.g. server name and database. The logical part describes how the data is stored, e.g. the table/column names for relational databases or view/form and field structure for Lotus Notes. When creating a data object, the user specifies the connection name. To do this, the user may pick from a list of existing connections or define a new one. There are several important aspects about the application connection-registry and its relation to the data object. Each data object contains a Connection property (see Appendix 15). This is a name that refers to a database connection record in the per-application registry. The database connection registry belongs to the application as a whole, not to any screen. The database registry contains zero or more database connections. A database connection is defined once within each application. Thus, the connection name is unique within the application. However, another application can use the same connection name for the same or a different database. Internally, a ViP data access layer matches the connection based on the values of the Model, Driver/Server, and Database. On disk, the ViP application file contains the application information and the database registry containing zero or more connections. These connections are implemented as Bento (container file format) objects. When a ViP application is started, the application information and all the connections are read into memory. When a ViP application under design is saved to the disk, the list of connection records is stored to disk. When a ViP application is loaded, the connection information is restored. In memory, each connection has a connection name, definition information, and runtime information. The definition information includes the information mentioned above. The runtime information includes what levels are actually connected and what ID and/or password was used for the runtime connection to the level. The ViP application developer assigns each connection record a name. This name acts as a unique key. Once a connection record is defined, the ViP developer can directly manipulate it with two functions: a ConnectionGetDef function and a ConnectionSetDef function. The ConnectionGetDef function retrieves, as values, the current definition of a data source connection based on the name of the connection. The ConnectionSetDef Function specifies the current definition of a data source connection. Scope of declarations and definitions Scope is the area of an application in which a declaration or definition is known. ViP applications have three scopes: public, module, and procedure. Public variable declarations and procedure and type definitions in the Public module have public scope. That is, they are known to all the modules in the application. For instance, if the user declares a public variable in the Public module, the user can then access and modify that variable from a script in any application window module in that application. Variable declarations and procedure and type definitions in the Declarations script of an application window module have module scope. That is, they are known to all the objects in that application window. For instance, if the user declares a variable in a Declarations script, the user can then access and modify the value of that variable from any other script in the same application window as the Declarations script. Private variables, procedures, and types in the Public module also have module scope. They are known only within the Public module. Variables and parameters declared in a procedure have procedure or local scope. They are known only within the procedure in which they are declared. When the procedure ends, the variables and parameters no longer exist. Compiling applications An application window must be compiled before it will load and execute. A compiler within ViP translates the scripts into LotusScript object code. Both the uncompiled and compiled versions of the application file have a .VIP extension. An application window is compiled with the most recent version of the Public module. The user can either compile the Public script and application windows explicitly, using ViP Designer menu commands that are accessible through the menu bar of the designer window, or ViP will compile them automatically when the user saves the application and when the user runs it. The user can also compile individual scripts explicitly from the Script Editor to check syntax. The Public module is compiled before any other modules in an application are compiled because it may contain declarations and definitions that can be used by all the other modules in the application. When the Public module is compiled, ViP automatically loads it into memory so it is available to other modules when they are compiled. If the user compiles an application window or an individual script, and the Public module needs to be compiled, ViP automatically compiles the Public module before compiling the application window or script. The user can explicitly compile application windows using ViP Designer menu commands, and individual scripts using the Script Editor. For example, the compiler functionality is accessible through a drop down menu 272 that is associated with a Script option in the menu bar of the Script Editor (see FIG. 5). If the user runs an application from the Designer, ViP compiles the Public module first, if necessary, and any application windows that have never been compiled or that were compiled with a previous version of the Public module. Application windows are compiled as they are opened. If the Public module or startup window (described below) does not compile successfully, ViP opens the Script Editor, displays the script containing the first error, and highlights the line in error. If any other application window does not compile, a runtime error is generated. If the user runs an application from the ViP Desktop, ViP does not compile any modules, even if they were never compiled. If ViP encounters an error at run time because an application window needs to be compiled or recompiled, it will be unable to open the window. Unless the user has included a statement to handle the error by halting the application (using the API function AppHalt), ViP will continue to run the application if possible. That is, ViP still allows other windows to be opened. Load order in an application ViP loads the Public module into memory as soon as the application starts running. When an application window is opened, ViP loads its associated module into memory and executes the Init script, if there is one. If a runtime error occurs in the Init script and the user has not included statements to handle the error, ViP continues running the application. Otherwise, the error-handling statements are executed. The first window to be opened and executed when a ViP application is run is the startup window. If an application has multiple windows, a window can open other windows using the OpenAppWindow function. Execution order in an application Because ViP applications are driven by events, the order in which scripts are executed is determined by the design of the user's application and how other users interact with the application. As events occur, the scripts attached to them are executed. The user can impose as much or as little control over the ordering of events as the user's application requires. There may be occasions when the user needs to restrict the order in which events occur. For example, if the user's application makes a series of calculations, one calculation may depend on another. There are a number of ways the user can prevent the dependent calculation from being performed until the other calculation is performed. For example, if the script associated with Event B depends on the result of the script associated with Event A, the user could disable the object Event B is associated with (Object B) by setting its Enabled property to FALSE. Then the script for Event A could as a final step enable Object B. Another way to handle this situation would be to set a flag at the end of the script for Event A. Then, at the start of the script for Event B, the user could include a conditional statement that checks the flag to make sure that Event A occurred. If Event A has not occurred, then the script for Event B displays a warning message and terminates. Events can occur in three ways. Events can occur as a result of a user action. For example, a user clicks a command button and the Click event occurs for that command button. Events can occur as a result of a system action. For example, a specified amount of time elapses and the Timer event occurs. And, events can occur as a result of the execution of a statement in a script. For example, when a script statement that assigns text to a text box executes, that causes the Change event to occur for that text box. The operating system (e.g. Microsoft Windows) handles events that are caused by user or system input. The operating system places the input in a message queue. ViP checks the queue and generates ViP events based on the queued messages. Since the input is ordered serially, ViP receives messages and executes event scripts serially. The script for the first event to occur is executed and completed before the script for the second event begins, and so on. Events caused by the execution of statements in a script are nested; that is, one event can be initiated before a previous event completes. The script for the most recently initiated event must complete before the script for the event that initiated it can continue, and so on. While the nested events are executing, other events, if any, remain in the Windows queue until the nested events finish executing. Then control returns to Windows, and the queued events are executed in order, first to last. When execution of both a link behavior and a script is caused by the same action, the script executes first. CREATING DESIGNER TOOLS Designer tools are ViP applications that help the user design other ViP applications. ViP enables the user to create designer tools much in the same way as the user creates any ViP application. Using designer tools requires two applications: the tool, which is an executing ViP application, and another application open for design (referred to as the design application or application under design). The tool includes user-entered scripts that enable it to manipulate objects in the design application. For example, the tool might include a script that sets properties for the currently selected object or objects in the design application. If the script is attached to the Click event for a command button in the tool, it will execute when the user or another application designer clicks the command button. A designer tool is able to manipulate objects in an application being designed by declaring a special variable called an object reference and associating it with an object in the design application. The tool can then refer to that object in the design application indirectly, through the object reference. The process of establishing an association between an object reference and an object is called binding. The user can declare an object reference of a specific object class, for instance Rectangle, or of a generic class, called Object, described below. Generic object references Generic object references are special in that the user can bind them to objects regardless of the class of the object. This feature is very convenient for creating designer tools because the user usually does not know in advance what objects in a design application the user's tool will be working on. A detailed description of the generic object is presented in Appendix 20. A generic object reference can be bound to any class of ViP object because the Object class possesses only the generic object properties. Generic properties are properties that ViP objects have in common. For instance, all ViP objects have the generic properties Left, Right, Top, and Bottom, which determine the position of the object in the application window or the position of the application window on the screen. Also, most of the ViP objects have the generic property BackColor, which determines the background color of an object. The user can get and set only generic properties through a generic object reference. If the user binds a generic object reference to an object and tries to get or set the value of a generic property not associated with that object, the attempt is ignored at run time. For instance, if the generic object reference ObjRef is bound to a command button, the statement ObjRef.ForeColor is ignored at run time because the Command Button object does not have a ForeColor property. If the user tries to get or set the value of an object-specific property using a generic object reference, an error is generated at compile time. For instance, the statement ObjRef.CommandButtonStyle does not compile because CommandButtonStyle is not a generic property. How to bind object references to objects The Bind form of the LotusScript SET statement (see Appendix 24) can be used to bind an object reference to an object or a set of selected objects in a design application window. The Bind form of the SET statement takes a string parameter that identifies an object by its name and the application window in which it resides, and returns a reference to the object. The string parameter the user passes to the Bind form | ||||||
