Creating Links
Link buttons can be placed on the Diagram window or child Diagram windows by selecting the Create Link button in the toolbar in the Professional license. A dialog window will appear after clicking this toolbar button in which the caption and link properties can be specified and assigned to a button that will appear on the foremost Diagram window. The caption, bitmap picture, and properties can be changed at a later time by right-clicking (or double-clicking) on the link button while the Diagram window is in development mode to bring up the Link Button Properties dialog shown below. Also shown is the button that will appear when OK is clicked.
The drop-down control under the word Caption at the upper left of the dialog provides four options: Plain button; Button will standard icon; Button with picture; and Transparent Button. The Plain Button option will create a button with the specified caption positioned as indicated in the location fields with a width and height as specified in the size fields. (These fields require values in pixels, using the resolution of your monitor.) The Button with standard icon is very similar to the Plain button except that it will contain a small icon to the left of the caption that you can select from the drop down control. The Picture button will cause the button to display as a picture. In place of the Caption, a Picture edit field will appear at the top of the dialog where you can enter/edit the file name for the picture. The picture can be any graphic with a file name extension of.bmp, .emf, .gif, .png, or. tiff. Clicking in the picture name field when it is empty will automatically activate a Windows dialog with preview capability to select the picture. After the picture is selected, an option will appear to set the size of the button to the size of the picture. The alternative is to specify the width and height of the button. The picture will then be scaled to this size. The last option is a Transparent button. In this case, the Link Button is invisible in application mode (i.e., you can see through it) but it is visible in development mode. This capability is useful when you wish to place the button over a section of a drawing so that clicking on drawing provides some action.
A Name field is provided to associate this button with EES variables. If a name is provided, e.g., LinkReturn, EES will create variables LinkReturn.left, LinkReturn.top, and LinkReturn.Hide. (Note that the names of the attributes that can be specified with EES variable names are underlined in the dialog when a name is entered.) The created variables can optionally be assigned values in the EES program. For example, the left position of the Link button shown below can be controlled by EES variable LinkReturn.left. If an array name is provided, the array index is moved to the end of the created variable names so that, for example, the left attribute for a button named Link[1] would be Link.left[1].
The Link button can be dragged to any location in the window while the toolbar is visible. Finer positioning is available by pressing the left, right, up, or down arrow keys which move the button one pixel for each press. The width and height of the button can be changed by holding the Ctrl key down while pressing arrow keys. The right arrow increases the button width.
Six different types of links can be created:
Link type 1: Start an External Program
This link type allows any program, including a second copy of EES, to be started when the user clicks the link button in the Diagram window while in application-mode. The link button property only requires the name of the file that is to be opened when the application starts. The name of the application is not required as that information is determined by EES from information in the Windows operating system registry. As an example, the following link property will start a second copy of EES and load file TEST.EES in the C:\EES32 directory. It is possible to start EXCEL or other programs in this manner
c:\ees32\TEST.EES
EES can communicate with other programs using Lookup files. The $OpenLookup and $SaveLookup directives make this process convenient. If the file is changed, it will be automatically reloaded.
Link type 2: Open EES File
This link type will close the existing EES file and open the EES file specified as the link button property. EES will check to see that the current EES file is saved, and if not, ask for confirmation before closing the existing file. If the EES file name provided in the link button dialog is *.EES, EES will display a standard Windows Operating system open file dialog so that the file can be conveniently selected. The Open EES File option is useful when the results of one EES program provides data for use in the next EES program. For example, information can be calculated and saved in a Lookup Table that is automatically loaded in the next EES program with the $OpenLookup directive. Alternatively, a Link button (type 6) can placed on a Diagram window to open a specified Lookup file.
Link type 3: Open Distributable File
This link type is applicable only to distributable programs created with the Make Distributable Program command. Distributable programs can include up to 100 EES files. As with option 2, this link type allows one EES file to open another, but in the case of a distributable program, the EES file must be one of the programs included with the distributable program. It is referred to by its number, 1 to 100.
Link type 4: Open Child Diagram Window
This link type is applicable if one or more child Diagram Windows have been created. A list box showing the names of all child Diagram windows is provided. Clicking the button will open the specified child Diagram Window, just as if the user had clicked the mouse within the hot area for the child Diagram window or selected the Child Diagram from the Windows menu. However, the button can be positioned anywhere in the window.
Link type 5: Play Macro adapted with EES variables
This link type will play a predefined Macro file that has been stored in a separate file with a .EMF filename extension or stored with the EES program (with no filename extension). The file name should be the same as the name on the Macro Window tab and string constants should be enclosed in single quotes. The first parameter that must be supplied in the edit box is the macro name or macro filename. The macro name must be enclosed in single quotes if there are spaces in it. All other parameters are optional.
It is possible to provide information to the macro file that allows its capability to be programmed. This is done by providing parameters after the macro file name separated with a space or comma. These parameters can be EES variable names, numerical values, or strings. EES will process the Macro file looking for the character sequence %%N where N is an integer value; each of these character sequences must be followed by a space. If this sequence is found, %%N is replaced with the Nth parameter. For example, suppose the macrofile name doPropPlot.EMF has a line that contains
PropPlot %%1 PH 2 %%2 %%3 0 DoQLines
If the Play Macro link information is
doPropPlot.EMF R$, Thigh, 0
EES will replace %%1 with the value of the EES string variable R$, %%2 with the value of EES variable Thigh, and %%3 with 0. The property plot will then be drawn. Note that calculations must be completed to enable the button.
Link type 6: Open a Lookup File
A Link button can be placed on the Diagram window that, when clicked, will display the familiar Open File dialog. A user can then select a Lookup file having a filename extension of .LKT (or LKT64 for the 64-bit license), .TXT, .CSV, .DAT, .XLSX (EXCEL file) and that Lookup file will be opened. After the selection has been made, an EES string variable having the same name as the caption of the Link button is created and its value is set to the name of the Lookup table that has been read in. EES does not allow spaces in a variable name so any spaces in the caption are set to underscores. Also, the maximum length of the variable is 29. The last character of the EES variable name is set to $ to indicate that it is a string variable. As an example, if the caption of the Link button is "Open Lookup File", clicking the button will read the file, create variable Open_Lookup_File$ and set the value of this variable to the name of the Lookup table that was created. This string variable can be used in subsequent Lookup file function calls. If the Lookup table already exists, it will not be re-read.
Clicking OK in the Link Properties dialog will create the link button. The button can be dragged to any location while the Diagram Window is in development mode. Right-clicking on the link button while in development mode will bring up the Link Properties dialog so that link properties can be changed or the button can be deleted.
While in development mode, the Link button can be dragged to any location on the window. Finer positioning is available by pressing the left, right, up, or down arrow keys which move the button one pixel for each press. The width and height of the button can be changed by holding the Ctrl key down while pressing arrow keys. The right arrow increases the button width by one pixel. Left arrow decreases the width. Down arrow increases the height and up arrow reduces the height.