Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This document describes the procedures and utilities for building real time Web based graphic screens under Visual Basic 6.0.  These screens may be animated using real time data from a control system.  Screens may be displayed on any workstation using a browser such as Microsoft Internet Explorer 5.5.

This document describes the basic procedures for building and publishing a screen.  An overview of the process is as follows:

  •  Use Microsoft Visual Basic 6.0 to build the basic screen

  • Animate the screen using the provided real-time objects

  • Publish the screen to the proper control system, making it accessible via the web from any network connected Internet browser

  • Install and configure the proper utilities on the control system to provide access to process variables

  • Display the page on a workstation using Microsoft’s Internet Explorer


Naming Conventions

 ...

Object Name

How to Name

Prefix

Example

Vector Project

The previous name of the screen under the Vector system.  Not to be changed.  (Not used in OPC system)

None

3Main

OPC Project directory

Created when new screen is generated through the tpriNtRt administrator program. Directory needs to be renamed without the mill site abbreviation.  In this case, the ‘l’ prefix was moved from the directory name.

None

\3Main\

OPC Project

Automatically created with appropriate prefix. The file will have a .vbp extension*

l

l3Main

OCX Control

(that you are building)

Automatically created with appropriate prefix.  The file will have a .ctl extension* **  

ucl

ucl3Main

The names above should be used as both the Project and Control names as referred to in Visual Basic, as well as the name of the file that is stored on the hard drive (the one in parentheses next to the Project or Control name in VB).

* = The “l” prefix is an abbreviation of the site, in this case short for “Location”

** = The “uc” prefix is an abbreviation of “User Control”

Building a Basic Screen

 Overview

The following procedure defines the steps involved to build a basic screen using Visual Basic 6.0.  The tpriNtRt administrator program is used to begin a new Visual Basic screen.  All the user has to do is add controls and design the layout of the page.  Below is a screenshot of the Visual Basic design interface and descriptions of the layout:

 Starting a New Screen
  1. Run tpriNtRt administrator program D:\locNtRt\tpriNtRt\Apps\tpriNtRtAdmin\tpriNtRtAdmin.exe

  2. Enter screen name, e.g. ‘l3Main’ with appropriate mill site prefix, in this case ‘l’ for Location

  3. Click ‘Generate New Screen’

  4. A list of steps for creating the demo screen is displayed; those items that are checked have been automatically finished, those that are unchecked must be performed manually

 Adding Labels to the Form

A Label object will always be used for the non-changeable background text on a screen.

  1. On the toolbox to the left, choose the label control.

  2. Position the mouse where the object should be placed on the screen, hold down the left mouse button and drag to the desired size.

  3. Naming the object is optional, but should start with lbl.

  4. Set properties for label such as font, fore color, and back color.

For adding additional objects to the screen such as TelePro controls, refer to Section 6.5 [LINK] of this document

 Saving the Project
  1. Select the Menu option File, Save Project

  2. Select the Menu option File, Save uc[name].ctl

 Testing the Page
  1. Remember to close all instances of Internet Explorer when making your page.  If not, the page will not be updated correctly. 

  2. Select the menu option Run, Start With Full Compile (or Ctrl+F5). This ensures that all code is tested and all variables are defined. 

After you are done testing the screen, you must hit the stop button ◼ in order to edit the code or view the page again.


 Publishing Pages

Pages can be quickly rebuilt and/or published using a program called tpriPublisher.

D:\locNtRt\apps\tpriPublisher\tpriPublisher.exe, this program allows the user to select multiple screens and can rebuild, publish, or both with a single mouse click.

 Helpful Hints
  • Save often:
    Every time you make a change that you wouldn’t want to do again, SAVE your project.  Ctrl+S, click disk button, or File, Save all work.

  • Auto-Complete:
    In the editor, on-the-fly syntax and programming assistance will give you a pull down list for completing what you started typing. You can just press tab to write out what is highlighted.

  • Fine Movements:
    Instead of moving objects on the screen with your mouse (which lacks precision), you can use the ctrl + arrow keys to move the object in fine increments.

  • Lock Controls:
    Once you have finished designing the page, you should lock the controls in place so that they are not accidentally moved (there is no way to undo a move).  This feature can be toggled on and off from the Format menu.  Even if Lock Controls is enabled, you can still move them using the ctrl + arrow keys.

  • Aligning objects:
    To make the objects on your screen align horizontally or vertically, select the objects (either by dragging a selection box with your mouse over them or by individually clicking on each object while holding down the ctrl key) and in the Properties window, set the Top or Left to a number.  This will change the properties for every object you have selected.

  • When editing the code, I move the arrow keys, but nothing happens: 
    Sometimes when you are working in the code view, the focus will still be on an object in the object view.  Every time you press an arrow key or page up/down, the focus is actually changing on the object view.  The fastest way to stop this is to close the object view.

  • Tab Order: 
    It is a good idea to think about the tab order of all of the objects on the screen.  If the user tabs to a non-data input object, it is possible that s/he may not see the focus outline and think the screen has frozen.  Suggestion: allow tabbing only to data entry boxes and command buttons.

  • Toggle between object and code view:
    Ctrl + tab switches the window, but both must be open first in order to toggle between them.

  • Debugging the code: 
    There are many helpful tools used for debugging the code. You may set a breakpoint with the F9 key (the breakpoint stops the code before that line is executed), step through the code with the F8 key, and run the code again with the F5 key.  Once the code is at a break point, you can view variable values by hovering over them with the mouse or entering the Immediate Window and typing “?” followed by your variable and press enter (example:  ?myString).  You may also add a watch on any variable you choose. This is a quick way to view many values at any breakpoint.

  • ‘Conflicting names were found…’ error received when opening a VB project:
    This error is cause when the user-control (*.ctl file) was originally saved in lower case and then later saved using upper case letters. In this case, VB is case-sensitive, but it does not update the code inside the .ctl file. You have to manually change the code in the .ctl file to get rid of the error.   Just open the .ctl file in your favorite text editor and do a search for “Attribute VB_Name =”. This will bring you to the line in the code that needs to be changed.   Just edit the file name that is in quotes to the correct case and you are done.


Adding TelePro’s Standard Controls to a Visual Basic Web Screen

 Adding a Text Box

A tpriTextBox will always be used for data display and to input text.

  1. Select the “uctpriTextBox” control and position it on your screen.

  2. Below is a list of all the properties that are specifically used for the TpriTextBox control:

Property Name

Type

Default Value

Description

tAutoValidateMinMax

Boolean

False

Indicates whether or not the text box should try to validate user-entered data against the min/max values specified in the data dictionary

tBackReadOnlyColor

OLE_COLOR

White

Background color of read-only text box

tBackWriteDisplayColor

OLE_COLOR

&H0080FFFF& Light-yellow

Background color of editable text box while in display mode

tBackWriteEditColor

OLE_COLOR

&H0080C0FF& Light-orange

Background color of editable text box while in edit mode

tChanged

Boolean

False

Determines if user has edited the text box

tDataSource

Variant

Empty string ("")

This is the name of the host variable

tDisconnectedStr

String

“###”

Text in textbox when disconnected from the OPC server. May not be used if tDataSource = ""

tEnabled

Boolean

True

Enables the textbox on the screen

tFocusColor

OLE_COLOR

&H0000FF00& Green

Sets the color to outline the textbox when it is in focus

tFormat

Variant

Empty string ("")

Formats how the text is displayed

Tlocked

Boolean

False

Toggles between display  and edit mode

tResetStr

String

“@@@”

String to be displayed when waiting for an update from OPC server

tResetToStr

Boolean

True

Determines whether to display the tResetStr string when waiting for an update

tText

String

Empty string ("")

Text displayed in textbox

 Adding an Active Shape

A tpriActiveShape will always be used to data display shapes.

  1. Select the “ucTpriActiveShape” control and position it on your screen.

  2. In the properties window for this object, edit the properties necessary for this shape.

  3. Below is a list of all the properties that are specifically used for the tpriActiveShape control:

Property Name

Type

Default Value

Description

BackColor

OLE_COLOR

H000000FF (red)

Provides the "default" color for the shape (in the case that none of the bound conditions is true).

BorderColor

OLE_COLOR

Black

BorderColor for the shape. Remains the same at run time for any value.

BorderStyle

BorderStyleConstants

0 -Transparent

1 - Solid

2 - Dash

3 - Dot

4 - Dash-Dot

5 - Dash-Dot-Dot

6 - Inside solid

1

BorderStyle for the shape. Remains the same at run time for any value. May be changed at design time.

The effect of setting the BorderStyle property depends on the setting of the BorderWidth property. If BorderWidth isn't 1 and BorderStyle isn't 0 or 6, BorderStyle is set to 1.

 

BorderWidth

Integer

1

BorderWidth for the shape. Remains the same at run time for any value.

FillColor

OLE_COLOR

Black

FillColor for the shape. Remains the same at run time for any value. Usually not used ("normal" FillStyle is transparent)

FillStyle

FillStyleConstants

0 - Solid

1 - Transparent

2 - Horizontal Line

3 - Vertical Line

4 - Upward Diagonal

5 - Downward Diagonal

6 - Cross

7 - Diagonal Cross

1

FillStyle for the shape. Remains the same at run time for any value.

Shape

ShapeConstants

0 - Rectangle

1 - Square

2 - Oval

3 - Circle

4 - Rounded Rectangle

5 - Rounded Square

0

Provides the different appearance of a shape. Remains the same at run time for any value.

 

Font

Font

MS Sans Serif/ Bold/ Size=12

Provides the font for any text shown inside the ActiveShape control.   The text will be centered.  If the font is changed, the height of the label area increases.  Remains the same at run time for any value.

tNumTextLines

Variant ( >=1 and < 4)

1

Determines (with the font.size) the height of the ActiveShape label.  Cannot be changed if the shape property is oval or circle.

tDataSource

Variant

Empty string ("")

This is the name of the host variable

tFormat

String

Empty string ("")

Reserved for "outside" use (probably OpcMgr).

tURL

String

Empty string ("")

Assigns a target web page to go to when object is clicked

tBlinkingPeriod

Variant

200

Provides the frequency of blinking (the number of milliseconds between the changes). Remains the same at run time for any value.

tBlinkShapeBackColor

OLE_COLOR

Black

The color of the "blind interval" of blinking. Affects the ActiveShape appearance only if the property  txxTextBlinking = False and txxShapeBlinking = True (txx may be from t00 to t15).

Remains the same at run time for any value.

tDisplayValue

Boolean

False

If the property is set to True, then the text label of the ActiveShape will show the Value instead of showing txxText

tDisconnectColor

OLE_COLOR

&H808080 (gray)

Color of Shape when disconnected from the OPC server. May not be used if tDataSource = ""

tValue

Variant

 

This property is responsible for the current presentation of the Active Shape

t00Text

String

Text

Text to show inside the ActiveShape if none of the conditions are true (the value is greater then any of the txxBoundValue)

t00TextColor

OLE_COLOR

Black

ForeColor for the text, if none of the conditions are true

t00TextBlinking

Boolean

False

If this property is True and t00ShapeBlinking is False, then the Text inside the control will blink with the period equal to tBlinkingPeriod (if none of the conditions are true).

t00ShapeBlinking

Boolean

False

If this property is True and t00TextBlinking is False, then the Shape will blink with the period equal to tBlinkingPeriod (if none of the conditions are true).

t01BoundValue

Variant

 

Right bound value for the interval # 1.

If the Value < t01BoundValue ("<=" in the case of t01IncludeEquals = true), then all the t01 settings would be applied to the ActiveShape.

t01IncludeEquals

Boolean

False

If this property is True, then "<=" will be used in the comparison for the interval # 1 (versus  "<" for the False)

t01Text

String

Empty string ("")

Text to show inside the ActiveShape if the Value is inside the interval # 1.

If the tDisplayValue=True, then the actual value would be shown instead of t01Text

t01TextColor

OLE_COLOR

Black

ForeColor for the text if the Value is inside the interval # 1.

t01TextBlinking

Boolean

False

If true, then show the text blinking for the interval # 1.

t01ShapeColor

OLE_COLOR

Black

Color of the shape if the Value is inside the interval # 1.

t01ShapeBlinking

Boolean

False

If true, then show the shape blinking for the interval # 1.

t15BoundValue

Variant

 

Right bound value for the interval # 15.

If the Value < t15BoundValue ("<=" in the case t15IncludeEquals = true), then all the t15 settings would be applied to the ActiveShape.

t15IncludeEquals

Boolean

False

If this property is True, then "<=" will be used in the comparison for the interval # 15 (versus  "<" for the False)

t15Text

String

Empty string ("")

Text to show inside the ActiveShape if the Value is inside the interval # 15.

If the tDisplayValue=True, then the actual value would be shown instead of t15Text

t15TextColor

OLE_COLOR

Black

ForeColor for the text if the Value is inside the interval # 15.

t15TextBlinking

Boolean

False

If true, then show the text blinking for the interval # 15.

t51ShapeColor

OLE_COLOR

Black

Color of the shape if the Value is inside the interval # 15.

t15ShapeBlinking

Boolean

False

If true, then show the shape blinking for the interval # 15.

Tips on using a tpriActiveShape

The following condition should be true:
            t01BoundValue <=  t02BoundValue <= ... <= t15BoundValue.

 

Thus all numbers would be divided into 1-16 intervals. 

For any new value, the code running behind the control will sequentially verify the following conditions:

Value < t01BoundValue    ( Value <= t01BoundValue, if   t01IncludeEquals = True )

Value < t02BoundValue    ( Value <= t02BoundValue, if   t02IncludeEquals = True )

... 

Value < t15BoundValue    ( Value <= t15BoundValue, if   t15IncludeEquals = True )

If any of the above becomes true, then the verification would be stopped, and ActiveShape control will have Color, Text, and blinking flags that are associated with this txxBoundValue.

If none of them is true, then:

  • ActiveShape will have color specified in the BackColor property

  • Text from the t00Text property (or actual value shown, if the tDisplayValue = True)

  • Blinking flags from t00TextBlinking and t00ShapeBlinking.

If any txxBoundValue is not set (empty), then the rest of the sequence would be ignored by the control.

Example: if t05BoundValue is empty and the value is greater then t04BoundValue, the "default" settings would be used even if the following were true:

Value < t07BoundValue

 Adding a Link Button

To add a tpriCmdButton object to an ActiveX screen, follow these steps.

  1. Make sure the name is “ucTpriCmdButton” and select it.

  2. While holding down the left mouse button, drag a box on the screen.

  3. In the Properties window, type a name for your command button.  The tpri default for command button begins with ‘tcb’; for example, a name could be “tcbOprMenu”.

  4. To assign a target to the command button, scroll down in the Properties window to ‘tURL’.  If the page you are linking to is in the same directory as your source page, then you don’t need ‘http://’.  All you need is the name of the file and make sure it ends with ‘.asp’; for example the tURL could be “3OprMenu.asp”.  

  5. It is possible to link back to a screen by its relative calling order.  For example  “@BACK1” will call the previous screen.  “@BACK3” will call 3 screens back.  The tpriCmdButton also can link back to the previous menu screen whether it be last accessed 1 screen or 10 screens ago using “@MENU”. 

Command buttons do not work when running the page from Visual Basic, so you will need to open Internet Explorer and type in the address where your .asp page is stored. For example: http://web.server/sys/MyScreen.asp

 Adding Toggle Button

To add a tpriToggleButton object to an ActiveX screen, follow these steps:    

  1. Make sure the name is “ucTpriToggleButton” and select it.

  2. While holding down the left mouse button, drag a box on the screen.

  3. In the Properties window, type a name for your link button.  The tpri default for a toggle button begins with ‘ttg’; for example, a name could be “ttgLawrhd”.

Below is a list of all the properties that are specifically used for the tpriToggleButton:

Property Name

Type

Default value

Description

tColorDisconnected

 

OLE_COLOR

&H00404040&

(Dark grey)

Color of button when disconnected from the OPC server.

tColorNonZero

OLE_COLOR

&H0000FF00&

(vbGreen)

Color of button when value does not equal 0, which usually means true

tColorTransmitting

OLE_COLOR

&H00E0E0E0&

(Light grey)

Color of button when clicked and waiting to get updated form host

tColorZero

OLE_COLOR

&H000000FF&

(vbRed)

Color of button when value equals 0, which usually means false

tDataSource

Variant

Empty string ("")

This is the name of the host variable to change.

tIncrement

Integer

0

0 = toggle Boolean value

Positive # = amount to increment by when clicked

Negative # = amount to decrement by when clicked

tValue

Integer

0

Sets the value of the toggle button

 Adding a Bar Graph

To add a tpriBarGraph object to an ActiveX screen, follow these steps:

  1. Under Project, Components (or ctrl+T) and select “tpriBarGraph”.

  2. Make sure the name is “ucTpriBarGraph” and select it.

  3. While holding down the left mouse button, drag a box on the screen.

  4. In the Properties window, type in a name for your link button. The tpri default begins with ‘tbg’; for example, a name could be “tbgSprays”.

Below is a list of all the properties that are used to design the graph:

Property Name

Type

Default value

Description

Font

Font

MS Sans Serif, Regular, 12

Font for Bar Numbers.

Recommended font is “small fonts” about size 7

tBackColor

OLE_COLOR

&H00000000& (Black)

The color of the background of the graph control.

tBarNumbersStyle

 

Integer

2

Option for bar number shown directly below bars.

0 - don't show numbers

1 - show numbers from 0 to (N- number of bars) For example: 0 to 30 for 31 bars

2 - show numbers from 1 to (number of) bars.  For example: 1 to 31 for 31 bars

tBorderColor

OLE_COLOR

&H00FFFFFF& (White)

The color for the enclosing border box

tBorderVisible

Boolean

True

Option for displaying the enclosing border box

tBottomLineVisible

Boolean

False

Option for displaying the line above the Box Numbers (like X-axis)

tCenterLineVisible

Boolean

False

Option for displaying the Center line

tEngUnitBottom

Integer

-9999

Value at the bottom of the bar graph area in engineering units

tEngUnitCenterLine

Integer

-9999

Reference value: where the bars in the bar graph will ‘grow’ from.  If the …

tEngUnitTop

Integer

-9999

Value at the top of the bar graph area in engineering units

tForeColor

OLE_COLOR

&H00FFFFFF& (White)

The color for Bar Numbers, BottomLine and CenterLine

tLeftBarDataSource

Variant

Empty string ("")

This is the name of the host variable to be graphed.

tLeftBarPercent

Integer

50

Percentage of the allotted space per line to take up

tLeftFillColor

OLE_COLOR

&H000000FF& (Red)

Color of the major graph (set of bars)

tNumBars

Integer

2

Number of bars that are to be graphed

tRightBarDataSource

Variant

Empty string ("")

This is the name of the host variable to be graphed.

tRightBarOffset

Integer

50

Amount that the left hand edge of the minor bars is to be shifted to the right

tRightBarPercent

Integer

50

Percentage of the allotted space per line to take up

tRightFillColor

OLE_COLOR

&H0000FFFF& (Yellow)

Color of the minor graph

Tips on using the tpriBarGraph

  • The (left and right) bar colors are chosen on the object properties.

  • When the bar graph control is first published, no bar data will be displayed

  • Each of the bars grow from the engineering unit centerline

  • The bars will not appear until after the first time the data has been received and passed (automatically or under program control with fSetLeftVals and fSetRightVals) to the tpriBarGraph control.

  • If a bar value is the equal to the centerline value, no bar will be drawn

  • If you associate (or pass directly) a variant with less elements than bars, the values will be assigned to the first bars from the left side of the bargraph

  • If you associate (or pass directly) a variant with more elements than bars, the first values of the variant will be assigned to the bars

  • The rectangular area allocated to the bar graph object is divided horizontally into ‘tNumBars’ equal BarSlot areas, where ‘tNumBars’ is the number of bars selected in the property box.  Valid number of bars ranges from 1 to 60.

  • There are 2 interleaved groups of bars available on the control: Left and Right

  • The number of Left and Right bars is always the same.

  • The Left edge of each of the LeftBars always starts at the left edge of the BarSlot.  The horizontal width of the LeftBars is LeftBarPercent of the BarSlot.

  • The left edge of each of the RightBars starts RightBarOffset percent into the BarSlot.  The width of each of the RightBars is RightBarPercent of the BarSlot width.

  • If the values of tRightBarOffset and tRightBarPercent add up to be 100, the right edge of the right bar will extend to the left hand edge of the next bar interval.  The two properties and the tLeftBarPercent can be played around with to maximize the readability of the graph.

  • Bar graph objects work when the page is run through VB or through IE.

  • Normally, the tpriBarGraph control will be automatically animated with the values of the data variable indicated in the tDataSource property.  If this property is NULL, the animation could be accomplished by implementing code similar to the following example:

The demoBarGraph screen has the following Bar Graphs defined:

 SBar1:
    31 bars,
    Left and Right bars
    Engineering units are -5000 to + 5000, bars grow from 0 (center)
 SBar2:
    21 bars,
    left bars only
    Engineering units are 0 to 100, bars grow from 0 (bottom)


An example code snippet on how to pass values to the control follows:

Private Sub Command1_Click()
   Dim Test1(31) As Variant
   Dim Test2(31) As Variant
   Dim Test3(31) As Variant
   Dim i As Integer
   
For i = 0 To 30
    Test1(i) = -5000# + (i * 330#)
    Test2(i) = 5000# - (i * 330#)
    Test3(i) = i * 3#
    Next i
   SBar1.fSetLeftVals Test1
   SBar1.fSetRightVals Test2
   SBar2.fSetLeftVals Test3
End Sub
 Adding a Coverage Bar Graph

A tpriCoverageBar control is a horizontal bar illustrating the location of a closed section within a wider region.  Typically a tpriCoverageBar is tacked on below a bar graph to depict which bars are to be considered ‘valid’.

  1. Make sure the name is “uctpriCoverageBar” and select it.

  2. While holding down the left mouse button, drag a box on the screen, usually placed under a bar graph.

  3. In the Properties window, type in a name for the coverage bar.  The TPRI default begins with ‘tcg’; for example, a name could be “tcgSprays”.

Below is a list of all the properties that are used to design the graph:

Property Name

Type

Default value

Description

tColorData

 

OLE_COLOR

&H00FF0000& (blue)

Fore color of graph

tColorNoData

OLE_COLOR

&H00808080& (grey)

Back color of graph

tLeftData

Variant

-9999

This is the name of the host variable to be graphed on the left side.

tLeftEdge

Variant

-9999

Left edge bound value

tRightData

Variant

-9999

This is the name of the host variable to be graphed on the right side.

tRightEdge

Variant

-9999

Right edge bound value. Optionally set to SYSDATA.iFlatBarZones which stores the max number of flatness bar zones

 Adding a Trend Graph

A trend graph requires three objects:

  • tpriTrendCtrl – Sets up the trend variables to be graphed

  • tpriTrendCom – Configures communications with the OPC trend server

  • ProEssentials Graph – Graph component where the trend variable is graphed

 

Follow these steps to setup a trend graph on an ActiveX screen:

  1. Under Project, Components (or ctrl+T)

  2. Scroll to locate and select Gigasoft ProEssentials Graph v3

  3. This item should now be in your toolbox.

  4. Click the Pegoa icon and drag a box on the screen.

  5. Make sure the name is ”ucTpriTrendCtrl” and select it. 

  6. While holding down the left mouse button, drag a box near the Pegoa graph you want to associate the TrendCtrl to.

You may copy the Pegoa graph object once it is on the screen to setup as many graph objects as needed. When copying, click ‘Yes’ to create a control array.

The tpriTrendCom control is automatically placed in the corner of your screen.

 

The following table shows the proper default settings for the tpriTrendCom object.

Property Name

Type

Default Value

Description

tNewDataFromServerEveryMSec

Integer

1000

1000 = 1 second update from server

tNullValueIndicator

Integer

9999999

The value that will be substituted for null values in the data stream.

tRestartFlag

Boolean

False

This property indicates the status of a communication restart cycle.

tScanEnabled

 

Boolean

True

This property controls scanning of the Trend server.

tServerDataFreqPntPerSec

Integer

50

This should be set to match the Trend server that you are connecting to.

tTimeOutInterval

Integer

10000

10000 = 10 Seconds

The following list of Property setting is for the tpriTrendCtrl control.

Property Name

Type

Default value

Description

BackColor

OLE_COLOR

&H8000000F& (Gray)

This property identifies the color used as the background color for the object’s graphing area.

endTime

Integer

2140000000

 

ForeColor

OLE_COLOR

&H00FFFFFF&

(White)

This property identifies the color used as the foreground color for the object’s graphing area.  The grid lines and tick marks will be drawn in this color.

nDispVars

Integer

0

Number of variables to be trended.

PegTrend

Variant

Empty string ("")

Name of the associated ProEssentials graph

playbackMode

Integer

0

 

playSpeed

Integer

0

 

startTime

Integer

0

 

stepTime

Integer

0

 

TrendInfo

Option window

 

Click the  button to bring up the Trend Setup window.  From there, you can set the data-sources for the variables to be graphed and the colors and labels.

ttpPlayback

Integer

Empty string ("")

 

ttbAxisMax

Variant

Empty string ("")

If the value is fixed it should be set here.

To allow the user to change this property during run-time, include a text input box in the design of the screen.  Type the name of that textbox in this field. For example ‘ttbGraphMax’

ttbAxisMin

Variant

Empty string ("")

(see above)

  • Make sure you set a line color that is different than the background color.

  • At this point you should be able to run the screen and the graph will update.

  • The items list above should be all that is needed for a general-purpose display.   Full details on all of the properties are available in the Gigasoft documentation.

Tips on using the Trend Graph

You only need one tpriTrendCom object on the page; it can handle multiple trend graphs. 

For each ProEssentials Pegoa graph on the screen there needs to be an associated tpriTrendCtrl control.

If you are using the Pegoa graph for display only, you should set the TabStop property to False.  This will take the object out of the tab sequence.

The tpriTrendCom object will generate X Axis timestamp labels and send them to the Pegoa graph.  The user has the option to display or not display Xaxis timestamp labels.  If Xaxis timestamp labels are to be used the ShowXAxis property controls this.  Set ShowXAxis to PESA_ALL (0) = Grid, Grid Numbers and Axis Labels if you want to display the timestamp information.

If the graph has a user-definable Y-axis min and max, a trpiTextBox (use this one if the scaling values are to be stored in control program variables) or standard VB text box may be added to your screen to collect this information.   The tYAxisMax  and tYAxisMin properties allow this option.  The tpriTrendGraph will check the values in your text box prior to each graph refresh cycle and if changed update the Y Axis scaling

 Adding a Log Message Display

A tpriLogMsg control is used to display messages posted to a specified LogMsg queue.

  1. Make sure the name is “ucTpriLogMsg” and select it.

  2. While holding down the left mouse button, drag a box on the screen.

  3. In the Properties window, type in a name for the LogMsg box.  The TPRI default begins with ‘tlm’; for example, a name could be “tlmOprMsg”.

Below is a list of all the properties that are used to customize the LogMsg box:

Property Name

Type

Default value

Description

LogMsgName

String

“LogMsg”

Name of desired queue from which to retrieve messages.

histStart

Long

32

This number indicates how many historical messages to retrieve upon startup before waiting for new messages to be queued.

histLength

Long

512

This is the maximum number of messages to store in the list box at any given time.  Additional messages will cause the oldest entries to drop out of the top of the message box.

Error Handling

 General Errors

The following is an overview of the VB error handling logic for ActiveX screen code.  Including the following in your screen code will provide an orderly handling of VB errors if they should occur. 

In the case of an unplanned VB error the program will present a Windows message box reporting the error condition.  Then the program will shut down and close the browser.

Several standard lines of code are required for each screen.  The IobjSafe.bas module is automatically included in your project.  The ErrRpt Subroutine called by the error handler is included in this code.  The following is automatically included at the start of your code.

 

Option Explicit
Event GoToURL(Url As String)
Event ErrorTerminate()
Implements IObjectSafety

The following sample shows the base framework for a Sub or Function

Private Sub DemoSub() As Long)
Dim liTmp AS Integer

 

 On Error GoTo ErrorHandler             <- Set the location to branch to in case of error
 mbError = False                        <- Reset the error flag variable

‘ Start of your Code
‘ blah blah blah         
‘ End of your code

On Error GoTo 0                             

Turn off the error handler for this sub.  This is important.  If you omit this line it is possible that an error generated in some other section of the code will branch here and report the wrong failing program location.

 

Exit Sub                            

Exit   (Note: If you have written a Function then change to Exit Function)

 

ErrorHandler:                             

The following is the general error handler. Based on the error number, the program will proceed.  If your code may generate an error that is expected under normal operating conditions, then handle it here.  If the error is not included in the list of Select statement Case numbers, then the code will call a general purpose reporting procedure.

Select Case Err.Number

Case 9                                   

For example if error number 9 (Subscript out of range) is generated by a bad user data entry, then you may catch it here and respond.

 

MsgBox "The value you entered is not valid!  Please check your input"

                        mbError  = False

 

Case Else

ErrMsg ("DemoSub")      

Update this text to indicate the Sub or Function name.  The string will be included in the error message reporting.

You may also add any additional debug information.

End Select

  

   If mbError Then                                      

If mbError is true then the ActiveX code will call back to the browser via the ErrorTerminate event.       

RaiseEvent ErrorTerminate
 Else
      Resume Next

If you handled the error and would like to have the program continue, then set mbError to False.

End If

End Sub

 VB Runtime Errors

Following are the run-time errors defined by Visual Basic:

 

3

 

 

Return without GoSub

 

 

5

 

 

Invalid procedure call or argument

 

 

6

 

 

Overflow

 

 

7

 

 

Out of memory

 

 

9

 

 

Subscript out of range

 

 

10

 

 

This array is fixed or temporarily locked

 

 

11

 

 

Division by zero

 

 

13

 

 

Type mismatch

 

 

14

 

 

Out of string space

 

 

16

 

 

Expression too complex

 

 

17

 

 

Can't perform requested operation

 

 

18

 

 

User interrupt occurred

 

 

20

 

 

Resume without error

 

 

28

 

 

Out of stack space

 

 

35

 

 

Sub or Function not defined

 

47

 

 

Too many DLL application clients

 

 

48

 

 

Error in loading DLL

 

 

49

 

 

Bad DLL calling convention

 

 

51

 

 

Internal error

 

 

52

 

 

Bad file name or number

 

 

53

 

 

File not found

 

 

54

 

 

Bad file mode

 

 

55

 

 

File already open

 

 

57

 

 

Device I/O error

 

 

58

 

 

File already exists

 

 

59

 

 

Bad record length

 

 

61

 

 

Disk full

 

 

62

 

 

Input past end of file

 

 

63

 

 

Bad record number

 

 

67

 

 

Too many files

 

 

68

 

 

Device unavailable

 

 

70

 

 

Permission denied

 

 

71

 

 

Disk not ready

 

 

74

 

 

Can't rename with different drive

 

 

75

 

 

Path/File access error

 

 

76

 

 

Path not found

 

 

91

 

 

Object variable or With block variable not set

 

 

92

 

 

For loop not initialized

 

 

93

 

 

Invalid pattern string

 

 

94

 

 

Invalid use of Null

 

 

96

 

 

Unable to sink events of object because the object is already firing events to the maximum number of event receivers that it supports

 

 

97

 

 

Can not call friend function on object which is not an instance of defining class

 

 

98

 

 

A property or method call cannot include a reference to a private object, either as an argument or as a return value

 

 

321

 

 

Invalid file format

 

 

322

 

 

Can't create necessary temporary file

 

 

325

 

 

Invalid format in resource file

 

 

380

 

 

Invalid property value

 

 

381

 

 

Invalid property array index

 

 

382

 

 

Set not supported at runtime

 

 

383

 

 

Set not supported (read-only property)

 

 

385

 

 

Need property array index

 

 

387

 

 

Set not permitted

 

 

393

 

 

Get not supported at runtime

 

 

394

 

 

Get not supported (write-only property)

 

 

422

 

 

Property not found

 

 

423

 

 

Property or method not found

 

 

424

 

 

Object required

 

 

429

 

 

ActiveX component can't create object

 

 

430

 

 

Class does not support Automation or does not support expected interface

 

 

432

 

 

File name or class name not found during Automation operation

 

 

438

 

 

Object doesn't support this property or method

 

 

440

 

 

Automation error

 

 

442

 

 

Connection to type library or object library for remote process has been lost. Press OK for dialog to remove reference.

 

 

443

 

 

Automation object does not have a default value

 

 

445

 

 

Object doesn't support this action

 

 

446

 

 

Object doesn't support named arguments

 

 

447

 

 

Object doesn't support current locale setting

 

 

448

 

 

Named argument not found

 

 

449

 

 

Argument not optional

 

 

450

 

 

Wrong number of arguments or invalid property assignment

 

 

451

 

 

Property let procedure not defined and property get procedure did not return an object

 

 

452

 

 

Invalid ordinal

 

 

453

 

 

Specified DLL function not found

 

 

454

 

 

Code resource not found

 

 

455

 

 

Code resource lock error

 

 

457

 

 

This key is already associated with an element of this collection

 

 

458

 

 

Variable uses an Automation type not supported in Visual Basic

 

 

459

 

 

Object or class does not support the set of events

 

 

460

 

 

Invalid clipboard format

 

 

461

 

 

Method or data member not found

 

 

462

 

 

The remote server machine does not exist or is unavailable

 

 

463

 

 

Class not registered on local machine

 

 

481

 

 

Invalid picture

 

 

482

 

 

Printer error

 

 

735

 

 

Can't save file to TEMP

 

 

744

 

 

Search text not found

 

 

746

 

 

Replacements too long

 

Adding Property Pages to the ActiveX Control

 ...

The following sequence is used to add property pages to an ActiveX Control.  This sequence was used to add property pages to the TelePro supplied controls.  It is included here for documentation purposes only.

  1. After loading your ActiveX Control in Microsoft Basic you click on Project —> Add Property Page.

  2. Click on the icon of VB Property Page Wizard and on Open button. New window appears: “Property Page Wizard – select The Property Pages”. Two Property Pages are created automatically: StandardFont and StandardColor.

  3. If you want to add a new one then you should click on the button “Add” and the new page name. Repeat this step as many times as you need. You also can change the order of pages using arrows at the left part of the window.

  4. After all you click on the button “Next>”. In this window you can choose which properties will be in your pages (color and font properties are added to “StandardColor” and “StandardFont” automatically).

  5. When all properties have been assigned to the pages click on “Next>” and finally on “Finish”.

Appendix

 Variable Scope Prefixes

Scope

Prefix

Example

Global

g

gsUserName

Module

m

msUserName

Local to procedure

l

lsUserName

Argument by value (within a function)

av

avsUserID

Argument by reference (within a function)

ar

arsUserID

 Variable Data Types

Use the following prefixes to indicate a variable's data type.

Data type       

Prefix

Example

Boolean

bln

blnFound

Byte

byt

bytRasterData

Collection object

col

colWidgets

Currency        

cur

curRevenue

Date Time      

dt        

dtStart

Date   

d         

dStart

Time   

t          

tStart

Double

dbl      

dblTolerance

Error   

err       

errOrderNum

Integer

i          

iQuantity

Long

Lng

lngDistance

Object

Obj     

objCurrent

Single 

sng     

sngAverage

String  

s

sFName

User-defined type           

udt      

udtEmployee

Variant

v         

vCheckSum

 Prefixes for Controls

Control type

Prefix

Example

3D Panel

pnl

pnlGroup

Animated button

ani

aniMailBox

Check box

chk

chkReadOnly

Combo box, drop

down list box

cbo

cboEnglish

Command button

cmd

cmdExit

Common dialog

dlg

dlgFileOpen

Communications

com

comFax

Control (used within procedures when the specific type is unknown)

ctr

ctrCurrent

Data control

dat

datBiblio

Data-bound combo box

dbcbo

dbcboLanguage

Data-bound grid

dbgrd

dbgrdQueryResult

Data-bound list box

dblst

dblstJobType

Directory list box

dir

dirSource

Drive list box

drv

drvTarget

File list box

fil

filSource

Form

frm

frmEntry

Frame

fra

fraLanguage

Gauge

gau

gauStatus

Graph

gra

graRevenue

Grid

grd

grdPrices

Horizontal scroll bar

hsb

hsbVolume

Image

img

imgIcon

Key status

key

keyCaps

Label

lbl

lblHelpMessage

Line

lin

linVertical

List box

lst

lstPolicyCodes

MAPI message

mpm

mpmSentMessage

MAPI session

mps

mpsSession

MCI

mci

mciVideo

MDI child form

mdi

mdiNote

Menu

mnu

mnuFileOpen

MS Flex grid

msg

msgClients

MS Tab

mst

mstFirst

OLE

ole

oleWorksheet

Outline

out

outOrgChart

Pen BEdit

bed

bedFirstName

Pen HEdit

hed

hedSignature

Pen ink

ink

inkMap

Picture

pic

picVGA

Picture clip

clp

clpToolbar

Report

rpt

rptQtr1Earnings

Shape

shp

shpCircle

Spin

spn

spnPages

Text box

txt

txtLastName

Timer

tmr

tmrAlarm

UpDown

upd

updDirection

Vertical scroll bar

vsb

vsbRate

Slider

sld

sldScale

ImageList

ils

ilsAllIcons

TreeView

tre

treOrganization

Toolbar

tlb

tlbActions

TabStrip

tab

tabOptions

tpriActiveShape

tas

tasMillStatus

tpriBarGraph

tbg

tbgStress

tpriCoverageBar

tcg

tcgRotor

tpriCmdButton

tcb

tcbMainMenu

tpriTextBox

ttb

ttbMill

tpriToggleButton

ttg

ttgRunHold

StatusBar

sta

staDateTime

ListView

lvw

lvwHeadings

ProgressBar

prg

prgLoadFile

RichTextBox

rtf

rtfReport

 Prefixes for Data Access Objects (DAO)

Database object

Prefix

Example

Container

con

conReports

Database

db

dbAccounts

DBEngine

dbe

dbeJet

Document

doc

docSalesReport

Field

fld

fldAddress

Group

grp

grpFinance

Index

idx

idxAge

Parameter

prm

prmJobCode

QueryDef

qry

qrySalesByRegion

Recordset

rec

recForecast

Relation

rel

relEmployeeDept

TableDef

tbd

tbdCustomers

User

usr

usrNew

Workspace

wsp

wspMine

Some Examples:

Dim dbBiblio As Database
Dim recPubsInNY As Recordset, strSQLStmt As String
Const DB_READONLY = 4                                               ' Set constant.
'Open database.
Set dbBiblio = OpenDatabase("BIBLIO.MDB")
' Set text for the SQL statement.
strSQLStmt = "SELECT * FROM Publishers WHERE _
          State = 'NY'"
' Create the new Recordset object.
Set recPubsInNY = db.OpenRecordset(strSQLStmt, _
          dbReadOnly)
 Suggested Prefixes for Menus

Menu caption sequence  

Menu handler name

File Open

mnuFileOpen

File Send Email

mnuFileSendEmail

File Send Fax

mnuFileSendFax

Format Character

mnuFormatCharacter

Help Contents

mnuHelpContents

  • No labels