Sunteți pe pagina 1din 6

Chapter 9 Control 1

Chapter 9 Control

In this chapter, you will


Understand the idea of controls
Understand how to set up and use controls

Introduction

Controls are one of the relatively independent program units that can be called repeatedly
by other application programs. The interface of the controls is standard, controls developed by
third party software, which satisfies the interface conditions and can be called directly by
KingView. The engineer places the control in the picture, defines properties and connects the
corresponding functions the control can then carry out a complicated function.

Section1 Using the XY control


The following shows how to use the XY control to develop a curve showing the relationship
between the material oil liquid depth and the material oil pot pressure:

1. Create a new picture called: XY control graph.

2. Select from the toolbox, insert the following text on to the graph: XY control.

3. Select from the toolbox, double-click the X-Y axis curve control from the trend
curve section of the popup window, draw the XY curve in the picture as shown below:

Figure 9-1 XY curve control window

4. Double-click on the graph and the following control settings dialogue box will popup:
Chapter 9 Control 2

Figure 9-2 Setting dialog with XY control property

From this dialogue box you can set the control name (named: control 1) and decide the style
of the control window. To make the XY curve control respond to the variable value in real time
you need to add some function syntax for control. Input the following to the picture property
script:

Figure 9-3 Graph property script

5. Select Save all pictures from the file menu to save the settings.
6. Select Switch to View from the file menu to enter the running system, as shown
below:

Figure 9-4 XY control in running


Chapter 9 Control 3

Section2 Using Active X control

Introduction

Although KingView has its own controls it also supports Windows Active X controls, which,
includes standard Active X control offered by Microsoft and Active X controls developed by the
user (such as the KVTHREND control introduced in chapter 5). Introduction to Active X
controls makes the system more convenient for the user; the user can finish a complicated task
using a standard control or programming a specific one to suit their needs. General Active X
controls have properties, methods and events, which help users, finish their project.

Calendar controls

Calendar control allows the user to set any time in KingView.

1. Define three memory analog tags in the data dictionary:

a. Variable name: year variable

Variable type: memory analog

Minimum: 0

Maximum: 10000

b. Variable name: month variable

Variable type: memory analog

Minimum: 0

Maximum: 12

c. Variable name: day variable

Variable type: memory analog

Minimum: 0

Maximum: 31

2. Create a new picture called: calendar control graph

3. Select from the toolbox, select the following control from the Insert General
Controls window, as follows:
Chapter 9 Control 4

Figure 9-5 Common control dialogue box

Click confirm to exit the dialogue box, draw the calendar control in the picture as shown
below:

Figure 9-6 Calendar control

4. Double-click anywhere in the calendar box to open the following animation link
properties dialogue box:

Figure 9-7 Animation connection property dialog of control

Set the control properties as follows:

Control name: ADate

Double-click the CloseUp event in the event property card; insert the following script
in dialogue box as shown:
Chapter 9 Control 5

Figure 9-8 Script dialog with event

5. Close the dialogue box, add three text boxes to the graph, connect the variables \\local
site\year variable, \\local site\month variable and \\local site\day variable in the Analog
Value Display animation textbox, select year, month and day of data in calendar in the control
shown.

6. Select save all pictures from the file menu to save the setting.
7. Select Switch to View from the File menu to enter the running system, as follows:

Figure 6-9 Calendar control graph when running

Click the pulling downwards button from the controls, select data from the pulling
downwards box, then the year, month and day will be shown in the textbox connecting \\local
site\year variable, \\local site\month variable and \\local site\day variable.
Chapter 9 Control 6

Review:
1. Understand the use of temperature control curve.
2. Read appendix three about KVADODBGrid control, grasp control usage.

S-ar putea să vă placă și