Professional Documents
Culture Documents
Instruction Handbook
Creating VP2 Programs, functionality and usage of VP2 objects, predefined routines, events
handling, VP2.Frames (optional), VP2 Tables, VP2 Trees, VP2.Builder(optional), troubleshooting
CR00758050_en-00/2014.10
The information contained in this manual is the property of COMAU S.p.A.
Reproduction of text and illustrations is not permitted without prior written approval by COMAU S.p.A.
COMAU S.p.A. reserves the right to alter product specifications at any time without notice or obligation.
SUMMARY
PREFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Symbols used in the manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Modification History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...22
lb-0-0-vp2TOC.fm
3
Summary
5. EVENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..82
Events handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Events associated to VP2 objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
PIPE reading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Callback on the VP2 object (Builder Model). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
User defined events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
lb-0-0-vp2TOC.fm
4
Summary
VP2_SCRN_AVAIL Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
VP2_SCRN_PDV_GET Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
VP2_SCRN_REMOVE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
VP2_SCRN_SET Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
VP2_SCRN_STATE Predefined Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
VP2_SCRN_INFO Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
VP2_SEL_SET Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
VP2_ADD Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
VP2_REMOVE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
VP2_UPDATE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
VP2_LOAD Predefined Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
VP2_SAVE Predefined Procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
VP2_INFO Predefined Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
PDL2 routines belonging to VP2_LIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
VP2_INIT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
VP2_PIPE_CREATE Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
VP2_PIPE_FLUSH Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
VP2_EVENTTXT Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
VP2_VB_INIT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
VP2_VB_MAIN Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
VP2_VB_EXIT Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
VP2_VB_ERRH Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
VP2_VB_ONUE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
VP2_VB_CNFG Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
VP2_VB_RSUE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
VP2_VB_PROP Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
lb-0-0-vp2TOC.fm
5
Summary
lb-0-0-vp2TOC.fm
6
Summary
lb-0-0-vp2TOC.fm
7
Summary
lb-0-0-vp2TOC.fm
8
Preface
PREFACE
– Symbols used in the manual
– Reference documents
– Modification History
This symbol indicates operating procedures, technical information and precautions that
if ignored and/or are not performed correctly could cause injuries.
This symbol indicates operating procedures, technical information and precautions that
if ignored and/or are not performed correctly could cause damage to the equipment.
This symbol indicates operating procedures, technical information and precautions that
are important to highlight.
pr-0-0-0-vp2_01.fm
00/1014 9
Preface
Reference documents
This document refers to the C5G Control Unit.
The complete set of manuals for the C5G consists of:
pr-0-0-0-vp2_01.fm
10 00/1014
Preface
Modification History
pr-0-0-0-vp2_01.fm
00/1014 11
General Safety Precautions
It deals with a general specification that apply to the whole Robot System. Due to its
significance, this document is referred to unreservedly in any system instruction manual.
1.1 Responsibilities
– The system integrator is responsible for ensuring that the Robot System (Robot
and Control System) are installed and handled in accordance with the Safety
Standards in force in the country where the installation takes place. The application
and use of the protection and safety devices necessary, the issuing of declarations
of conformity and any CE markings of the system are the responsibility of the
Integrator.
– COMAU Robotics & Service shall in no way be held liable for any accidents caused
by incorrect or improper use of the Robot System (Robot and Control System), by
tampering with circuits, components or software, or the use of spare parts that are
not included in the spare parts list.
The installation shall be made by qualified installation Personnel and should conform to
all national and local codes.
ge-0-0-0_01.FM
12 00/1011
General Safety Precautions
1.2.1 Purpose
These safety precautions are aimed to define the behaviour and rules to be observed
when performing the activities listed in the Applicability section.
1.2.2 Definitions
Robot System (Robot and Control System)
The Robot System is a functional unit consisting of Robot, Control Unit, Programming
terminal and possible options.
Protected Area
The protected area is the zone confined by the safety barriers and to be used for the
installation and operation of the robot
Authorised Personnel
Authorised personnel defines the group of persons who have been trained and assigned
to carry out the activities listed in the Applicability section.
Assigned Personnel
The persons assigned to direct or supervise the activities of the workers referred to in
the paragraph above.
Programming Mode
Operating mode under the control of the operator, that excludes automatic operation
and allows the following activities: manual handling of robot axes and programming of
work cycles at low speed, programmed cycle testing at low speed and, when allowed,
at the working speed.
ge-0-0-0_01.FM
00/1011 13
General Safety Precautions
Integrator
The integrator is the professional expert responsible for the installation and putting into
service of the Robot and Control System.
Incorrect Use
Incorrect use is when the system is used in a manner other than that specified in the
Technical Documentation.
Range of Action
The robot range of action is the enveloping volume of the area occupied by the robot
and its fixtures during movement in space.
1.2.3 Applicability
These Specifications are to be applied when executing the following activities:
– Installation and Putting into Service
– Programming Mode
– Auto / Remote Automatic Mode
– Robot axes release
– Maintenance and Repairs
– Putting Out of Service and Dismantling
ge-0-0-0_01.FM
14 00/1011
General Safety Precautions
– Connection between the Control Unit and the three-phase supply mains at the
works, is to be with a four-pole (3 phases + earth) armoured cable dimensioned
appropriately for the power installed on the Control Unit. See the product
Technical Documentation.
– The power supply cable is to enter the Control Unit through the specific fairlead and
be properly clamped.
– Connect the earth conductor (PE) then connect the power conductors to the main
switch.
ge-0-0-0_01.FM
00/1011 15
General Safety Precautions
– Connect the power supply cable, first connecting the earth conductor to the circuit
breaker on the mains line, after checking with a tester that the circuit breaker
terminals are not powered. Connect the cable armouring to the earth.
– Connect the signals and power cables between the Control Unit and the robot.
– Connect the robot to earth or to the Control Unit or to a nearby earth socket.
– Check that the Control Unit door (or doors) is/are locked with the key.
– A wrong connection of the connectors could cause permanent damage to the
Control Unit components.
– The C5G Control Unit manages internally the main safety interlocks (gates,
enabling pushbuttons, etc.). Connect the C5G Control Unit safety interlocks to the
line safety circuits, taking care to connect them as required by the Safety
standards. The safety of the interlock signals coming from the transfer line
(emrgency stop, gates safey devices etc) i.e. the realisation of correct and safe
circuits, is the responsibility of the Robot and Control System integrator.
In the cell/line emergency stop circuit the contacts must be included of the control unit
emergency stop buttons, which are on X30. The push buttons are not interlocked in the
emergency stop circuit of the Control Unit.
– The safety of the system cannot be guaranteed if these interlocks are wrongly
executed, incomplete or missing.
– The safety circuit executes a controlled stop (IEC 60204-1 , class 1 stop) for the
safety inputs Auto Stop/ General Stop and Emergency Stop. The controlled stop is
only active in Automatic states; in Programming the power is cut out (power
contactors open) immediately. The procedure for the selection of the controlled
stop time (that can be set on SDM board) is contained in the Installation manual .
– When preparing protection barriers, especially light barriers and access doors,
bear in mind that the robot stop times and distances are according to the stop
category (0 or 1) and the weight of the robot.
Check that the controlled stop time is consistent with the type of Robot connected to the
Control Unit. The stop time is selected using selector switches SW1 and SW2 on the
SDM board.
– Check that the environment and working conditions are within the range specified
in the specific product Technical Documentation.
– The calibration operations are to be carried out with great care, as indicated in the
Technical Documentation of the specific product, and are to be concluded
checking the correct position of the machine.
– To load or update the system software (for example after replacing boards), use
only the original software handed over by COMAU Robotics & Service.
Scrupulously follow the system software uploading procedure described in the
Technical Documentation supplied with the specific product. After uploading,
always make some tests moving the robot at slow speed and remaining outside the
protected area.
– Check that the barriers of the protected area are correctly positioned.
ge-0-0-0_01.FM
16 00/1011
General Safety Precautions
Programming Mode
– The robot is only to be programmed by the authorised personnel.
– Before starting to program, the operator must check the Robot System (Robot and
Control System) to make sure that there are no potentially hazardous irregular
conditions, and that there is nobody inside the protected area.
– When possible the programming should be controlled from outside the protected
area.
– Before operating inside the Protected Area, the operator must make sure from
outside that all the necessary protections and safety devices are present and in
working order, and especially that the hand-held programming unit functions
correctly (slow speed, emergency stop, enabling device, etc.).
– During the programming session, only the operator with the hand-held terminal is
allowed inside the Protected Area.
– If the presence of a second operator in the working area is necessary when
checking the program, this person must have an enabling device interlocked with
the safety devices.
– Activation of the motors (Drive On) is always to be controlled from a position
outside the range of the robot, after checking that there is nobody in the area
involved. The Drive On operation is concluded when the relevant machine status
indication is shown.
– When programming, the operator is to keep at a distance from the robot to be able
to avoid any irregular machine movements, and in any case in a position to avoid
the risk of being trapped between the robot and structural parts (columns, barriers,
etc.), or between movable parts of the actual robot.
– When programming, the operator is to avoid remaining in a position where parts of
the robot, pulled by gravity, could execute downward movements, or move
upwards or sideways (when installed on a sloped plane).
– Testing a programmed cycle at working speed with the operator inside the
protected area, in some situations where a close visual check is necessary, is only
to be carried out after a complete test cycle at slow speed has been executed. The
test is to be controlled from a safe distance.
– Special attention is to be paid when programming using the hand-held terminal: in
this situation, although all the hardware and software safety devices are active, the
robot movement depends on the operator.
– During the first running of a new program, the robot may move along a path that is
not the one expected.
– The modification of program steps (such as moving by a step from one point to
another of the flow, wrong recording of a step, modification of the robot position out
of the path that links two steps of the program), could give rise to movements not
envisaged by the operator when testing the program.
– In both cases operate cautiously, always remaining out of the robot’s range of
action and test the cycle at slow speed.
ge-0-0-0_01.FM
00/1011 17
General Safety Precautions
Before using the manual release devices, it is strongly recommended to sling the robot,
or hook to an overhead travelling crane.
– Enabling the brake releasing device may cause the axes falling due to gravity as
well as possible impacts due to an incorrect restoration, after applying the brake
releasing module. The procedure for the correct usage of the brake releasing
device (both for the integrated one and module one) is to be found in the
maintenance manuals.
– When the motion is enabled again following the interruption of an unfinished
MOVE, the track recovery typical function may generate unpredictable paths that
may imply the risk of impact. This same condition arises at the next automatic cycle
restarting. Avoid moving the Robot to positions that are far away from the ones
provided for the motion restart; alternatively disable the outstanding MOVE
programmes and/or instructions.
ge-0-0-0_01.FM
18 00/1011
General Safety Precautions
After replacement of the SDM module, check on the new module that the setting of the
stop time on selector switches SW1 and SW2 is consistent with the type of Robot
connected to the Control Unit.
ge-0-0-0_01.FM
00/1011 19
General Safety Precautions
ge-0-0-0_01.FM
20 00/1011
General Safety Precautions
1.2.5 Performance
The performances below shall be considered before installing the robot system:
– Stop distances
– Mission time (typ. case).
Stop distances
– With Robot in programming modality (T1), if you press the stop pushbutton (red
mushroom-shaped one on WiTP) in category 0 (according to the standard
EN60204-1), you will obtain:
Expected Stopping
Mode Case
speed time
For the safety inputs of the SDM module (e.g.
stop pushbutton of TP in wired version)
For the stop and enabling device inputs from 150 ms
the TP in wireless version, when the safety
T1 250 mm/s
wire transmission is active.
For the time-out of stop input and enabling
device from TP in wireless version, when the 350 ms
safety wire transmission is lost or interrupted.
– Considering the Robot in automatic modality, under full extension, full load and
maximum speed conditions, if you press the stop pushbutton (red
mushroom-shaped one on WiTP) in category 1 (according to norm EN60204-1)
you will trigger the Robot complete stop with controlled deceleration ramp.
Example: for Robot NJ 370-2.7 you will obtain the complete stop in about 85 °
motion, that correspond to about 3000 mm movement measured on TCP flange.
Under the said conditions, the stopping time for Robot NJ 370-2.7 is equal to 1,5
seconds.
– For each Robot type the limit stop time can be required to COMAU Robotics g
ge-0-0-0_01.FM
00/1011 21
Introduction
2. INTRODUCTION
This manual is intended for PDL2 developers who want to develop a User Interface with
graphic objects for the Teach Pendant.
– Developing your own Graphic Interface
– Functionality and usage of VP2 objects
– Events
– Predefined Routines for VP2 Programs use
– VP2 Tables
– VP2 Trees
– VP2.Frames (optional feature)
– VP2.Builder (optional feature).
– Troubleshooting
– Appendix - Form Attributes, Function Attributes, Events.
pr-0-0-vp2_01.fm
22 00/1014
Developing your own Graphic Interface
3.1 Glossary
– VP2 Object
– Container
– Component
– Callback
– .VPS and .LVP files
– .LST file
– VP2 Hierarchy
– ReadPipe model
– Builder model.
3.1.2 Container
A Container is a background object used to display one or more Components.
3.1.3 Component
A Component is a graphic object with its own shape, dimension, colour, features,
displayed onto the VP2 Object it belongs to. It also allows interacting with the user, from
within a VP2 program, if needed.
3.1.4 Callback
Ev_mask: INTEGERIt is a routine, associated to the callback field of the VP2 object,
called as soon as the Component triggers the action defined in the Ev_mask: INTEGER
pr-0-0-vp2_01 bis.fm
00/1014 23
Developing your own Graphic Interface
Each callback must be properly declared, i.e. by specifying ALL the required parameters
and using the EXPORTED FROM clause, otherwise it will NOT be activated upon the
associated event happens.
Example
-- VPS Hierarchy
#-ve_screen
| #-ve_menubar
| | #-ve_zero
| | #-ve_refresh
| #-ve_table
| | #-we_cedp_stats
pr-0-0-vp2_01 bis.fm
24 00/1014
Developing your own Graphic Interface
a. create a PDL2 non motion program, e.g. with NOHOLD attribute (see Sample
programs)
b. insert statement
IMPORT 'vp2_lib'
in the program header, in order to automatically import all the graphic objects
defined in such VP2_LIB library
Properly set $CRC_IMPORT predefined variable, to the search path for the files
included in the IMPORT statement.
pr-0-0-vp2_01 bis.fm
00/1014 25
Developing your own Graphic Interface
f. After the variables declaration, assign the values to the Components attributes
such as, for example, either X and Y coordinates or W (width) and H (height)
dimensions.
g. Besides the Screen, declare a Pane, Tabpane or Tabsheet Container on which the
chosen objects will be placed, to be possibly made invisible and then visible, upon
the needs.
The graphic objects are defined in the VP2_LIB.COD library that must be loaded
in the system before loading and executing the program.
h. After the objects declaration, insert the needed statements to display the Screen,
which means:
• add such Components to the Screen
• add the Screen to the device (usually the Teach Pendant) on which it has to
be displayed.
j. Choose the application viewing modality (see par. 3.3.2 Viewing the VP2
application on the Teach Pendant on page 27).
pr-0-0-vp2_01 bis.fm
26 00/1014
Developing your own Graphic Interface
IMPORT 'vp2_lib
UD:\SYS\TP\SETUP or UD:\SYS\TP\SERVICE
depending on whether the SETUP Page or the SERVICE Page is to be used, a as well
as the image of the associated icon, if wished, with the following features:
– format - gif,
– dimensions - 32x32 pixel
pr-0-0-vp2_01 bis.fm
00/1014 27
Developing your own Graphic Interface
– name of the image file - <name>.xml.gif , where <name> is the same name of the
XML file describing the new user subpage.
Please, note that the XML file and the associated icon gif file, MUST BE stored in the
same folder!
A whole example of both a program creating a new user page (PDL file) and a XML file
to access it, follows:
– VP2 program to create the SpinDial user page (SpinDial.PDL file):
BEGIN
-- The page is available in two different modes, depending on the following value:
-- 0: thte page is available as a SETUP or SERVICE subpage
-- (in this case a XML file is needed)
-- >0: the page is available in the LEFT MENU
ve_screen.ordinal := 0
ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := -1
ve_screen.h := -1
ve_screen.name := $PROG_NAME
ve_spin.x := 50
ve_spin.y := 50
ve_spin.w := 200
ve_spin.h := 32
ve_spin.value := 42
vi_scrn_id := VP2_SCRN_CREATE(ve_screen)
VP2_ADD(ve_screen, ve_spin)
-- the viewing type depends upon the selected above number
IF ve_screen.ordinal > 0 THEN
-- added to the left menu
VP2_SCRN_ADD(PDV_TP, vi_scrn_id)
ELSE
-- made available in either SETUP or SERVICE Page
VP2_SCRN_AVAIL(vi_scrn_id, IP_TO_STR($SYS_PARAMS[61]), '255.255.255.0')
ENDIF
PAUSE
END SpinDial
pr-0-0-vp2_01 bis.fm
28 00/1014
Developing your own Graphic Interface
<pageID>
<class-name>VP2</class-name>
<prog-name>UD:\Usr\SpinDial</prog-name>
</pageID>
</config>
The words included between ‘< >’ should always be present.
This file indicates that SpinDial.cod file is in UD:\Usr\SpinDialD folder .
– The name of the icon image file, must be SpinDial.XML.gif and be in the same
folder of SpinDial.XML file.
a. create a PDL2 program like the one shown in previous par. 3.3.2.1 Available as
SETUP or SERVICE subpage on page 27, by specifying a >0 value in the ordinal
field
b. insert the .GIF file name (together with the search path), containing the icon image
to be displayed on the Left Menu key, in the image: STRING[63] field of the Screen
The following table lists differences between the two described above programming
models:
pr-0-0-vp2_01 bis.fm
00/1014 29
Developing your own Graphic Interface
pr-0-0-vp2_01 bis.fm
30 00/1014
Developing your own Graphic Interface
pr-0-0-vp2_01 bis.fm
00/1014 31
Developing your own Graphic Interface
all the objects fields, their position and the hierarchical connections between them
(i.e. the ownership of an object related to another), from within the program.
In this case, the use of VP2.Builder (optional feature) is strongly suggested to
automatically create:
– a .cod program including all the basic statements needed to start with developing
the wished interface
– a .vps file including all the VP2 objects declarations
– a <prog_name>_Callback.lst file including the required callbacks definitions.
To give an idea about them, the content of such files is listed here below, even if in a
schematic and partial way.
It is suggested to purchase the VP2.Builder software option, possibly equipped with the
Vp2.Frames option, if the user thinks it opportune to be helped by the listed abovefiles.
By means of this modality, all the VP2 objects definitions and initialization to the default
values, is automatically inserted inside the .vps file.
However, the user can edit such fields, depending on the specific application needs. It
is suggested to pay special attention to form and func attributes and to events fields
(code and mask). the callback field must be initialized to a name of a routine that will
be called upon the associated event detection.
The callback definition can be copied from .lst file, to .cod or .pdl associated program
and it must be developed by the programmer. For example, in case of a Button, the
programmer will take care of inserting all actions to be performed upon such a Button
pressure.
– The callback declaration must properly contain the name, which means:
• ROUTINE <routine_name>,
• END <routine_name>,
• <component>.callback : ’<routine_name>’
– Each callback must be declared specifying the required parameters:
• ai_id -
• ai_event -
• as_data -
– and must include the EXPORTED FROM clause.
See par. 10.7.1 Callback to handle events related to the Components on page 160.
pr-0-0-vp2_01 bis.fm
32 00/1014
Developing your own Graphic Interface
WRITE LUN_CRT ('[', $PROG_NAME, '] Error :', ai_error, ' ', ERR_STR(ai_error),
NL)
END ru_onerror
-- User event handling, called when user event occurs
ROUTINE ru_onuserevent(ai_id, ai_event : INTEGER; as_data : STRING) EXPORTED FROM
Prg_scheleton
ROUTINE ru_onuserevent(ai_id, ai_event : INTEGER; as_data : STRING)
BEGIN
-- The user inserts his own user event handling in here
WRITE LUN_CRT ('[', $PROG_NAME, '] User Event :', ai_id, ' Event:', ai_event, '
Data:', as_data, NL)
END ru_onuserevent
BEGIN
-- Set to TRUE to run the application on the TP. Otherwise it will run on the PC
vb_ontp := TRUE
vi_debug := 0
ve_screen.x := 0; ve_screen.y := 0 -- Initialize Screen object
ve_screen.b_color := WIN_LIGHTGRAY
vp2_vb_init
-- Name of the routine which handles any errors associated to objects with ev_mask
-- set to vp2_on_error
vp2_vb_errh('ru_onerror')
-- Name of the routine which handles all user events occurring whenever
-- vp2_vb_rsue(user_event_number) is called
vp2_vb_onue('ru_onuserevent')
vp2_vb_cnfg(/ai_debug=vi_debug) -- Set debug mode
vi_scrn_id := VP2_SCRN_CREATE(ve_screen) -- Create the Screen
VP2_LOAD(STR_CAT(DIR_GET(1), $PROG_NAME))
ve_screen.name := $PROG_NAME
ve_screen.lun_name := STR_CAT('pipe:', $PROG_NAME)
ve_screen.host_w := -1
ve_screen.host_h := -1
ve_screen.w := -1
ve_screen.h := -1
ve_screen.ordinal := 1
-- Per TP o VP2.Frames
IF STR_LEN($PROG_ARG) > 0 THEN
DECODE ($PROG_ARG, vi_pdv)
VP2_SCRN_ADD(vi_pdv, vi_scrn_id)
ELSE
IF vb_ontp THEN -- For TP
IF ve_screen.ordinal > 0 THEN -- Add to Left Menu
VP2_SCRN_ADD(PDV_TP, vi_scrn_id)
ELSE
pr-0-0-vp2_01 bis.fm
00/1014 33
Developing your own Graphic Interface
pr-0-0-vp2_01 bis.fm
34 00/1014
Developing your own Graphic Interface
bm_id : INT
in_keymask : INT
comp_1 : INT
c_path : STR Len: 127
f_name : STR Len: 16
f_style : INT
f_size : INT
lun_name : STR Len: 32
image : STR Len: 63
ordinal : INT
host_x : INT
host_y : INT
host_w : INT
host_h : INT
callback : STR Len: 31
pr-0-0-vp2_01 bis.fm
00/1014 35
Developing your own Graphic Interface
x : INT
y : INT
z : INT
w : INT
h : INT
name : STR Len: 15
id : INT
attr_form : INT
attr_func : INT
units : INT
f_color : INT
b_color : INT
error : INT
visible : BOO
focusable : BOO
enabled : BOO
inkey : INT
ev_code : INT
ev_mask : INT
t_up : INT
t_down : INT
t_left : INT
t_right : INT
cm_id : INT
bm_id : INT
in_keymask : INT
help : STR Len: 63
f_name : STR Len: 16
f_style : INT
f_size : INT
line : INT
text : STR Len: 127
callback : STR Len: 31
pr-0-0-vp2_01 bis.fm
36 00/1014
Developing your own Graphic Interface
t_down: -1
t_left: -1
t_right: -1
cm_id: -1
bm_id: 4
in_keymask: -1
comp_1: -1
c_path: 'ftp://c4g/'
f_name: 'MONOSPACED'
f_style: 0
f_size: 14
lun_name: 'pipe:prg_scheleton'
image: ''
ordinal: 1
host_x: -1
host_y: -1
host_w: -1
host_h: -1
callback: 'scr'
pr-0-0-vp2_01 bis.fm
00/1014 37
Developing your own Graphic Interface
-- VP2 Hierarchy
#-ve_screen
| #-vpane004
| | #-vlabel005
pr-0-0-vp2_01 bis.fm
38 00/1014
Developing your own Graphic Interface
– the DATATYPE declaration (TYPE) defining all existing VP2 objects (both
Components and Containers).
The program must include the statement IMPORT 'vp2_lib', in order to import all
the existing declarations inside it
– the VP2 object fields identifiers declarations: attributes (e.g. vp2_notcomaulnf),
events (e.g. vp2_on_pressed), ations (e.g. vp2_update_sweep) and styles
(e.g. vp2_italic)
– VP2 environment initialization routine: VP2_VB_INIT Procedure. It must be called
just once, by the user program
– PIPE handling routines, useful software tool for reading VP2 objects associated
events (VP2_PIPE_CREATE Function, VP2_PIPE_FLUSH Procedure). Calling
this routine can be avoided by directly inserting VP2_VB_MAIN Function within the
SELECT structure of the program main (as shown in previous program example).
IMPORT ‘VP2_LIB’
– Never edit VP2_LIB file, to not endanger the VP2 environment performance. Such
a file is not protected in order to allow the user to easily refer to it.
– Insert GLOBAL attribute in defining variables and routines to be shared with other
programs that, in turn, will include the import statement in their declaration section
IMPORT <owning_program_name>
– Use ARRAY of VP2 objects instead of many individual VP2 objects, because they
are faster to be updated,
– Initialize all the VP2 objects ARRAY elements, to avoid the following error
"10851 Not additionable Component"
– Reduce the total amount of VP2 objects by using them again, if possible
– Never update Components either when they are not displayed or when their
Containers are not displayed
– Assign the menu id to the highest level VP2 object, a Screen if possible
– Reduce as much as possible the total amount of VP2_UPDATE Procedure calls,
by selecting suitable flags allowing to mark fields as being updated later
(vp2_update_later), for modified objects only
– Always check the routines returned status and properly handle errors by means of
a suitable routine, possibly called by VP2_VB_ERRH Procedure
pr-0-0-vp2_01 bis.fm
00/1014 39
Developing your own Graphic Interface
– Load the program in Full mode either from Prog Page (it is the default mode for
the Load command), or from commands menu using MemoryLoad/Full. Thus use
Memory Debug to execute program sections in different step modes, after inserting
the needed breakpoints
– In the usual working modes, avoid interrupting or slowing down the program
execution (e.g. adding too many VP2 objects updating operations, in some cases
even not displayed) because this would cause some problems such as “Pipe full”
and would decrease the interface reactivity
– Create user events to communicate among programs
– Use CONDITIONs instead of cyclically monitoring from within the program body
– Just monitor needed events in the right situation (by properly setting Ev_mask:
INTEGER field)
– In case of pipe full problems, use Vp2_stats, a sample program supplied in the
System Software CD, to know the amount of trafic on the pipe
– Reduce the total amount of VP2_SCRN_ADD Procedure and VP2_SCRN_DEL
Procedure calls
– Take into account the memory usage, the CPU time, the data transmission
between Interface and Controller, during the development phase.
Guided example
How to create a page with the text string "Hello World".
"Hello World" string is assigned as the text of a Label, VP2 object.
Once the Screen is created, add the Label to it and then add the Screen to the chosen
device that will display the new VP2 page (the TP, in our example).
PAUSE statement, used to pause a program, avoids to uslessly waste CPU time. Note
that the program is just PAUSED, NOT deactivated, otherwise the graphic objects would
disappear from the Screen!
To use this sample program as a skeleton to create his own program, the user can copy
VP_SAMPLE_EVENT.PDL file from the Software CD.
pr-0-0-vp2_01 bis.fm
40 00/1014
Developing your own Graphic Interface
pr-0-0-vp2_01 bis.fm
00/1014 41
Developing your own Graphic Interface
ve_button1.ev_code := 50009
In our example, WAIT FOR EVENT 50009 is satisfied as soon as the Button is pressed
(because of ve_button.ev_code := 50009).
Please note that, as previously said, the program must be active otherwisse the defined
and loaded graphic objects would disappear.
The result of running “Hello World” program is shown in Fig. 3.1:
Many VP2 sample programs are included in the Software CD (in folder
SwC5G_x.xx\PDL2Program\ExampleVP2, where x.xx is the System Software
version, e.g. SwC5G_1.00).
pr-0-0-vp2_01 bis.fm
42 00/1014
Functionality and usage of VP2 objects
4.1 Introduction
All VP2 objects have got some general properties, typical for any VP2 objects and listed
in Common Properties section, as well as some typical properties for specific objects,
listed in the corresponding paragraphs.
– Common Properties
– Containers
– Components.
VP2 objects are grouped according to a hierarchy starting from Screen and proceeding
to some other Containers (e.g. Panes) which are defined to contain some Components,
in turn.
To know the hierarchy of an active VP2 program, issue MemoryView2 command from
within TP-INT Page (or commands menu from WinC5G Terminal). Otherwise, if either
a .VPS file (binary file) or .LVP file (ASCII file) is available, the hierarchy is shown at the
bottom of such a file.
To viwe the declared variables values, issue Details (F6) command and select
Variables item from within Prog Page (or MemoryViewVariable command from within
TP-INT Page).
Each described below object is defined as a TYPE inside VP2_LIB.PDL file. The user
can directly check all fields, by opening such a file.
– X, Y: INTEGER, >=0
They are, respectively, the horizontal and vertical position of the object with respect
to the top left vertex of its Container. Such values must be properly set so that the
object lies within the Container area. They are interpreted with respect to the
chosen unit of measure.
Default: 0
pr-0-0-vp2_04.fm
00/1014 43
Functionality and usage of VP2 objects
– Z: INTEGER, >=0
It is an ordinal number that represents that object relative z-depth related to its
Container, which means the order in which it will be drawn. All VP2 objects without
this field, combined with those which have got it, would be drawn last, based on the
order that they were added to their Container.
VP2 objects with the lowest Z value, are drawn in front.
Default: 0
– W, H: INTEGER
They are, respectively, the object horizontal and vertical dimensions. The default
values are the ones of its parent, which means that if not set, the object will have
the same dimensions of its Container, thus it will completely cover over the whole
Container. Negative values are allowed for some VP2 objects (e.g. Line) only. It is
up to the programmer to properly set the objects dimensions so that they lie within
their Container area.
Such values are interpreted using the chosen unit of measure.
Default: parent Container's W and H
– Name: STRING[15]
It’s a text field, assigned to the VP2 object. It is useful only for the following objects:
• Tabsheet - the text is displayed as the Tabsheet name; it is the textual
representation of the object, where the name field is used as the text in the
Tabpane tab buttons.
• Screen - the text is displayed as the name of the Leftmenu button associated
to the Screen.
The majority of other VP2 objects does not require this field to be set, and is used
mainly for easy viewing the properties of the record at run time.
Default: None
The objects names are case sensitive, so please use the standard naming rules, as
defined in VP2_LIB. The same applies for the files including images.
pr-0-0-vp2_04.fm
44 00/1014
Functionality and usage of VP2 objects
– Help: STRING[63]
The text included in this field, is displayed in a tooltip style window, as soon as the
user presses the SHIFT key with the HELP key on the Teach Pendant. This does
not apply to VP2.Frames.
This feature is only available when using the _v2 versions of the object.
– attr_form: INTEGER, >0
It is a set of VP2 objects format attributes. VP2 objects properties are a bitmask of
values, corresponding to the wished attributes, OR'ed together and assigned to
attr_form field.
So, to change a VP2 object style, the new chosen style should be OR'ed with
vp2_notcomaulnf attribute (which excludes the default Comau style).
Example
Comau has got a default style for Buttons. The following program line shows how
to enable the vp2_3dlook from within a VP2 program, in order to display it in a
3-dimensional style:
VAR
ve_button: vp2button
…
BEGIN
ve_button.attr_form := vp2_notcomaulnf OR vp2_3dlook
…
END
Please refer to par. 12.1 Format attributes (attr_form) on page 167 for the VP2 objects
format attributes descriptions and applicability.
Please refer to par. 12.2 Functional attributes (attr_func) on page 170 for the VP2
objects functional attributes descriptions and applicability.
Description Value
Pre-defined Comau colours WIN_BLACK, WIN_MAGENTA, WIN_WHITE, WIN_RED,
WIN_CYAN, WIN_YELLOW, WIN_BLUE, WIN_GREEN,
WIN_GRAY, WIN_LIGHTGRAY, WIN_DARKGRAY, (0 to 31
Reserved as pre-defined colours)
Container colour 32
pr-0-0-vp2_04.fm
00/1014 45
Functionality and usage of VP2 objects
Description Value
No colour 33
System Colours 33… + (0x00FFFFFF) 16777216
RGB values: 0x1000000 to 0xFFFFFFFF
creates an RGB color with the specified
combined RGBA value consisting of the
transparency component (bits 24-31),
the red component (bits 16-23),
the green component (bits 8-15,
and the blue component (bits 0-7).
Default: f_color (WIN_BLACK), b_color (WIN_WHITE for editable objects,
WIN_LIGHTGRAY for others)
– Visible : BOOLEAN
This field determines whether the VP2 object could be visible or not. If it is placed
on a Container (e.g. Pane) and the Container's visible field is set to be INVISIBLE,
the associated VP2 object too will be invisible.
Default: TRUE
– Focusable : BOOLEAN
This field determines whether the focus (visually represented by a box surrounding
the object area) can be moved to the VP2 object or not. This allows the user to
navigate into the object by means of the keyboard. Set it to FALSE to prevent the
focus to be moved to an object.
Default: TRUE (just if focusing makes sense for such an object!)
– Enabled : BOOLEAN
This field determines whether the VP2 object is enabled, i.e. receive user input, or
not. If such an attribute is set to FALSE, the associated VP2 object is displayed in
grey and focusing is not allowed.
Default: TRUE
– Ev_code: INTEGER
This is a number chosen by the user, in a range between 49152 and 50175, with a
specific meaning; each event code is associated to an event generated upon an
action onto the corresponding VP2 object.
The event is program specific and can be monitored by means of the following
statement:
VP2 object.
pr-0-0-vp2_04.fm
46 00/1014
Functionality and usage of VP2 objects
Please refer to par. 12.3 Events on page 173 for the VP2 objects usable events
description and applicability.
Examples
myobject.ev_mask := vp2_on_keypressed
means that the VP2 object is allowed to receive just vp2_on_keypressed events.
A VP2 object may receive several events: simply OR all the wished event codes.
myobject.ev_mask:=vp2_on_keypressed OR vp2_on_released
Warning! in this case all events are sent to the program pipe, possibly reducing the
interface reactivity. Please, carefully evaluate all the events before assigning them to the
individual VP2 objects.
Default: The default event mask is defined in the client software and is effectively
the same as setting:
vp2_on_close OR vp2_on_open OR vp2_on_error OR vp2_action_performed
Anyway, please note that an event can be either enabled or not, depending on the
VP2 object.
– t_up, t_down, t_left, t_right: INTEGER
These fields contain the id of the VP2 object that is to be navigated into, when the
user presses the arrow key in such a direction (on the Teach Pendant). If these
fields are unintialized, then the automatic navigation algorithm with decide where
to move the cursor; if the program inserts a value in one or more of these fields,
then the algorithm is not used and the cursor is handled by the VP2 object with an
id corresponding to such a value.
– f_name, f_style, f_size: STRING[16], INTEGER, INTEGER
Font name determines the shape of the characters used on Label and other VP2
objects. For VP2 objects using texts, the font properties can be defined. These are:
• f_name It is the font name. These can be 'serif', 'sansserif', 'monospaced',
'dialog', etc.
• f_style It is the font modifier. It can be vp2_plain, vp2_bold, vp2_italic,
vp2_under or a combination of them
• f_size It is the font size in pixel
pr-0-0-vp2_04.fm
00/1014 47
Functionality and usage of VP2 objects
In VP2 the following font styles have been defined, and can be assigned to f_style.
• vp2_plain : Plain
• vp2_italic : Italic
• vp2_bold : Bold
– bm_id : INTEGER
The context menu id has to be explicitly defined for each VP2 object:
-1 (UNINIT) and -2, mean no context menu.
– callback : STRING[31]
Name of the function, callback, called whenever one of the associated events to
the defined VP2 object is triggered.
Please note that the callback declaration must always have the following format, in
the program:
Each callback must be completely and properly defined, on the user’s responsibility,
otherwise it will not be activated when the associated event is triggered.
Next paragraphs describe all the available VP2 objects and their specific attributes.
4.3 Container
By definition, a Container is an element on which another VP2 object can be placed and
logically linked.
A detailed description is supplied about the following Containers:
– Screen
– Tabsheet
– Tabpane
– Pane
– VP2 Tables
– VP2 Trees.
To logically associate any objects to a Container, the following steps are required:
– call VP2_ADD Procedure, or
– define the object as being hierarchically dependent from the Container (in
.VPS/.LVP file)
In order to be able to view such objects placed onto the Container, the Container itself
must be visible too (.visible := TRUE) and its status must have been updated
pr-0-0-vp2_04.fm
48 00/1014
Functionality and usage of VP2 objects
(VP2_UPDATE Procedure).
For further information about the events applicability for VP2 Containers, please refer to
par. 12.3.1 Events applicability to VP2 objects on page 174.
In particular, the following events are applicable: vp2_on_win_close, vp2_on_visible,
vp2_on_hidden.
4.3.1 Screen
Datatype: vp2screen
L’oggetto Screen è la base per tutti gli oggetti della pagina. Qualsiasi programma VP2
necessita di uno Screen su cui si possano posizionare gli altri oggetti.
Utilizzo
Uno Screen non è contenuto in un Container. Alcune proprietà dello Screen, come x, y,
w, h, enabled, visible, f_color e b_color, sono ereditate dai figli (Component ed
eventuali Container).
The Screen object is the base for all VP2 objects on the page. Any VP2 program needs
a Screen object on which the other VP2 objects could be placed.
Usage
A Screen is never contained in a Container. Some of its properties, such as x, y, w, h,
enabled, visible, f_color and b_color are inherited by its children.
– X, Y: INTEGER, >=0
– W, H: INTEGER - if set to -1, the Screen is automatically set to the dimensions of
the Teach Pendant screen
– Name: STRING[15] - this name appears in the text of the Left Menu key associated
to this Screen (Page)
– Id: INTEGER, >0
– attr_func: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– Help: STRING[63]
WARNING!
To properly display the Bottom Menu (if existing) associated to the Screen, the Screen
bm_id field must be initialized to the Menubar identifier (Id)
pr-0-0-vp2_04.fm
00/1014 49
Functionality and usage of VP2 objects
ve_screen.comp_1 := MyTextBox.id
MyPane.visible := TRUE
where MyTextBox belongs to MyPane and focus is wished to be placed on it
(textbox).
– c_path: STRING[127] - a search path can be defined for obtaining images to be
dislayed onto the Screen.
– lun_name: STRING[32] - input pipe name for input events. Does not have to be a
pipe. If not assigned, the VP2 program does not receive any events.
It is suggested that the pipes names and the programs names are the same, so that it
is automatically assured that they are unique in the system.
If the same pipe name is used by different programs, it is possible to get unpredictable
behaviours.
– image: STRING[63]
filename, including the search path, containing the associated icon to the Screen
Left Menu key.
– ordinal: INTEGER - it’s the position of the associated key, in the Left Menu
– host_x : INTEGER - VP2.Frames host position X
– host_y : INTEGER - VP2.Frames host position Y
– host_w : INTEGER - VP2.Frames host dimension width
– host_h : INTEGER - VP2.Frames host dimension height
– callback : STRING[31]
4.3.2 Tabsheet
Datatype: vp2tabsheet
Usage
Each subpage (Tabsheet) of the Tabpane is to be declared as a separate and defined
vp2tabsheet type object, i.e. with assigned attribute values. A Tabsheet is linked to a
Tabpane by calling VP2_ADD Procedure:
VP2_ADD (mytabpane, mytabsheet).
Each new Tabsheet is inserted at the beginning of its Tabpane (i.e. each new subpage
is inserted on the left of the already existing ones). The maximum quantity of Tabsheets
in a Tabpane, depends on the Tabpane physical width, so that the subpages Labels do
not exceed the Container boundaries!
The properties of a Tabsheet are as follows:
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
pr-0-0-vp2_04.fm
50 00/1014
Functionality and usage of VP2 objects
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– comp_1: INTEGER - first focusable Component id.
If the comp_1 property of a Tabsheet il properly set, but during the program
execution the focus does not move onto such a Component, it is needed to set it
from the Screen to the Tabpane, then to the Tabsheet and finally to the Component.
This means:
myscreen.comp_1 := mytabpaneid
..
mytabpane.comp_1 := mytabsheetid
..
mytabsheet.comp_1 := mycomponentid
4.3.3 Tabpane
Datatype: vp2tabpane
A tabpane is a placeholder for separate Panes and VP2 objects, in pages identified by
a Label. A Tabpane is the Container where Tabsheets can be placed.
Usage
The Tabpane dimensions will determine the area that the Tabsheet can be placed on.
A Tabpane is defined as an object of vp2tabpane type and may be added to any
Container, calling VP2_ADD Procedure:
VP2_ADD (mycontainer, mytabpane).
The Cartesian co-ordinates are referred to the parent Container. Hence a value of
(x,y) = (0,0)
places the Tabpane on the top left corner of the parent Container. Tabpanes are
Scrollable, to allow more Tabsheets to be added than could be displayed in the top tab
bar at any one time.
The properties of Tabpane are as follows:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_func: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
pr-0-0-vp2_04.fm
00/1014 51
Functionality and usage of VP2 objects
– Ev_mask: INTEGER
– bm_id : INTEGER
– comp_1: INTEGER - first focusable Component id
– value: INTEGER - it is the currently selected Tabsheet. Default: if no values are
set, it is the ordinal number of the first added Tabsheet, no matter its position within
the Tabpane.
4.3.4 Pane
Datatype: vp2pane
The Pane, like the Tabpane, is an object that can hold other objects, logically assigned
to it. It is recommended to use a Pane when several pages are to be displayed on the
same Screen.
Usage
The Pane can be added to a Container of higher hierarchy i.e. either a Tabsheet or a
Screen, using VP2_ADD Procedure:
VP2_ADD(mycontainer, mypane).
The co-ordinates are referred to the Container.
If the PANE is set to ‘invisible’, any objects included in it are invisible as well.
pr-0-0-vp2_04.fm
52 00/1014
Functionality and usage of VP2 objects
4.4 Component
VP2 Components are single VP2 objects which can be displayed on a Container.
The following VP2 Components allow the user to interact with the running program
during its execution. The interaction with Components from within a VP2 Program, can
be achieved by means of VP2 events detection. For further information, see Chap.5. -
Events on page 82.
– Button
– Label
– Progress Bar
– Combobox
– Checkbox
– Checkgroup
– Textbox
– Spindial
– Menubar
– Menu
– Message Bar
– DataLink
– Coldef.
There is one more category of VP2 Components which DOES NOT handle any
interaction with the user: Graphics (they exclude any user interaction).
4.4.1 Button
Datatype: vp2button
The Button is a VP2 Component for sending events to the program. It can be a
“Component release” event, or a PC mouse click/release event (in case of VP2.Frames
(optional feature)).
To modify the colour of a Button, il is needed to assign the attr_form field to
vp2_fill OR vp2_notcomaulnf
Usage
When the Button is released on the GUI, an event (e.g. vp2_on_released) is sent to the
program (see Cap. Events on page 82) which can be either read by the PIPE or handled
by means of a
WAIT FOR <event_code>
statement.
The Button can be customized, e.g. the 3-dimensional aspect, just if the wished
attributes are OR’ed with vp2_notcomaulnf attribute (which excludes the default Comau
pr-0-0-vp2_04.fm
00/1014 53
Functionality and usage of VP2 objects
style).
By default, a Button has a Comau style border (see the first figure in par. Examples on
page 54). To specify a different border, use one of the vp2_bstyle1..vp2_bstyle4 form
attributes (attr_form: INTEGER, >0).
Example:
ve_mybut.attr_form := vp2_bstyle1 OR vp2_notcomaulnf
Examples
La tabella che segue, mostra delle combinazioni di proprietà visive per i Button. Tali
comportamenti possono essere estesi alla maggior parte degli oggetti VP2.
Impostando il campo attr_form ai valori sottoelencati, il Button avrà l’aspetto mostrato
nella tabella:
The following table shows some combinations of visual properties for Buttons. Such
behaviours can be extended.
Thus setting the attr_form field to the listed below values will result in the Buttons
depicted below:
pr-0-0-vp2_04.fm
54 00/1014
Functionality and usage of VP2 objects
Default (0)
vp2_notcomaulnf OR vp2_bstyle1
vp2_notcomaulnf OR vp2_haleft
vp2_notcomaulnf OR vp2_vatop
I Button possono avere il testo scritto in 4 diversi font. Per esempio, con il campo
attr_form impostato al valore di default, il Button ha l’aspetto seguente (a seconda del
valore dell’attributo f_name):
f_name
sansserif monospaced
In addition, each font can have different styles. Going along with 'monospaced' font, the
following styles can be set using the f_style attribute.
pr-0-0-vp2_04.fm
00/1014 55
Functionality and usage of VP2 objects
f_style
vp2_plain vp2_bold vp2_italic
Different colours (see f_color, b_color: INTEGER, >0) can also be assigned to the
Button background or foreground (i.e. the string).
For example:
b_color := WIN_BLUE
f_color := WIN_YELLOW
f_style := vp2_italic OR vp2_bold
A Button can also display an image instead of a text. The picture is generally stored in
the UD: directory on the Controller; if the user wishes to store it elsewhere, the search
path must be specified.
In the following example, the image is assigned to the Button (as shown in the below
picture):
image := 'ComauGlobe.gif'
4.4.2 Label
Datatype: vp2label
Labels are used to specify the meaning of other Components contents e.g. Textbox,
Spindial and Combobox.
Checkboxes and Checkgroups do not require any Labels.
Labels DO NOT receive user input: they just display information.
Usage
By default, the Label text is horizontally and vertically centred. Also width and height
properties are inherited from the Container, which may be overridden by the program.
The properties of Label are as follows:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
pr-0-0-vp2_04.fm
56 00/1014
Functionality and usage of VP2 objects
The Progress Bar is used to graphically show how the value of a specified parameter is going on,
related to its maximum value. A full Progress Bar means 100% of the total value.
Usage
By default, the Progress Bar inherits foreground and background colours from its Container and has
no borders. Its value can be set to represent the fullness of the Progress Bar.
pr-0-0-vp2_04.fm
00/1014 57
Functionality and usage of VP2 objects
– bm_id : INTEGER
– value: REAL - progress value (from 0 to 100). Default: 0.
– callback : STRING[31].
Some examples are supplied below, in order to better explain the usage of the Progress
Bar attributes; the colours used in the first three examples are as follows:
b_color = WIN_LIGHTGRAY and f_color = WIN_RED.
4.4.4 Combobox
Datatype: vp2combobox
The Combobox is a VP2 Component, which holds a list of pre-defined entries, allowing
data entry both quicker and more reliable.
Usage
The Combobox contents are set in the text field, as a semicolon separated string of
items. Set the Combobox selection by using the value field. The programmer must take
care that the item text and the font size fit within the Combobox dimensions. The
Combobox scroll capability is enabled and, if the number of items in the text field are
greater than can be displayed in the popup, the scrollbar is enabled.
The properties of Combobox are as follows:
pr-0-0-vp2_04.fm
58 00/1014
Functionality and usage of VP2 objects
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
In case in which the popup list of the open Combobox, overflows below other objects
(e.g. the Menubar), set up the Screen height (H field) to -1. the view format is
automatically adjusted, so that the Combobox is open upwards or downwards,
depending on the available freee space on the Screen, when the other Components are
present.
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– attr_func: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Focusable : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Help: STRING[63]
– f_name, f_style, f_size: STRING[16], INTEGER, INTEGER
– text: STRING[127] - Semicolon separated elements.
In case in which the Combobox does not properly display all the available items, it
is suggested to enlarge the text field (it just allows until 127 characters for each
item). The user can create a customized vp2combobox TYPE which text field is
enlarged up to 1024 characters. The new type can be defined using a suffix
composed by ‘_’ character followed by the wished name (e.g.
vp2combobox_sample): this new vp2combobox type will display all the items,
as required). For example For further details see par. 4.5 Customizing VP2 objects
on page 81
– value: INTEGER - it is the current selected value. Default:0.
– s_values : ARRAY[16] OF REAL - specifies each Combobox item value. It
associates a numeric value to each element inserted into the Combobox. It can be
useful for special needs.
Example:
the Combobox contains all the days of the week, as STRINGs
mycombo.text:='MON;TUE;WED;THR;FRI;SAT;SUN'
Write a VP2 program to read the correspondance between working hours and days
of the week (e.g. when TUE is selected, it is wished that the value of the associated
variable is 8, because Tuesday has got 8 working hours).
If this field initialization is as follows
pr-0-0-vp2_04.fm
00/1014 59
Functionality and usage of VP2 objects
mycombo.s_values[1]:=8
mycombo.s_values[2]:=8
mycombo.s_values[3]:=4
mycombo.s_values[4]:=4
mycombo.s_values[5]:=0
mycombo.s_values[6]:=0
mycombo.s_values[7]:=0
Example
In the example below, ve_mycombobox is the Component, vs_item is the sequence
of items. These values are assigned to the Combobox at its definition time. The user
chooses the second item, to send a command to the program.
CONST ki_comboid = 1
BEGIN
…
vs_item := 'Item1;Item2;Item3'
mycombobox.x := 50
mycombobox.y := 50
mycombobox.w := 75
mycombobox.h := 30
ve_mycombobox.text := vs_item
ve_mycombobox.id := ki_comboid
…
CYCLE
ENDSELECT
A few examples follow of the Combobox form (use of the attr_form field):
pr-0-0-vp2_04.fm
60 00/1014
Functionality and usage of VP2 objects
4.4.5 Checkbox
Datatype: vp2checkbox
Usage
The value for a selected Checkbox (see the above figure) is 1; for a deselected one it is
0.
A text can be associated to a Checkbox to indicate its meaning. It is needed to properly
set up width (W) and height (H) fields to exactly contain the being displayed text.
Set attr_form field in the following way, to be able to use s_color and u_color:
vp2_notcomaulnf OR vp2_mark_sel
pr-0-0-vp2_04.fm
00/1014 61
Functionality and usage of VP2 objects
– s_color: INTEGER - it is the colour when the Checkbox is selected. Default: as its
Container
– u_color: INTEGER - it is the colour when the Checkbox is unselected. Default: as
its Container
– value: INTEGER - 0 = Checkbox is not selected, 1 = Checkbox is selected.
– text: STRING[31] - Checkbox associated text .
– callback : STRING[31]
Examples
The following list shows some of the attributes that can be set for the Checkbox
attr_form field:
vp2_notcomaulnf
vp2_notcomaulnf OR vp2_text_left
0(Default)
vp2_notcomaulnf OR vp2_square
vp2_notcomaulnf OR vp2_symbol_check
vp2_notcomaulnf OR vp2_symbol_cross
Also fonts and colours can be changed as with the Button. A few examples:
f_color := WIN_RED
b_color := WIN_GREEN
4.4.6 Checkgroup
Datatype: vp2checkgroup
The Checkgroup is a set of VP2 objects that can be toggled to TRUE/FALSE.
The selected element of the Checkgroup is given back as the third parameter when
reading the PIPE.
Usage
The text property is used to group several check items together without separate
definitions, e.g.:
pr-0-0-vp2_04.fm
62 00/1014
Functionality and usage of VP2 objects
ve_checkgroup1.text:='item1;item2;item3;item4;’item5;item6'
The default attr_func is that several items can be checked at the same time (See
Example). However a Checkgroup may be exclusive i.e. only one element of the group
may be checked at any time or NON-exclusive, in which case any number of checks can
be set. The value of Checkgroup items may be set at the program execution time, by
setting the value property to the bitmask. For example for a six item Checkgroup, to set
items 1 and 3 and 4, the following assignment must be done:
The programmer must properly set the Checkgroup dimensions i.e. x, y, cols, v_gap
and h_gap so that to be able to insert all the wished elements in the Checkgroup area.
The default height of each check item is 20. The usage of colours are similar to
Checkbox.
The properties of Checkgroup are as follows:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0 - Default: Radio Button;
– attr_func: INTEGER, >0 - Default: Not exclusive
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– Help: STRING[63]
– bm_id : INTEGER
– comp_1: INTEGER - First focusable Component id. Default: None
– cols: INTEGER - Number of columns. Default: 1
– f_name, f_style, f_size: STRING[16], INTEGER, INTEGER. Default: as its
Container.
– h_gap: INTEGER - Horizontal gap between columns. Default: 0
– v_gap: INTEGER - Vertical gap between rows. Default: 0
– s_color: INTEGER - Colour when selected. Default: as its Container.
– u_color: INTEGER - Colour when un-selected. Default: as its Container.
– value: INTEGER - Bitmask of selected items.
– text: STRING[255] - Semicolon-separated elements.
– callback : STRING[31].
Example
The Checkgroup default behaviour is that several items can be selected at the same
time, as shown in the following picture. Other visual effects of setting attr_form and
attr_func are the same as the Checkbox.
pr-0-0-vp2_04.fm
00/1014 63
Functionality and usage of VP2 objects
s_color and u_color properties can also be applied, like for Checkbox:
f_color := WIN_BLACK
b_color := WIN_GREEN
u_color := WIN_WHITE
s_color := WIN_RED
4.4.7 Textbox
Datatype: vp2textbox
It is an editable VP2 componente, suitable to contain text strings.
Usage
Usually a Label is placed beside the Textbox to identify a meaning for the typed
characters. The Textbox comes with numerous properties many of which are bitmasked
in the attr_form and attr_func fields e.g. ‘right, left and centre alignment’.
The properties of Textbox are as follows:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– attr_func: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Focusable : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
WARNING:
In setting up this field for vp2textbox component, the user should always include
vp2_action_performed event (or, as an alternative, vp2_on_textchange).
Otherwise, the PDL2 program will not be able to know the text written inside the
component by the user.
pr-0-0-vp2_04.fm
64 00/1014
Functionality and usage of VP2 objects
Examples
The following list provides a few examples for combination of attr_form attributes:
(Default)
vp2_notcomaulnf OR vp2_bstyle1
vp2_notcomaulnf OR vp2_noborder
It is also allowed that attr_func field can be set so that all characters are selected at
once when receiving focus:
vp2_notcomaulnf OR vp2_presel
4.4.8 Spindial
Datatype: vp2spindial or vp2spindial_v2
The Spindial VP2 object is editable by the user: the input value can only be numerical
(in the Textbox, on the contrary, only text characters are allowed). The numerical value
can be modified both by typing and pressing the arrows.
The difference between the two Spindial types stands in the big_increment field
representing a percentage of increment/decrement when pressing PAGEUP and
PAGEDOWN keys.
pr-0-0-vp2_04.fm
00/1014 65
Functionality and usage of VP2 objects
Usage
The Spindial is operational only if the minimum (min_val) and maximum (max_val)
values are set in the program. In addition, as with other VP2 Components, the font size
has to be appropriately set to fit the Spindial dedicated area.
If the value field is NOT INITIALIZED, the Spindial is displayed as disabled (grey). In
order to select the Spindial, it is needed that it has already been set to a value.
WARNING:
In setting up this field for vp2spindial or vp2spindial_v2 component, the user should
always include vp2_action_performed event (or, as an alternative, vp2_on_textchange).
Otherwise, the PDL2 program will not be able to know the text written inside the
component by the user.
pr-0-0-vp2_04.fm
66 00/1014
Functionality and usage of VP2 objects
– max_val: INTEGER - Maximum value that the Spindial can contain. Default: 100
– increment: INTEGER - Amount to increment / decrement the value by. Default: 1
– unitsused: STRING[127] - The units associated with this VP2 Control. Default:
blank (no units)
– callback : STRING[31].
– big_increment: REAL - only present for vp2_spindial_v2 type. It is the
increment field multiple when PAGEUP/PAGEDOWN keys are pressed. For
instance, if big_increment is 5 and increment is 10, the field is increased of 50,
when pressing pageup key. Default:
Example:
vp2_myspindial.attr_form := 0
vp2_myspindial.attr_func := vp2_dtype_numf or vp2_dp_3
vp2_myspindial.increment := 0.01
ve_myspindial.ev_mask:=vp2_chooser_gained or vp2_action_performed or
vp2_on_pressed or vp2_focus_gained or vp2_on_pressed
Examples
A few examples for attr_form are as follows:
O(Default)
vp2_notcomaulnf
vp2_notcomaulnf OR vp2_3dlook
4.4.9 Menubar
Datatype: vp2menubar
This VP2 Component is the placeholder for menus.
pr-0-0-vp2_04.fm
00/1014 67
Functionality and usage of VP2 objects
Usage
By default the Menubar is passed to the Bottom Menu of the Teach Pendant, as the
placeholder for menu items.
ve_screen.bm_id := ve_menubar.id
It is also needed to call VP2_ADD Procedure to add the Menubar to its Container.
Example
VP2_ADD(ve_menubar, ve_screen)
or
VP2_ADD(ve_menubar, ve_pane)
VP2_UPDATE(ve_screen)
or
VP2_UPDATE(ve_pane)
NOTE S
– The Menubar is displayed only if the object containing it has the focus on one
of its own Components.
– To properly display a Bottom Menu, its Container (Screen or Pane) field
bm_id must be initialized to the Menubar identifier (id).
A Menubar has an artificial limit on the number of Menus that may be added to it. This
is currently set at 6 since the Teach Pendant can only support 6 Bottom Menu keys at
any one time.
The properties of Menubar are as follows:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0 (future release)
– attr_func: INTEGER, >0
– f_color, b_color: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
pr-0-0-vp2_04.fm
68 00/1014
Functionality and usage of VP2 objects
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– comp_1: INTEGER - The ID of the focusable Component to set first focus to.
– callback : STRING[31].
4.4.10 Menu
Datatype: vp2menu
This Component can be a true Menu or just a Menu item, depending on whether or not
vp2_typterm is specified in its attr_func field (see description of vp2_typnrm,
vp2_typlngpr, vp2_typterm).
Each VP2 Component of Menu type, must be associated either to a Container or to a
Menubar.
Usage
The Teach Pendant currently only supports Menus from the Bottom Menu.
There are basically three types of Menus:
– Actions Menu (F1..F6)
– Popup Menu
– Options Menu (long press)
Each menu item has an ordinal number (campo ordinal) defining its position. When the
menu is disabled, its submenus are not displayed.
In VP2 a Menu complies the following rules:
– a submenu can be associated to a Menu (vp2menu)
– to be able to display a Menu, it must be associated to a Menubar (vp2menubar)
including it
– to associate a context menu to a Component (e.g. to a mouse right key click), the
context menu id must be assigned to the cm_id field of thte Component.
The menu items can be immediately added and removed from the Menu structure, but
the modification will take effect only the first time the Menu will be opened. This means
that if the Menu is already open, it must be closed and the opened again to be able to
see the performed modifications.
A Menubar can be removed from its Container, with immediate effect; anyway, if the
Menu is open while the removing operation is performed, the Bottom Menu disappears
but the the already open Menus still remain open and it is needed to type ESC to close
them!
Menus have the following fields:
– Name: STRING[15]
– Id: INTEGER, >0
– attr_func: INTEGER, >0
– Visible : BOOLEAN
– Focusable : BOOLEAN
– Enabled : BOOLEAN
pr-0-0-vp2_04.fm
00/1014 69
Functionality and usage of VP2 objects
– Ev_mask: INTEGER
– text: STRING[127] - Menu name (displayed in the Menu key).
– image: STRING[63] - name of the file containing the icon associted to the Menu or
to the Menu item.
– ordinal: INTEGER - position of the menu item, from 1 to 6. Not necessarily it must
be sequential: it just indicates the relative position, inside the Menubar Container.
Be sure to have properly set this field in all the menus belonging to the Menubar,
otherwise the system will assign the position according to the adding sequence to
the parent Menubar.
– callback : STRING[31].
pr-0-0-vp2_04.fm
70 00/1014
Functionality and usage of VP2 objects
It is also possible not to associate any key to the MessageBar, thus specifying
vp2_b_none. For example if it is wished to display a MessageBar showing the 'work in
progress……' text.
The program must identify which key has been pressed and take the suitable actions.
Example
In this example, the detected event can come from either the OK key or the CANCEL
key pressure which are the only possibilities available to the user:
– ru_dialog - is the callback called when an action is performed on the message bar
The message bar field for the callback must be set to the ru_dialog routine name
ve_msgbar.callback := 'ru_dialog'
pr-0-0-vp2_04.fm
00/1014 71
Functionality and usage of VP2 objects
4.4.12 DataLink
Datatype: vp2datalink
A field of a VP2 object can be linked to another variable (which could belong to either
the PDL2 program owning the object itself, or another program). The linked variable is
monitored, thus when its value changes:
– the linked field value is updated (exactly like performed by the “autoupdate”
funtionality of VP2 objects)
– the object is updated on the screen (exactly like when a field value is modified and
the VP2_UPDATE Procedure is called).
From the PDL2 programmer’s point of view, a DataLink is a VP2 RECORD (whose
TYPE is defined in the VP2_LIB library):
– data: STRING[128] - name of the field of the being updated object as soon as the
linked value changes
– link: STRING[128] - name of the being monitored variable
– attr_func: INTEGER, >0
– Id: INTEGER, >0 -
– idx1: INTEGER -
– idx2: INTEGER -
– interval: INTEGER - monitoring time interval, in ms. This time is not guaranteed by
VP2, because it depends on how many DataLinks exist in the application
– enabled: BOOLEAN - enables/disables updating the field. TRUE means enable.
The Datalink does not update the linked field value, as soon as it is disabled. As for
other VP2 objects, VP2_UPDATE Procedure must be called to update the
DataLink, before the modification becomes effective.
Please note that the update operation is just performed when the Component is visible.
If it is not displayed for a certain time interval, it will not be automatically updated when
displayed later.
It is then needed to call VP2_UPDATE Procedure.
The functional attribute vp2_mon_not_visible is also available, to allow the DataLink
object to be updaated even if not visible.
c. set the link field value (use the proper syntax to specify the name of the being
monitored variable owning program.
Example: vp_sampledl->count where vp_sampledl is the program name and the
count variable belongs to it and is an INTEGER)
d. call VP2_ADD Procedure to add the DataLink to the being monitored VP2 object.
pr-0-0-vp2_04.fm
72 00/1014
Functionality and usage of VP2 objects
4.4.13 Coldef
Datatype: vp2coldef
In order to add columns to a VP2 Table, some vp2coldef type variables must be defined
to be added to the table.
The record structure is as follows:
– W: INTEGER column width
– name: STRING[64] caption
– Id: INTEGER, >0 - Component identifier
– Enabled : BOOLEAN
– Visible : BOOLEAN
– attr_func: INTEGER, >0
– Ev_mask: INTEGER - the default event and the available one are, respectively,
vp2_on_error and vp2_action_performed
– ordinal: INTEGER - it is this column position inside the parent table
– data: STRING[127] - it is the field name for each row in the table, correspondig to
this column
– callback : STRING[31].
4.4.14 Graphics
Among VP2 Components, the following predefined graphic objects are provided:
– Image
– Line
– Arc
– Rect
– Roundrect
– Polyline
– Oval
– Polygon
4.4.14.1 Image
Datatype: vp2image
Usage
The Image field of the vp2image structure is used to indicate the file including the being
displayed image; the search path, c_path field, indicates the folders path to look for it.
There is not a default path: it must always be specified. If it is too long, use the DIR_GET
predefined routine, in order not to use all the available characters in the Image field.
As for Buttons, an Image has no border by default. To specify a border, use the
attr_form field.
An Image has got the following properties:
pr-0-0-vp2_04.fm
00/1014 73
Functionality and usage of VP2 objects
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– b_color : background color (for further information, see f_color, b_color:
INTEGER, >0)
– Visible : BOOLEAN
– Focusable : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– image :STRING[63] - Name of the file (including the search path) which contains
the Image.
– callback : STRING[31].
NOTE THAT the Image Component dimensions must be greater equal than the being
displayed Image dimensions, in pixels. Otherwise the image will not be displayed.
4.4.14.2 Line
Datatype: vp2line
A Line VP2 Component is a graphical representation of a line.
Usage
A Line is defined by a start point (x,y) and the dimensions (w,h) of the rectangle whose
diagonal is exactly the Line (see the picture above). Negative values for w and h are
allowed.
A Line has got the following attributes:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
pr-0-0-vp2_04.fm
74 00/1014
Functionality and usage of VP2 objects
– f_color : foreground color (for further information see f_color, b_color: INTEGER,
>0)
– Visible : BOOLEAN
– Focusable : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Help: STRING[63]
– line: INTEGER - Line thickness. Default: 1 pixel.
– callback : STRING[31].
4.4.14.3 Arc
Datatype: vp2arc
The Arc VP2 Component is the graphical representation of an arc.
Usage
This Component is defined by its start and end angles.
An Arc has got the following properties:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– f_color : foreground color (for further information see f_color, b_color: INTEGER,
>0)
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER (cm_id is for future release)
– Focusable : BOOLEAN
– line: INTEGER - Line thickness. Default: 1 pixel.
– strt: INTEGER - Start angle.
– angle: INTEGER - end angle (arc extent)
– callback : STRING[31].
pr-0-0-vp2_04.fm
00/1014 75
Functionality and usage of VP2 objects
4.4.14.4 Rect
Datatype: vp2rect
The Rect VP2 Component is a graphical representation of a rectangle.
Usage
This Component is defined by its co-ordinates (x, y) and (w, h).
A Rect has got the following properties:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– f_color : foreground color (for further information see f_color, b_color: INTEGER,
>0)
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Focusable : BOOLEAN - it indicates whether this object can obtain focus or not.
– line: INTEGER - Line thickness. Default: 1 pixel
– orient: REAL - Orientation angle. Default: none
– callback : STRING[31].
4.4.14.5 Roundrect
Datatype: vp2roundrect
The Roundrect VP2 Component is a graphical representation of a rectangle with
rounded corners.
Usage
As with the Rect, this Component is defined by its (x, y) and (w, h) coordinates, as well
as the arc_h and arc_w that define the corner circumference.
A Roundrect has got the following properties:
– X, Y: INTEGER, >=0
pr-0-0-vp2_04.fm
76 00/1014
Functionality and usage of VP2 objects
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– f_color : foreground color (for further information see f_color, b_color: INTEGER,
>0)
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Focusable : BOOLEAN - it indicates whether this object can obtain focus or not.
– arc_w: INTEGER - Arc width.
– arc_h: INTEGER - Arc height.
– line: INTEGER - Line thickness. Default: 1 pixel
– callback : STRING[31].
4.4.14.6 Polyline
Datatype: vp2polyline
Polyline is a graphical empty VP2 Component of up to 16 points connected with lines.
Usage
The points co-ordinates are defined by the user in an array of points. Each point is
defined by (x, y) INTEGER co-ordinates. The points coordinates refer to the X and Y of
the rectangle including the Polyline itself (by default (0,0) is its leftmost top corner).
For example a 4 equally sided diamond can be drawn as follows:
VAR
ve_polyline : vp2_polyline
….
BEGIN
….
ve_polyline.x := 200
ve_polyline.y := 200
ve_polyline.w := 60
ve_polyline.h := 60
ve_polyline.f_color := WIN_MAGENTA
pr-0-0-vp2_04.fm
00/1014 77
Functionality and usage of VP2 objects
ve_polyline.points[1, 1] := 30
ve_polyline.points[1, 2] := 0
ve_polyline.points[2, 1] := 0
ve_polyline.points[2, 2] := 30
ve_polyline.points[3, 1] := 30
ve_polyline.points[3, 2] := 60
ve_polyline.points[4, 1] := 60
ve_polyline.points[4, 2] := 30
ve_polyline.points[5, 1] := ve_polyline.points[1, 1]
ve_polyline.points[5, 2] := ve_polyline.points[1, 2]
The Polyline is then drawn in the reference frame defined by X and Y. The O point is the
origin of such reference system. The actual Polyline appears on the VP2 Screen as
shown above.
The additional properties for Polyline are:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– f_color : foreground color (for further information see f_color, b_color: INTEGER,
>0)
– attr_form: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Focusable : BOOLEAN - it indicates whether this object can obtain focus or not.
– points: INTEGER [16,2] - Matrix of polyline points
– callback : STRING[31].
pr-0-0-vp2_04.fm
78 00/1014
Functionality and usage of VP2 objects
4.4.14.7 Oval
Datatype: vp2oval
The Oval is the VP2 representation of an elliptical shape, which can be an ellipse or a
circle.
Usage
As with other VP2 Components, the Oval is specified by x and y i.e. the top left vertex
of the logical rectangle inscribing the shape, as well as w and h, i.e. the width and the
heigth of such a rectangle. The ellipse can have a border of a certain colour and
specified thickness.
The Oval has got the following properties:
– X, Y: INTEGER, >=0
– Z: INTEGER, >=0
– W, H: INTEGER
– Name: STRING[15]
– Id: INTEGER, >0
– attr_form: INTEGER, >0
– f_color, b_color: INTEGER, >0
– Visible : BOOLEAN
– Enabled : BOOLEAN
– Ev_code: INTEGER
– Ev_mask: INTEGER
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER
– bm_id : INTEGER
– Focusable : BOOLEAN - it indicates whether this object can obtain focus or not.
– line: INTEGER - Line thickness. Default: 1 pixel
– callback : STRING[31].
A few examples for Ovals:
pr-0-0-vp2_04.fm
00/1014 79
Functionality and usage of VP2 objects
f_color := WIN_GREEN
f_color := WIN_BLUE
b_color := WIN_WHITE
attr_form := vp2_fill
f_color := WIN_BLUE
attr_form := vp2_fill
4.4.14.8 Polygon
Datatype: vp2polygon
Usage
The points coordinates are defined by the user in an array of points. Each point is defined by (x,
y) INTEGER co-ordinates. The points are referred to the X and Y of the rectangle including of the
Polygon itself (by default (0,0) is its leftmost top corner).
pr-0-0-vp2_04.fm
80 00/1014
Functionality and usage of VP2 objects
The customized data type must always be defined AFTER the program statement
including the VP2 library.
Example
Defining a new data type, called vp2label_mylabel, as a customized version of vp2label
predefined data type.
pr-0-0-vp2_04.fm
00/1014 81
Events
5. EVENTS
Events are sent to PDL2 in the following ways:
– message towards the LUN of the PIPE created by the PDL2 program which is
intended to monitor such events (for further information refer to PDL2
Programming Language manual, chap.9 - Communication - par. 9.1.3 - PIPE
Devices)
– event generation.
Reading the PIPE allows understanding the events chronological sequence, as well as
gathering full information. More information, messages in chronological order,
messages are not lost.
– Events handling
– Events associated to VP2 objects
– User defined events.
pr-0-0-vp2_06.fm
82 00/1014
Events
Please refer to par. 12.3 Events on page 173 for a complete list of VP2 objects
predefined events.
– PIPE reading
– Callback on the VP2 object (Builder Model).
BEGIN
vi_pipe := vp2_pipe_create('mypipe') -- pipe creation
vp2_pipe_flush(vi_pipe) -- pipe initialization
CYCLE
REPEAT
READ vi_pipe (vi_id, vi_event, vs_data) -- reading pipe
UNTIL $FL_STS = 0
SELECT (vi_id) OF
CASE (mycheckbox.id):
IF (vi_code = vp2_on_pressed) THEN
……….
ENDIF
CASE (mylabel.id):
……
pr-0-0-vp2_06.fm
00/1014 83
Events
ENDSELECT
END vp_skel
The reception channel (the PIPE) is defined in the Screen Component (lun_name field).
Example:
ve_screen.lun_name := 'pipe:prog_pipe'
All events occurring onto a Screen objects, are sent to such a LUN.
Reading the LUN, in case of programming with ReadPipe model, means reading the
PIPE:
where:
– vi_id - is the identifier (id field) of the element on which the event is to be triggered
– vi_event - is the being triggered event (see par. 12.3.1 Events applicability to VP2
objects on page 174). Is must have been assigned to the ev_mask field of a
Component.
– vs_data - is a STRING containing a variable data depending on the VP2 object on
which the event occurs.
Some examples follow of a being monitored event for a specified VP2 object:
ve_menu1.ev_mask := vp2_on_pressed
ve_pane.callback := ‘ru_pane’
ve_pane.ev_mask := vp2_on_error or vp2_on_visible or vp2_on_hidden
pr-0-0-vp2_06.fm
84 00/1014
Events
where
ve_button1.ev_code := 50009
Upon Button pressed, if in some ways the program is listening to the event to occur,
pr-0-0-vp2_06.fm
00/1014 85
Events
pr-0-0-vp2_06.fm
86 00/1014
Predefined Routines for VP2 Programs use
System routines
VP2_SCRN_CREATE Function Create a VP2 Screen
VP2_SCRN_ADD Procedure Add a Screen to a physical device
VP2_SCRN_DEL Procedure Delete the Screen from memory
VP2_SCRN_AVAIL Procedure Make the Screen available for different devices from a setup
page
VP2_SCRN_PDV_GET Function Return the physical Device (PDV) on which the Screen is
currently displayed
VP2_SCRN_REMOVE Procedure Remove the Screen from the device
VP2_SCRN_SET Procedure Set the physical device display to a specific Screen
VP2_SCRN_STATE Predefined Function Return information about the state of a Screen
VP2_SCRN_INFO Function Return information
VP2_SEL_SET Procedure Set either focus or direct choice (chooser) for the specified
Component
VP2_ADD Procedure Add a VP2 object onto another one
VP2_REMOVE Procedure Remove a VP2 object from on top of another one
VP2_UPDATE Procedure Update the record (thus the displayed page) of one or more
VP2 object(s)
VP2_LOAD Predefined Procedure Allow quickly loading a VP2 page
VP2_SAVE Predefined Procedure Allow saving VP2 displaying information into a binary file
VP2_INFO Predefined Function Return a boolean value meaning the specified VP2 object has
been found
pr-0-0-vp2_05.fm
07/0113 87
Predefined Routines for VP2 Programs use
pr-0-0-vp2_05.fm
88 07/0113
Predefined Routines for VP2 Programs use
Comments: This predefined routine creates a Screen upon which VP2 objects can be added. The
Screen cannot be displayed until either VP2_SCRN_ADD Procedure or
VP2_SCRN_AVAIL Procedure are executed. The goal is to get the new Screen identifier
(INTEGER) back. Any Screen created by a program belongs to the context of the
currently executing program. When the program either is deactivated or terminates, then
the Screen is automatically removed. Only the Screen owning program can perform
certain operations, such as adding VP2 objects.
The Screen name MUST BE UNIQUE (name field of vp2screen). To do this, the easiest
way is assigning $PROG_NAME to such a field.
Examples: VAR my_screen:vp2_screen
......
scrn_id := VP2_SCRN_CREATE(ve_my_page)
pr-0-0-vp2_05.fm
07/0113 89
Predefined Routines for VP2 Programs use
Comments: This predefined routine deletes the Screen from the physical device which displayes it
(e.g. Teach Pendant)
Examples: VP2_SCRN_DEL (scrn_id)
pr-0-0-vp2_05.fm
90 07/0113
Predefined Routines for VP2 Programs use
pr-0-0-vp2_05.fm
07/0113 91
Predefined Routines for VP2 Programs use
This predefined routine returns the specified Screen current state, e.g. whether or not it is
currently displayed and, if so, which device is displayed onto. The returned value can be
as follows:
– 1 - valid Screen ID
– 2 - the Screen is available
– 4 - the Screen has been added
– 8 - the Screen is currently open by a client.
pr-0-0-vp2_05.fm
92 07/0113
Predefined Routines for VP2 Programs use
pr-0-0-vp2_05.fm
07/0113 93
Predefined Routines for VP2 Programs use
Comments: This predefined routine removes an object from its Container. Several objects can be
specified, separated by comma.
pr-0-0-vp2_05.fm
94 07/0113
Predefined Routines for VP2 Programs use
• vp2_update_later
mark the specified VP2 object for future updating
From Controller to TP/VP2.Frames
• vp2_update_all
Da Controllore a TP/VP2.Frames
update all objects belonging to the specified object (including itself).
From Controller to TP/VP2.Frames
• vp2_update_backwards
update backwards, i.e. recover the new value of such an object.
From TP/VP2.Frames to Controller.
General vp2_update operations, update VP2 objects displaying the
PDL2 variable value onto the VP2 object viewed onto the TP /
VP2.Frames.
This flag, passed to the VP2_UPDATE predefined routine, tells the
system to copy the value, currently just loaded in the VP2 object and
displayed onto the TP/VP2.Frames, into the PDL2 variable.
• vp2_update_clrerror
clear the error mark on the VP2.Frames
When an error occurs, a yellow triangle is displayed in the status bar of
VP2.Frames. Using vp2_update_clrerror allows removing such a
yellow triangle.
• vp2_update_advance
causes the program interpretation to go on even if the VP2 objects are
not yet updated onto the viewing device. The execution level and the
total amount of pending VP2_UPDATE calls, are contained,
respectively, in $THRD_INFO[1] and $THRD_INFO[2] predefined
variables.
WARNING - When the VP2 objects are many, the update operation is very
heavy, in terms of CPU time, slowing down the interface reactivity. It is then
needed to carefully select the VP2 objects which really need to be updated in
viewing, and mark them all with
VP2_UPDATE(<object_name>, vp2_update_later)
pr-0-0-vp2_05.fm
07/0113 95
Predefined Routines for VP2 Programs use
Comments: Allows to load a binary .VPS file, which includes the VP2 objects definition
related to a specified page, as well as their initializations (if implemented by the
user).
file_name is the name of the .VPS file for loading the needed information
executing_program it’s the name of the currently executing program, to be
associated to such a .VPS file. If not specified, the calling program to such a
predefined routine, will be called
root is the (optional) object for loading the hierarchy of the VP2 object saved in
the file_name file.
When not specified, all objects will be loaded.
The use of .VPS file is suggested because it gathers all the
VP2 objects definition, initialization, as well as the
Components and Containers hierarchy definition. This allows
to lighten the PDL2 program body which is to be dedicated to
process handling better than to data handling.
See also: VP2_SAVE Predefined Procedure
pr-0-0-vp2_05.fm
96 07/0113
Predefined Routines for VP2 Programs use
Parameters: none
Comments: This routine belongs to VP2_LIB library and allows the whole VP2 environment
initialization (buttons, keys, events, attr_form, attr_func, etc).
It MUST ALWAYS be present at any VP2 program beginning.
pr-0-0-vp2_05.fm
07/0113 97
Predefined Routines for VP2 Programs use
Comments: Given an event (ai_event), this routine returns a STRING value which describes
it. It could be useful to be printed during the program/application
development/debug operations.
pr-0-0-vp2_05.fm
98 07/0113
Predefined Routines for VP2 Programs use
Parameters: none
Comments: This routine handles the events, it is responsible of reading them from the pipe
and calling the associated callback routine for the VP2 object wich signalled the
event.
It returns:
– 0 if OK
– 1 if non-severe error
– -1 if severe error.
Warning - This routine is just available to programs which were created by means of either the
Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
pr-0-0-vp2_05.fm
07/0113 99
Predefined Routines for VP2 Programs use
Comments: This routine specifies the callback routine name to be called upon a VP2 user
event occurring.
– as_routine - name of the callback routine to be called
– as_progname - name of the program (optional).
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
pr-0-0-vp2_05.fm
100 07/0113
Predefined Routines for VP2 Programs use
Comments: This routine is used to propagate events. It is useful to pass them to the parent
VP2 object. This means that whenever the VP2 object signals an event, the
parent callback is called too.
For instance, if a Button is placed onto a Pane, and the current predefined
routine is called, as soon as the Button generates an event, the Pane callback is
called too.
This routine must be called whenever the event should be propagated, since the
propagation indicator is always cleared before calling
– as_progname - program name.
Warning - This routine is just available to programs which were created by means of either
the Builder model or the VP2.Builder (see par. 10. VP2.Builder (optional feature) on page 150).
pr-0-0-vp2_05.fm
07/0113 101
VP2 Tables
7. VP2 TABLES
7.1 Introduction
This functionality allows VP2 users to create pages similar to the Teach Pendant DATA
Page ones:
Using a VP2 Table means adding it to a VP2 page, and adding columns, in the form of
Coldef variables (vp2coldef), and rows in the form of Record variables (with the wished
structure).
More details about how to use the VP2 Table object are given in the following sections:
– VP2 Tables Fields
– Basic VP2 Table Examples
– VP2 Table “boundaries”
– Transposing a VP2 Table
– Adding and Removing Rows and Columns
– Appearance of a VP2 Table
– Cell objects
– Events on a VP2 Table
– Example - ENTER key on VP2 Table rows (via callback)
– Sorting by Columns
– Data Handling in VP2 Tables
– Appendix.
pr-0-0-vp2_12.fm
102 00/1014
VP2 Tables
pr-0-0-vp2_12.fm
00/1014 103
VP2 Tables
-- Variable Declarations:
VAR ve_screen : vp2screen_min -- VP2 Screen
VAR vi_scrn_id : INTEGER NOSAVE -- Screen id
VAR ve_table1 : vp2table -- VP2 table
VAR ve_col1, ve_col2 : vp2coldef -- Two columns for the table
VAR veMyFirstRow, veMySecondRow : UserRow -- Two rows for the table
BEGIN
pr-0-0-vp2_12.fm
104 00/1014
VP2 Tables
PAUSE
END vp2table_basic
pr-0-0-vp2_12.fm
00/1014 105
VP2 Tables
7.3.1 Description
The only Types declared in the program are
– the Screen itself (in the form of vp2screen_min),
– the columns (vp2coldef),
– the table (vp2table),
– the Row Record (called ‘UserRow’).
In order to add rows to any VP2 Table, it is necessary to declare a RECORD Type, such
as 'UserRow'.
In the Variable Declarations section one instance is declared for both vp2screen_min
and vp2table Types.
Further declarations:
– two vp2coldef variables (ve_col1 and ve_col2) and
– two UserRow Type variables (veMyFirstRow and veMySecondRow),
because a table is required with two columns and two rows.
When the VP2 Table is declared, its width and its height are both set to zero.
This means that the table dimensions are simply the total amount of its rows and
columns.
The actual width of the table is therefore:
– the width of its two columns (100 + 100), plus
– the width of the gridlines that separate the columns and border the table (3).
The actual height of the table is similarly:
– the height of the table header, plus
– the height of the column headers, plus
– the height of the two rows (any of which uses the default row height of 25 pixels
since no row height has been specified for the table either (4 x 25)), plus
– the thickness of the gridlines that separate the rows and border the table (5).
The actual dimensions of this table are therefore 203 x 105. Further information on how
to specify the dimensions of a VP2 Table is given in par. 7.4 VP2 Table “boundaries” on
pr-0-0-vp2_12.fm
106 00/1014
VP2 Tables
page 107.
When each vp2coldef variable is declared, it is given an ordinal that specifies where it
is positioned in the table, with reference to the other columns, counting from left.
In this case, ve_col1 with its ordinal of 1 is located on the left of ve_col2 with its ordinal
of 2. If a column is not given an ordinal, it will just be placed at the current right-most
position in the table, when it is added.
Each column also has its data field set. This specifies which row variables have to be
inserted in the current column, at the time the row is added.
In our example UserRow type is declared, with the following fields:
– fi_int_example1 and
– fr_real_example1.
Then, ve_col1 is associated to fi_int_example1 field and ve_col2 is associated to
fr_real_example field.
When the two rows are declared, the suitable values are set for fi_int_example1 and
fr_real_example1. Once these rows are added to the table, the table knows which
column to put each value in, because the name of the reference field of the row is
contained inside the data field of the two columns.
The remaining program code takes care of
– creating the Screen,
– adding the two columns and the two rows to the table,
– adding the table to the Screen.
For more detailed information about functional attributes (attr_func) and format
attributes (attr_form), as well as VP2 Tables specific events, refer to Cap.12. -
Appendix - Form Attributes, Function Attributes, Events on page 166.
In case of particularly high tables, it is suggested to design the interface so that the table
is divided into more pages, accessible from a menu by means of context keys such as,
for example, Prev and Next. This is to reach a better reactivity of the System for the VP2
user interface.
An example of such an implementation is the IO_MAP program, available in the Teach
Pendant SETUP Page.
pr-0-0-vp2_12.fm
00/1014 107
VP2 Tables
7.4.1 Width
The user can either specify the total width of the table, e.g.
ve_my_table.w := 200
or the width of individual columns, such as, for example
ve_my_col1.w := 60
The consequence of the second solution is that the total amount of the specified
columns widths may not match the declared width of the table.
In order to optimize the space taken by the texts of the column fields, which is not
editable (just viewed) by the user, it is suggested to add a vp2label Component to the
column. Mainly if the displayed text is either monospaced or sel, the field is not enough
to include the content.
As far as the table width, in case in which its declared width and the total amount of the
declared columns widths, do not match, the rule is that the final width will be the biggest
one.
Example
If the declared table width is 200, including 3 columns, each one with a declared width
of 100, the final table width will be 300.
Let’s go in details through the two situations:
– Total Specified Width of Columns is Greater than Table Width
– Table Width Is Greater Than Total Specified Width of Columns
pr-0-0-vp2_12.fm
108 00/1014
VP2 Tables
Note that the table width MUST be set to some value (even if it's just zero). If the table
width is not set, it will cause an error and the table will NOT be displayed.
Example
For example, if a table is specified a total width of 300 pixels, and four columns are
added to it, one of which has a specified width of 78 pixels, and three of which without
a specified width, then the table will be dimensioned with four columns separated by grid
lines 1 pixel wide, and will be bordered by grid lines 1 pixel wide.
This means that the total available width for the columns is 295 (300 - 5) pixels.
The table will honour the width of the only specified width column, which is 78 pixels.
217 (295 - 78) pixels are available for the other three columns. 217 does not divide
exactly into three, so the other three columns widths are set to 73, 72 and 72 pixels
respectively.
The overall table width is 300, exactly as specified by the VP2 programmer (see picture
below).
If no columns have a declared width, the table total width will be equally divided among
all the columns (in the example above, this would be 295/4=73.75 so the columns would
pr-0-0-vp2_12.fm
00/1014 109
VP2 Tables
be 74, 74, 74 and 73 pixels wide respectively). This solution allows the VP2 programmer
to specify the exact table width, with columns of equal width, simply by specifying the
VP2 Table width, and not specifying the widths of each column.
7.4.2 Height
It is NOT possible to have rows of different heights, in the same table. There are two
ways of specifying the table height:
– either set the vp2table.h field to some value greater than zero, in which case this
will be the table height, and the rows will be given an equal division of the available
height, or
– set the vp2table.h field to zero, in which case each row will honour the
vp2table.row_h value and the total height of the table will just be the total height
of its rows plus grid lines.
These two methods of specifying the table height are described in more detail below:
– vp2table.h is set to greater than zero
– vp2table.h is not specified or set to zero
WARNING: note that the total amount of rows includes the column headers and the
table header itself, if these are to be displayed. In the example in Fig. 7.1 we only have
two data rows, but we have four physical rows in total.
Since the table includes grid lines, the total available height to be shared among the
rows, is the height which is specified by vp2table.h field minus the grid lines.
pr-0-0-vp2_12.fm
110 00/1014
VP2 Tables
In order to transpose a table, the user should simply sets the attr_form flag to
vp2_transpose, e.g.:
my_table.attr_form := vp2_transpose
pr-0-0-vp2_12.fm
00/1014 111
VP2 Tables
7.5.1.1 Width
In a transposed table, each cell has the same width. In case of vp2table.w is
– greater than zero
each cell width = (table total width - grid lines) / rows number (including
column header row),
– zero or not defined
each cell width = value specified by table col_w field. If col_w is not defined,
the default is 100.
7.5.1.2 Height
In a transposed table, each column has the same height. If vp2table.h field is:
– greater than zero
each cell height = [(specified table height - grid lines) / columns number] +1
(column for the table header)
– set to zero
each cell height = value of vp2table.row_h field.
If vp2table.row_h value is not defined, the used value is the default one, i.e. 25
pixels.
The VP2.Builder (optional feature) program does not allow adding rows and columns
because rows are records of a user defined TYPE, thus not fixed and determinable to
be selected by the VP2.Builder itself.
Anyway, be careful when using VP2_UPDATE Procedure for tables, not to overload the
CPU. If a VP2 Table is placed onto a Pane and a Screen, and the table rows have been
added to its original creation, use the following routine call
VP2_UPDATE(veData, vp2_update_all)
instead of
VP2_UPDATE(ve_table1, vp2_update_all)
pr-0-0-vp2_12.fm
112 00/1014
VP2 Tables
--
-- VP2 example for Table.
--
PROGRAM Table2 NOHOLD
IMPORT 'vp2_lib'
-- Variables declaration:
VAR ve_screen : vp2screen -- VP2 Screen
VAR vi_scrn_id : INTEGER NOSAVE -- Screen ID
VAR ve_table1 : vp2table -- Sample Table
VAR ve_cols : ARRAY[15] OF vp2coldef -- Sample Table Columns
VAR veData : ARRAY[NUM_LINES] OF UserRow -- Table data
VAR ve_pane : vp2pane
VAR i : INTEGER
VAR vtIndex : STRING[3]
BEGIN
-- Screen initialization:
ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := -1
ve_screen.h := -1
ve_screen.name := 'VP2Table'
ve_screen.ordinal := 1
-- Pane initialization
ve_pane.x := 0
ve_pane.y := 0
ve_pane.w := -1
ve_pane.h := -1
ve_pane.attr_func := vp2_scrlhor OR vp2_scrlver
-- Table initialization:
ve_table1.x := 0 -- X coordinate of the table top left corner
pr-0-0-vp2_12.fm
00/1014 113
VP2 Tables
-- Create Screen:
vi_scrn_id := VP2_SCRN_CREATE(ve_screen)
-- Initialize columns
FOR i := 1 TO 15 DO
ENCODE (vtIndex, i)
STR_EDIT(vtIndex, STR_TRIM)
ve_cols[i].w := 100
ve_cols[i].name := STR_CAT('Col ', vtIndex)
ve_cols[i].ordinal := i
ve_cols[i].data := STR_CAT('field', vtIndex)
ENDFOR
-- Last wider column
ve_cols[1].w := 20
VP2_ADD(ve_table1, veData)
-- Update Screen
VP2_UPDATE(ve_screen, vp2_update_all)
PAUSE
END Table2
pr-0-0-vp2_12.fm
114 00/1014
VP2 Tables
Note, however, that the Using fonts with VP2 Table is still used to determine how much
space to put between the cells.
Example
If one of the fields of an added row is a STRING, then f_name, f_style and f_size flags,
selected for the Table, will also apply to the Textbox representing such a string, when
the Table is displayed.
pr-0-0-vp2_12.fm
00/1014 115
VP2 Tables
In the following sections, ‘cell-object’ refers to a VP2 object which is a VP2 Table cell.
These objects are essentially the same as VP2 objects of the same type not added to
tables (i.e. a Spindial on a table, works the same way as a Spindial not on a table).
Anyway, there are different ways of updating them (owing to a lack of the corresponding
record on the Controller) and in the “flat” viewing (i.e. when the focus is not onto them).
This is just to give a more uniform appearance to all of the table cells.
In case of multiple fields Data Type (such as VECTOR, POSITION, JNTPOS,
XTNDPOS and ARRAY), the field associated to the Coldef is displayed with a column
numer equal to the data type fields. Example - in case of VECTOR, there will be 3
columns; in case of Jointpos there will be 6 columns.
When a cell-object is focused, it is painted in the normal way.
Example
In VP2 Tables, the default object to represent an INTEGER value, is the Spindial, as
shown in the following figure.
pr-0-0-vp2_12.fm
116 00/1014
VP2 Tables
VP2_ADD(ve_myTable, we_Table_Row)
where
VAR we_table_row : ARRAY[10] OF ye_type_row NOSAVE
Superimposing an object (template) onto another one, is allowed for simple type objects
(INTEGER, REAL, BOOLEAN, STRING).
It DOES NOT work for complex data types (ARRAY, VECTOR, POSITION, etc…).
The following table shows how objects data are represented, depending on the data
type of the template.
The Combobox value is compared to the value of the row field. If an equal value is found,
ComboBox
then the Combobox is set to such a value.
CheckBox - - Value on object -
pr-0-0-vp2_12.fm
00/1014 117
VP2 Tables
When the user presses ENTER key to confirm value “23”, the following information
is sent along the pipe:
<row_variable[]><event_in_ASCII_form><pressed_key_ASCII_code>
Example
The following variables are defined:
ve_table: is the Table
ru_table: is the associated callback to ve_table Table
we_table_row: are the Table rows
ye_type_row :is the RECORD defining the Table fields.
A sample program section is supplied which detects the ENTER key pressure onto a
table.
pr-0-0-vp2_12.fm
118 00/1014
VP2 Tables
fi_number : INTEGER
fs_field1 : STRING[20]
fs_field2 : STRING[10]
ENDRECORD
VAR ve_table : vp2table NOSAVE
VAR we_table_row : ARRAY[10] OF ye_type_row NOSAVE
ROUTINE ru_table (ai_id, ai_event : INTEGER; as_data : STRING) EXPORTED FROM
my_program GLOBAL
ROUTINE ru_table(ai_id, ai_event : INTEGER; as_data : STRING)
VAR vi_start, vi_end, vi_row , vi_key: INTEGER
vs_row : STRING[2]
vs_key: STRING[2]
BEGIN
....
-- as_data, in tis case, contains: we_table_row[row_num]. 262144 10 0
-- where 262144 (0x40000) is vp2_on_key_pressed and 10 is the ASCII code of LF
vi_start := STR_LOC(as_data,KS_ENTER_KEY_PRESSED)
IF (vi_start <> 0) THEN -- check whether ENTER key has been pressed
STR_XTRT(as_data,vi_start+7,vi_start+9, vs_key) –- read next string
STR_EDIT(vs_key, STR_TRIM)
DECODE (vs_key, vi_key)
IF (vi_key = 10) THEN -- LF ASCII code which means ENTER 0xA->10
vp2_vb_rsue(KI_EVENT_ON_ENTER) -- finally, an event is issued
ENDIF
ENDIF
pr-0-0-vp2_12.fm
00/1014 119
VP2 Tables
vp2_update_later.
To update the Table as a whole object, call VP2_UPDATE Procedure for the Table,
passing vp2_update_all flag.
To gradually select single rows, to be later updated, mark them with vp2_update_later
flag (passed to VP2_UPDATE Procedure as a parameter), and then update the whole
table at the end of the modification operations, by passing vp2_update_later flag.
Examples for updating a Table:
Updating ALL the Table rows in the corresponding PDL2 variable loaded into the
program memory
VP2_UPDATE (<vp2_table>,vp2_update_backwards OR vp2_update_all)
Updating the previously selected (by means of vp2_update_later flag) Table rows,
in the corresponding PDL2 variable elements, loaded into the program memory.
VP2_UPDATE (<vp2_table>,vp2_update_backwards OR vp2_update_sweep)
Updating backwards all the previously modified Table rows.
VP2_UPDATE(<vp2_table>,vp2_update_backwards OR vp2_update_modified OR
vp2_update_all)
Updating backwards all the previously selected Table rows, just if modified.
VP2_UPDATE (<vp2_table>,vp2_update_backwards OR vp2_update_modified OR
vp2_update_sweep)
7.13 Appendix
In current section some VP2 Table examples are shown. The programs which create
them, indicated by the figure, are provided together with the System Software CD.
pr-0-0-vp2_12.fm
120 00/1014
VP2 Tables
pr-0-0-vp2_12.fm
00/1014 121
VP2 Tables
pr-0-0-vp2_12.fm
122 00/1014
VP2 Trees
8. VP2 TREES
8.1 Introduction
The VP2.Tree is a VP2 Container that allows data to be displayed in a hierarchical
manner. The tree object only displays the hierarchy which connects the objects
eachother, it DOES NOT display their contents.
A VP2 Tree displays lines to indicate the relationships among the different objects in the
tree hierarchy and buttons to allow the individual nodes to be opened or closed.
A VP2 Tree hierarchy is built by adding TreeNodes (by calling VP2_ADD Procedure) to
the other ones. When nodes are added to the tree structure, they must have already
been created (otherwise they are not displayed) and could contain Button, Textbox,
Checkbox, Spindial, Combobox and Label.
The status of an individual node can be
– open (+ symbol); nodes below it in the hierarchy are visible
– close (- symbol); nodes below it in the hierarchy are hidden.
Except the starting node (root - i.e. node with no parents), the X position of an individual
node, on the screen, is determined by its hierarchical level; è determinata dal suo livello
gerarchico; the Y position is determined by the total amount of open nodes above it.
– TreeNode
– Example of VP2.Tree creation
– Positioning a TreeNode onto its Container
– Adding new nodes after initial add
– TreeNode updating.
pr-0-0-vp2_13.fm
00/1014 123
VP2 Trees
8.2 TreeNode
Datatype: vp2treenode
Usage
The tree is implemented as just one component, a VP2 Container called TreeNode,
which can be added other TreeNodes to.
The TreeNodes properties are as follows:
– X, Y: INTEGER, >=0 - X and Y describe the position on the screen. Such data are
only meaningful for the starting node (root), because the other nodes coordinates
are determined by their position within the tree.
If the PDL2 programmer specifies an X or Y coordinate for a NOT starting node, such
an information is just ignored.
Such data are only meaningful for the starting node (root). Ther remaining nodes must
be initialized to 0, otherwise they will not be properly displayed.
pr-0-0-vp2_13.fm
124 00/1014
VP2 Trees
.......................
-- Declarations
VAR ve_screen : VP2Screen
VAR ve_root, ve_level_1_child_1, ve_level_1_child_2 : VP2TreeNode
ve_level_2_child_1, ve_level_2_child_2, ve_level_2_child_3 : VP2TreeNode
VAR ve_lbl_root, ve_lbl_level_1_child_1 : VP2Label
ve_lbl_level_1_child_2 : VP2Label
pr-0-0-vp2_13.fm
00/1014 125
VP2 Trees
Example
Let’s suppose to have:
– ve_parent_node
already present node in the tree structure,
– ve_child_node
being added node to ve_parent_node,
– ve_label1
being added label to ve_child_node.
To add the new node, the following statements must be inserted into the PDL2 program:
VP2_ADD(ve_parent_node, ve_child_node)
VP2_UPDATE(ve_child_node)
VP2_ADD(ve_child_node, ve_label1)
VP2_UPDATE(ve_label1)
Warning!
Always remember that, after the node has been added to an existing one, it is NEEDED
to update (VP2_UPDATE Procedure) both the newly added node and the object to be
displayed on it (i.e. the ‘not-node’ child).
If no VP2 objects are added to a tree node, (VP2_ADD Procedure), such a node will not
be displayed.
If the “empty” node (i.e. not including any VP2 object) is the only child of its parent node,
pressing the open/close button will not produce any effect.
pr-0-0-vp2_13.fm
126 00/1014
VP2.Frames (optional feature)
9.1 Introduction
VP2.Frames is an application program to be executed on a PC allowing, when
connected to a C5G Controller, to display VP2 pages as they are displayed on the Teach
Pendant.
VP2.Frames can be activated either from the Start menu on the PC, or the icon on the
Desktop or by means of the command line.
In this case, the user can add option -f in the command line, after "vp2frames.jar"
string, to specify the search path for the being loaded .VPC file; for example:
pr-0-0-vp2_11.fm
08/0713 127
VP2.Frames (optional feature)
There are two main Configuration Pages (as shown in Fig. 9.2):
– Session Page - it is used to setup some configuration values for the session, in
order to be able to be connected to a Controller
– Screen Page - it is used to add one or more Screens to the session and configure
them.
Fig. 9.2 -
IP address of Controller
VP2 can be connected just to ONE Controller for each Session and such Controller
address is specified in this field.
Username e Password
They are the Username and Password used to log in to the Controller.
Session name
It is the name which uniquely identifies the connection session with the Controller.
Flags setting
– Automatically save VPC file - when selected, each modification in the
Configuration Page, will be saved in the .VPC file, upon pressing either OK or
Apply button. When not selected, all modifications will only be saved in the .VPC
pr-0-0-vp2_11.fm
128 08/0713
VP2.Frames (optional feature)
Note that, trying to move a frame when the current flag is disabled, it will immediately
move back to its initial position and the following message will be displayed:
– Enable logging - when selected, viewing the log messages is enabled. For further
information, refer to par. 9.4.2.4 View on page 143 and par. 9.4.2.3.2 Logging
Options on page 143
– Password protected - it is used to protect the session against any unauthorized
modifications, asking for a password to enter the Configuration Pages for
modifications.
pr-0-0-vp2_11.fm
08/0713 129
VP2.Frames (optional feature)
The New key adds a temporarily empty Screen; to assign it to the session, either press
Apply key, while the Screen is displayed, or OK key.
Similarly, Delete key will temporarily delete the Screen, but the modification will be
operational just when pressing Apply key, while the Screen is displayed, or OK key.
After pressing Delete key, the Screen will be marked as temporarily cancelled, as shown
in the following figure:
When a Screen is displayed, the user is allowed to modify the following data:
– Program path - it is the search path for the .COD file of the corresponding VP2
program on the Controller. The full path must be specified, using the backslash (\)
character as a separator one.
pr-0-0-vp2_11.fm
130 08/0713
VP2.Frames (optional feature)
Controller itself and will display the Screen onto the target device without the
need of any selection by the user (provided that the corresponding VP2
program execute VP2_SCRN_ADD Procedure)
• Allow resize - when selected, the frame displaying th Screen, can be
modified in dimensions by clicking on the frame border and moving it until the
wished dimension.
When all settings are completed, either press OK to confirm or Cancel to delete all.
All the available Screens for the current session, listed under the Screen menu
(see par. 9.4.2.2 Screens on page 142), could come from two different sources:
– Added Screens to the current session, by means of the Configuration Pages.
– Made available Screens, activated onto the Controller and made available to the
target device.
With NO Screens (neither made available nor added), e.g. when there is no connection
to the Controller, the Screen menu is disabled.
In the list, the added Screens are separated from the made available Screens, by means
of a horizontal line; the added Screens are listed above the line, whereas the made
available ones are listed below the line, as shown in the following figure:
In the shown above example, there are 4 added Screens (vp_shoe_frames, vp_paint1,
vp_all3 and vp_min), listed above the line, followed by just one made available Screen
(vp_all5), listed below the line.
This means that in current Session Configuration Page, there are 4 defined Screens, i.e.
the added ones.
Beside each listed Screen in the Menu, a coloured icon is displayed representing the
Screen current status.
pr-0-0-vp2_11.fm
08/0713 131
VP2.Frames (optional feature)
Red
This means the corresponding VP2 program is not active, so VP2_SCRN_ADD
Procedure has not been executed yet (e.g. if it is not running) for the associated Screen
which thus is not locally displayed.
Selecting a RED Screen, causes a request to be sent to the Controller to activate the
corresponding VP2 program. If such a request is successful, the Screen is locally
displayed and its status becomes Green.
The made available Screens should NEVER be in the RED status.
Orange
Both for added and made available Screens, ORANGE means that the corresponding
VP2 program is active on the Controller and either VP2_SCRN_ADD Procedure or
VP2_SCRN_AVAIL Procedure has already been executed to make the Screen
available onto the physical device, but such a Screen is not locally displayed yet.
Selecting an ORANGE Screen causes it to be displayed and its status to become Green.
Green
Both for added and made available Screens, ORANGE means that the corresponding
VP2 program is active on the Controller and the Screen is currently locally displayed.
Selecting a GREEN Screen causes its viewing to be interrupted and its status to become
Orange.
When a Screen is viewed in the operating system standard frame (Windows, see figure),
in the top rightmost corner of the frame there are the standard buttons for minimizing,
maximizing, closing the frame.
The close button ("X") has the same meaning of selecting a GREEN Screen in the
Screen Menu: closes the frame and the Screen is no longer displayed, which causes its
status to switch to Orange.
pr-0-0-vp2_11.fm
132 08/0713
VP2.Frames (optional feature)
On the contrary, the other two keys, for maximizing and minimizing the Screen, do not
affect the Screen status, except some special handling by the VP2 program.
Note that when the Screen status changes, included the situation in which it is displayed
or closed, maximized or minimized, the corresponding VP2 program is “warned” by
means of some events such as either vp2_on_open, vp2_on_close on the Teach
Pendant or vp2_on_win_close on VP2.Frames.
So, the programmer can decide to react to such events, e.g. by deactivating the program
as soon as the frame is closed by the VP2 program.
If the VP2.Frame displaying the Screen is closed, the program is NOT automatically
deactivated but, on the contrary, an event is sent (vp2_on_win_close) that the
programmer can suitably handle.
Basically, if a VP2 program must be able to interface the VP2.Frames, first of all it has
to create a Screen, make it available onto a physical device, add wished functionalities
and VP2 objects.
ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := 600
ve_screen.h := 440
ve_screen.name := 'vp2_frames_min'
Since X and Y coordinates have been set to (0, 0), the VP2.Frame will be displayed in
the top leftmost corner of such device screen.
The width (W) and height (H) fields are used to to specify the VP2.Frame dimensions
pr-0-0-vp2_11.fm
08/0713 133
VP2.Frames (optional feature)
vi_scrn_id := VP2_SCRN_CREATE(ve_screen)
The main idea about a made available Screen (VP2_SCRN_AVAIL Procedure) is that
the VP2 programmer does not know in advance the VP2.Frame on which the Screen
will be viewed, so it is then made available. The user will be able, in the future, to select
it from the Screen Menu of his VP2.Frame.
On the contrary, when a Screen is added (VP2_SCRN_ADD Procedure), the VP2
programmer exactly knows on which VP2.Frame the Screen will be viewed, because
such a physical device ID will be required to be specified as a parameter. This can be
either known or obtained by calling VP2_SCRN_PDV_GET Function.
If the physical device is the Teach Pendant, its identifier is PDV_TP.
On the contrary, if the Screen is to be displayed onto the VP2.Frames, its ID is created
depending on both the Controller IP address (IP address of Controller), which can be
obtained by calling VP2_SCRN_PDV_GET Function, and the $PROG_ARG value, if
passed when at the program activation.
Let’s consider the case of a VP2.Frames session connected to the Controller on which
vp2_frames_min.cod file is present.
In the VP2.Frames session, vp2_frames_min has been added as a Screen.
pr-0-0-vp2_11.fm
134 08/0713
VP2.Frames (optional feature)
This means that the session has a defined Screen for which it is expected that the
corresponding .cod file is existing in the Controller UD:\vp2 folder.
Note that the Screen name in the Screen Page (see figure above) must be the same
“.name” field in the VP2 program.
On the Controller, vp2_frames_min.cod program is not running, so the Screen has not
been either added or made available yet, so it is Red in the Screen list:
Selecting the Screen in the list, will cause a request to be sent to the Controller for a
‘ProgramGo vp2_frames_min’ command, including the physical device current ID, on
which VP2 is running, as a parameter of our vp2_frames_min sample program; such a
parameter is decoded as vi_pdv, INTEGER type variable:
vi_pdv variable now includes the VP2 physical device ID and it is now used to add the
Screen to the current session:
VP2_SCRN_ADD(vi_pdv, vi_scrn_id)
pr-0-0-vp2_11.fm
08/0713 135
VP2.Frames (optional feature)
pr-0-0-vp2_11.fm
136 08/0713
VP2.Frames (optional feature)
ve_vp_all.x := 0
ve_vp_all.y := 0
ve_vp_all.w := -1
ve_vp_all.h := -1
ve_vp_all.host_x := 100
ve_vp_all.host_y := 100
ve_vp_all.host_w := 400
ve_vp_all.host_h := 300
Vp2.Frame is displayed with (400,300) dimensions, for host_w and host_h. Note that the
Screen in the VP2.Frame is not dimensioned by the ‘host’ values, but just cut to the
Vp2.Frame dimensions, so just a part of vp2screen_vf is displayed.
2. With the following Screen initialization:
ve_vp_all.x := 0
ve_vp_all.y := 0
ve_vp_all.w := -1
ve_vp_all.h := -1
ve_vp_all.host_x := 100
ve_vp_all.host_y := 100
ve_vp_all.host_w := 800
ve_vp_all.host_h := 800
pr-0-0-vp2_11.fm
08/0713 137
VP2.Frames (optional feature)
ve_vp_all.x := 50
ve_vp_all.y := 50
ve_vp_all.w := -1
ve_vp_all.h := -1
ve_vp_all.host_x := 200
ve_vp_all.host_y := 200
ve_vp_all.host_w := 800
ve_vp_all.host_h := 800
ve_vp_all.x := 50
ve_vp_all.y := 50
ve_vp_all.w := 600
ve_vp_all.h := 440
ve_vp_all.host_x := 200
ve_vp_all.host_y := 200
ve_vp_all.host_w := 800
ve_vp_all.host_h := 800
the Screen dimensions don’t have effect; it is displayed as shown in the figure above.
pr-0-0-vp2_11.fm
138 08/0713
VP2.Frames (optional feature)
ve_vp_all.x := 0
ve_vp_all.y := 0
ve_vp_all.w := -1
ve_vp_all.h := -1
ve_vp_all.host_x := -1
ve_vp_all.host_y := -1
ve_vp_all.host_w := -1
ve_vp_all.host_h := -1
both the Screen and the Vp2.Frame are properly displayed, and the frame is positioned
as cascading from the top left hand corner of the screen.
6. With the following Screen initialization:
ve_vp_all.x := 0
ve_vp_all.y := 0
ve_vp_all.w := 600
ve_vp_all.h := 440
ve_vp_all.host_x := -1
ve_vp_all.host_y := -1
ve_vp_all.host_w := -1
ve_vp_all.host_h := -1
pr-0-0-vp2_11.fm
08/0713 139
VP2.Frames (optional feature)
9.4.2.1 File
The File menu contains commands for
– creating, saving and opening VPC files (New, Save, Save As, Open),
– connecting and disconnecting to the Controller (Connect, Disconnect),
– exiting the program (Exit).
9.4.2.1.1 New
This command creates a new VP2.Frames Session which is to be configured (see
par. 9.2 Configuring a VP2.Frames session on page 127 ).
An existing session connected to the C5G will be closed upon request of confirmation
by the user.
pr-0-0-vp2_11.fm
140 08/0713
VP2.Frames (optional feature)
9.4.2.1.2 Open
Permette all’utente di aprire un file di tipo .VPC contenente la configurazione di una
sessione di VP2.Frames. Questo viene fatto tramite la seguente videata di dialogo,
nella quale l’utente sceglie il file .VPC desiderato:
The Open command allows the user to open a .VPC file containing the configuration of
an existing VP2.Frames session. This is done via a dialog window in which the user may
choose the wished .VPC file:
9.4.2.1.3 Save
This causes the current session configuration to be saved to disk. If it was loaded from
an already existing .VPC file, then such a file will be overwritten. If not (for example if it
was created by the user with the File>New command), the user will be prompted for a
file name and destination to save the session to.
Note that the Save command is disabled (greyed-out) when there aren’t any changes to
be saved, for the current session.
9.4.2.1.4 Save As
Same as Save command, with the opportunity of specifying the .VPC filename and its
destination.
pr-0-0-vp2_11.fm
08/0713 141
VP2.Frames (optional feature)
9.4.2.1.5 Connect
This command connects the VP2.Frames on the PC, to C5G Controller. Before
connecting, the user should have already specified the Controller IP in the Configuration
Pages (see par. 9.2 Configuring a VP2.Frames session on page 127) and the wished
Controller must be licensed for using the VP2.Frames software option.
See par. 9.5 Troubleshooting on page 145 if unable to connect.
Note that when the current session is already connected, the Connect command is
disabled.
9.4.2.1.6 Disconnect
Disconnects the current session from C5G Controller. Note that this DOES NOT close
the current session, but merely disconnects it from C5G.
Note that when the current session is disconnected, the Disconnect command is
disabled.
9.4.2.1.7 Exit
Closes VP2.Frames and the associated Screens. If there are unsaved changes to the
current session, the user will be given the option of saving them before closing the
application.
9.4.2.2 Screens
The Screens menu contains a list of the available Screens to VP2.Frames, related to
the VP2.Frames current sessions. These are either user added Screens, configured in
the Screen Configuration Pages, or made available Screens on the Controller
(see par. 9.2.2 Screen Page on page 129).
pr-0-0-vp2_11.fm
142 08/0713
VP2.Frames (optional feature)
When there are no available Screens, including when the session is not connected to
the Controller, the Screens menu is disabled.
See also par. 9.3 Selecting the Screen to be displayed onto the VP2.Frame on
page 131.
9.4.2.3 Tools
The Tools menu allows to
– enter the Configuration Pages (Session Configuration)
– use logging options (Logging Options),
– clear the Image Cache (Clear Image Cache).
9.4.2.4 View
Il gruppo View consente di visualizzare i messaggi di Log (come mostrato nella
pr-0-0-vp2_11.fm
08/0713 143
VP2.Frames (optional feature)
seguente figura):
The View menu allows the Log messages to be displayed (as shown in the following
figure):
9.4.2.5 Help
The Help menu contains under the About item, information about the Vp2.Frames
version and license.
9.4.3 Toolbar
The Toolbar contains shortcuts to some of the commands described in par. 9.4.2 Menu
Bar on page 140.
The available buttons are shown in the below picture:
pr-0-0-vp2_11.fm
144 08/0713
VP2.Frames (optional feature)
9.4.3.3 Save
9.5 Troubleshooting
This section describes some common error messages that may be seen when running
VP2 Server and how to deal with them:
– Unable to connect to
– VP2.Frames not licensed
– Connection Lost
– Checksum is incorrect
– Warning Indicator on VP2 Frame
This means that the attempt to connect to the Controller at the specified IP address
failed. Check that:
– the address is correct,
– the network connections between the target (where VP2 Server is running) and the
Controller are ok, and not, for example, blocked by a fire wall,
– the Controller is running.
pr-0-0-vp2_11.fm
08/0713 145
VP2.Frames (optional feature)
This means that VP2 Server tried to connect to the Controller, but that the connection
failed because VP2.Frames is not licensed on the Controller. The software will not be
able to connect until it is licensed.
This means that VP2 Server has lost the connection to the Controller. This could happen
for a variety of reasons, including the Controller shutting down, or the network failing
between the target machine and the Controller. While this dialog is being displayed, VP2
Server will try to reconnect to the Controller automatically. If the attempt to reconnect
does not work within a specified timeout (about 30 seconds), then the dialog will close.
Check that there is a network connection between the target and the Controller, and that
the Controller is still running.
This means that the vpc file is corrupted, and therefore cannot be read. Either use a
different vpc file, or create a new one by saving a session.
pr-0-0-vp2_11.fm
146 08/0713
VP2.Frames (optional feature)
this is used to indicate that there is a VP2 Error within the corresponding VP2 program.
The user should debug the VP2 program on the controller to identify and remedy the
error.
pr-0-0-vp2_11.fm
08/0713 147
VP2.Frames (optional feature)
ENDRECORD
-- vp2button modified version declaration:
TYPE vp2button_ex = RECORD
x : INTEGER -- x position
y : INTEGER -- y position
w : INTEGER -- Width
h : INTEGER -- Height
text : STRING[15] -- text
id : INTEGER -- User ID of this component
ev_mask : INTEGER -- Event mask
ENDRECORD
-- Constants declaration:
CONST ki_button1_id = 1001
-- Variables declaration:
pr-0-0-vp2_11.fm
148 08/0713
VP2.Frames (optional feature)
CYCLE
ELSE:
ENDSELECT
END vp2_frames_ex1
pr-0-0-vp2_11.fm
08/0713 149
VP2.Builder (optional feature)
10.1 Introduction
VP2.Builder is a Rapid Application Development tool which allows the VP2
programmers to create VP2 applications using a graphical interface to place VP2
objects and edit their properties.
In case in which it is wished to activate VP2.Builder on the Teach Pendant, it will be
available on a left menu key.
Buildee
Note that in the following document, the term "buildee" refers to the program being
worked on.
10.2 Installation
To install VP2.Builder it is needed to:
c. extract install.cod program from such a file, which loads and activates vp2b
program. This is a protected program which cannot be disabled by means of a user
command;
d. start, PC side, VP2.Frames program, which must have previously been installed,
after been copied from the system software CD.
f. specify the target device on which the being created graphics will be displayed,
whether on the TP screen or on the Vp2.Frames one (i.e. the PC one).
pr-0-0-vp2_14.fm
150 00/1014
VP2.Builder (optional feature)
g. Furthermore, specify whether the activation of the program which is being created
by means of the VP2.Builder, should be performed by the left menu key or from
within the TP Setup Page.
After the installation, vp2b.zip, vp2b.cod (protected) files are in UD:\inst\ directory.
At the first VP2.Builder deactivation, a file is created called vp2b.var which contains
variables related to some resources used by VP2.Builder:
– vb_ontp : BOOLEAN – if TRUE, VP2.Builder will be activated on the TP; if
FALSE, on the VP2.Frames.
– vi_maxVars : INTEGER - maximum quantity of allowed VP2 objects to be added
to the Buildee.
– vi_maxVarsPerComponent : INTEGER - maximum quantity of allowed
Components to be added to a Container.
– vi_timeout : INTEGER - update time (ms) for the VP2 objects in the Properties
Subpage.
If VP2.Builder is in Edit Mode and the user quickly moves focus onto the Buildee
objects, the properties table does not update each object properties viewing: it
updates them just after the user stops moving focus. This parameter specifies the
time interval during which focus must keep still, for the Properties Subpage to be
updated.
pr-0-0-vp2_14.fm
00/1014 151
VP2.Builder (optional feature)
This page allows the user to either open an already existing VP2.Builder program, or
create a new one.
It is composed of the following elements:
– List of VP2 Programs (1) - it displays the list of all programs currently running on
the Controller, and containing a VP2 Screen. The user can select the wished
program to be edited.
– Refresh (2) - it updates (refresh) the list of running programs containing a VP2
Screen (included in the above mentioned Combobox (1).
– New (3) - it opens a New program page (see par. 10.4 New Program Page on
page 152).
– Open (4) - it opens the currently selected program (in the Combobox (1) ) for
editing. If the Open button is long pressed, a popup menu of recently edited
programs will be displayed (even if they are not currently running). Selecting one
of them, will cause it to be opened for editing if running, or activated then
opened for editing if not running;
– Restart (5) - the currently selected program is deactivated and then restarted;
– Exit (6) - it causes VP2.Builder application to exit.
pr-0-0-vp2_14.fm
152 00/1014
VP2.Builder (optional feature)
– Directory (3) - it is the folder where the program files will be created, i.e. .pdl, .cod
and .vps files.
– Physical Device (4) - it is the physical device on which the program is to be used,
either VP2.Frames or Teach Pendant.
– Location (5) - it specifies the position where the program icon is to be displayed:
either on the Left Menu or Setup Page of the TP. This field is only enabled if the
previously chosen Physical Device (4) is the TP.
– Menu Index (6) - it is the Left Menu index on the TP, to display the program icon
at. This is only enabled if the TP was selected as Physical Device (4) and "Left
Menu" was selected as Location (5).)
– Window Dim(w/h) (7) - it is the frame dimension to display the program in. This
field is only enabled if "VP2.Frames" is selected as Physical Device (4).
– IP Address and Subnet Mask (8) - they are the IP address and the subnet mask
to which the program will be AVAILed. These fields are only displayed if
"VP2.Frames" is selected as Physical Device (4).
After completing the fields, press OK (F5) button: the new program is created and
activated. If it already exists (either as a .cod file, or in memory, or both) the user will be
prompted to overwrite it.
NOTE that the Screen must be manually opened on the selected device.
pr-0-0-vp2_14.fm
00/1014 153
VP2.Builder (optional feature)
This subpage is used to add Components to the Screen. They are selected from
pr-0-0-vp2_14.fm
154 00/1014
VP2.Builder (optional feature)
“Controls” Tabpane (displayed in the subpage upper part) and will be added to the
Screen upon Add (F1) button pressure.
A description follows about the four indicated sections (see Fig. 10.3):
– (1) Component icons and comboboxes - clicking the icons selects the
Component type that will be added upon Add (F1) button pressure. The
Comboboxes allow selecting the Component type version. The latest version is
always pre-selected in the Combobox.
– (2) Component name - it is the variable name when the Component is added to
the Buildee. VP2.Builder suggests a name based on the name of the selected type
and the number of such type Components existing in the Buildee. Anyway this
name can be edited by the user.
– (3) Array controls - these fields allow users to add a Component of ARRAY type.
It is needed to specify whether it is of one (1D) or 2D dimensions, and how many
elements for each specified dimension. The "single callback" field indicates
whether the "callback" field of each element of the array contains the name of the
same callback function or each one has its own callback function (see par. 10.7
Structure of a PDL2 program developed with Vp2.Builder on page 160).
– (4) Container - it allows the user to select which Container the Component is
added to. Only those Containers to which the current selected Component type can
legally be added are displayed (for example, if the current selected type is
Tabsheet, only Tabpanes that have already been added to the Buildee will be
displayed). If no Container is displayed, then the Component cannot be added.
This subpage allows the users to edit the properties of Components added to the
Buildee.
There are two ways to select a component:
– use the Components (1) combobox,
pr-0-0-vp2_14.fm
00/1014 155
VP2.Builder (optional feature)
– if the Buildee is in Edit mode (see par. 10.5 Edit Page on page 154) the Component
in the Buildee can be directly selected by moving focus to it. When a Component
is selected in Edit mode, its properties will be displayed in the Property Table (2),
so they can be edited by the user.
A description follows about the four indicated fields (see Fig. 10.4):
– (1) Components combobox - it contains the Components of the Buildee,
hierarchically listed. Note that it doesn't contain every Component, rather the
currently selected one, that Component's siblings and children in the hierarchy tree
and the "path" up the hierarchy tree to the Screen.
– (2) Property Table - it displays and allows editing of the properties of the currently
selected Component.
– (3) Advanced Properties checkbox - by default, not all properties are shown.
Select all the checkboxes to enable displaying all properties.
– (4) Refresh button - If the user modifies the value of a Component of the Buildee
(e.g. by typing something in a textbox), this button can be used to refresh the table
and display the new value.
pr-0-0-vp2_14.fm
156 00/1014
VP2.Builder (optional feature)
The Events subpage allows the user to edit the Components Ev_mask: INTEGER field
in the Buildee.
This subpage fields are as follows:
– Components combobox (1) - it is used to select the Component for which the
event mask is to be edited
– Events checkboxes (2) - they allow selecting/unselecting events for the currently
selected Component. Note that only the checkboxes corresponding to events
which are valid for the currently selected Component are enabled. The user can
select them to include them in the Component ev_mask, or unselect them to
exclude them from the mask.
– Array controls (3) - if the currently selected Component is an ARRAY, these fields
allow the user to select which element of the array is being edited.
– Event Callback (4) - it allows the user to edit the name of the callback function that
will be used to handle events from the currently selected Component. This is the
same as the Callback Property described in par. 10.5.0.1 Components subpage on
page 154.
pr-0-0-vp2_14.fm
00/1014 157
VP2.Builder (optional feature)
This subpage allows the user to provide information about the being handled program
in VP2.Builder environment.
The existing fields in the subpage, include the following information:
– name of the callback .lst file (Event file - 1) that will be generated in UD:\USR
(see par. 3.5 VP2 library (VP2_LIB) on page 38)
– Write to file (2) key - allows the user to write the callback file
– Contents of the property notes (3) for the current program
pr-0-0-vp2_14.fm
158 00/1014
VP2.Builder (optional feature)
One of the most powerful features of VP2.Builder is the Edit mode. Accessing Edit
mode, by pressing Edit/Run (F3) button (as described in par. 10.5 Edit Page on
page 154), allows direct modification of the Component size and location, using a drag
and drop interface.
The following topics are now described:
– Edit mode program appearance
– Editing Components
– Using the mouse
– Using the keyboard.
pr-0-0-vp2_14.fm
00/1014 159
VP2.Builder (optional feature)
pr-0-0-vp2_14.fm
160 00/1014
VP2.Builder (optional feature)
– include the exact name of the routine, both in the ROUTINE statement and in the
END statement (note that it is case sensitive!).
If the routine declaration does not perfectly comply the listed above rules, the callback
will not be executed. Because of that, it is suggested to copy its definition form the
<Buildee>_Callback.LST file and proceed with implementing the callback routine
code.
pr-0-0-vp2_14.fm
00/1014 161
Troubleshooting
11. TROUBLESHOOTING
Current chapter lists some of the most frequent error messages which could appear
while using VP2, as well as how to handle them.
– The program is running but nothing is displayed on the Screen
– A Component is not displayed, having just X and Y defined
– Impossible to trap events for a specified Component
– Some Components cannot be seen on the Screen
– Error 1244 is detected (uninitialized Variable)
– Error 11298 is detected (Pipe full)
– How to know whether a Screen or a Pane are displayed or not
– DPRO Timeout
– VP2 application page is locked
– Error 40103 is detected (CALL/CALLS failed)
– Paging on a wider table on the TP screen
– Vertical scrollbar not updated on the table.
pr-0-0-vp2_09.fm
162 00/1014
Troubleshooting
WARNING - Setting ev_mask to -1 could cause a messages overload along the VP2
program pipe (possibly causing the program to get a Pipe Full error) so it is suggested
to carefully dimension the wished events monitoring.
pr-0-0-vp2_09.fm
00/1014 163
Troubleshooting
the keys, avoiding to receive messages for both PRESSED and RELEASED (note
that this modification alone would triple the PIPE dimensions).
Example
VAR ve_screen : vp2screen NOSAVE -- Screen Container
VAR ve_pane: vp2pane NOSAVE -- Pane Container
pr-0-0-vp2_09.fm
164 00/1014
Troubleshooting
pr-0-0-vp2_09.fm
00/1014 165
Appendix - Form Attributes, Function Attributes, Events
pr-0-0-vp2_10.fm
166 00/1014
Appendix - Form Attributes, Function Attributes, Events
pr-0-0-vp2_10.fm
00/1014 167
Appendix - Form Attributes, Function Attributes, Events
Message Bar
Checkgroup
VP2 Tables
Combobox
Roundrect
Checkbox
TreeNode
Tabsheet
DataLink
Menubar
Tabpane
Polygon
Spindial
Textbox
Polyline
Description
Screen
Button
Coldef
Image
Label
Menu
Pane
Oval
Rect
Line
Arc
vp2_notcomaulnf v v v v v v v v v v v v
vp2_bstyle1..vp2_bstyle4 v v v v v v v
vp2_b_ok, vp2_b_cancel,
vp2_b_yes, vp2_b_no,
vp2_b_abort, vp2_b_retry,
vp2_b_skip, vp2_b_ack,
vp2_b_ignore,
v
vp2_b_reset, vp2_b_true,
vp2_b_false, vp2_b_on,
vp2_b_off, vp2_b_none
vp2_sev_info,
vp2_sev_warn, v
vp2_sev_err
vp2_show_row_name v
vp2_add_coldefs_as_rows v v
vp2_always_display_as_c
olumn
v
vp2_transpose v
vp2_hide_grid v
vp2_hide_title v
vp2_hide_column_headers v
vp2_haleft, vp2_haright,
vp2_hacenter
v v v v v
vp2_vatop, vp2_vacenter,
vp2_vabot
v v v
vp2_fill v v v v v v v v v
vp2_text_left v v
vp2_3dlook v v v v v v
pr-0-0-vp2_10.fm
168 00/1014
Appendix - Form Attributes, Function Attributes, Events
Progress Bar
Message Bar
Checkgroup
VP2 Tables
Combobox
Roundrect
Checkbox
TreeNode
Tabsheet
DataLink
Menubar
Tabpane
Polygon
Spindial
Textbox
Polyline
Description
Screen
Button
Coldef
Image
Label
Menu
Pane
Rect
Oval
Line
Arc
vp2_nofill v
vp2_mark_sel v v
vp2_square v v
vp2_symbol_spot,
vp2_symbol_cross,
vp2_symbol_check,
v v
vp2_symbol_prop
vp2_showscrnm v
vp2_noimagescroll v
vp2_multiline v
vp2_useicon v
pr-0-0-vp2_10.fm
00/1014 169
Appendix - Form Attributes, Function Attributes, Events
– vp2_table_no_sort
VP2 Tables - disables sort by column functionality
– vp2_override
enables ‘override’ for the current object: this means it could be overridden to other
VP2 objects of different type
– vp2_no_uninit_error
disables error messaging for uninitialized VP2 object
– vp2_update_parent
DataLink - updates the linked parent object, besides the object itself, as soon as its
value changes
– vp2_oneshot
DataLink - disables the DataLink object after the first time it is detected. To enable
it again, do it manually
– vp2_mon_not_visible
DataLink - the DataLink object is still updated even when invisible
– vp2_mon_disabled
DataLink - the DataLink object is still updated even when disabled
pr-0-0-vp2_10.fm
170 00/1014
Appendix - Form Attributes, Function Attributes, Events
– vp2_no_update_enable
DataLink - the DataLink object is not automatically updated when such a variable
viewing is disabled
– vp2_immediate_update
DataLink - if specified, the Component is updated as soon as the linked
Component is modified
– vp2_table_row_select
VP2 Tables - enables the line cursor modality (selecting a whole row)
– vp2_table_disable_header
VP2 Tables - disables the column header button
– vp2_dtype_free
specifies the text field with no format. For all vp2_dtype_xxx functional constants
(except vp2_dtype_numi), in case of Textbox, the virtual alpha-numeric keypad will
be used
– vp2_dtype_numi
specifies integer numeric field. In case of Spindial, it indicates whether the value is
to be displayed as INTEGER. In case of Checkbox, it specifies the colour of the
selection symbol (depending on the specified integer value). In case of Textbox,
the numeric virtual keypad will be used.
– vp2_dtype_numf
specifies real numeric field. In case of Spindial, it indicates whether the value is to
be displayed as REAL. For all vp2_dtype_xxx functional constants (except
vp2_dtype_numi), in case of Textbox, the virtual alpha-numeric keypad will be
used
– vp2_dtype_alpha
specifies a just alphabetic field. For all vp2_dtype_xxx functional constants (except
vp2_dtype_numi), in case of Textbox, the virtual alpha-numeric keypad will be
used.
Message Bar
Checkgroup
VP2 Tables
Combobox
Roundrect
Checkbox
TreeNode
Tabsheet
DataLink
Menubar
Tabpane
Polygon
Spindial
Textbox
Polyline
Description
Screen
Button
Coldef
Image
Label
Menu
Pane
Oval
Rect
Line
Arc
vp2_mode_ovr v
vp2_presel v v
vp2_exclusive v
vp2_typnrm, vp2_typlngpr,
vp2_typterm
v
vp2_scrlhor, vp2_scrlver v
vp2_noautoup v v v v v v v v
pr-0-0-vp2_10.fm
00/1014 171
Appendix - Form Attributes, Function Attributes, Events
Progress Bar
Message Bar
Checkgroup
VP2 Tables
Combobox
Roundrect
Checkbox
TreeNode
Tabsheet
DataLink
Menubar
Tabpane
Polygon
Spindial
Textbox
Polyline
Description
Screen
Button
Coldef
Image
Label
Menu
Pane
Rect
Oval
Line
Arc
vp2_noremove v
vp2_shownmid,
vp2_showdim, v
vp2_showinf
vp2_dp_0, vp2_dp_1,
vp2_dp_2, vp2_dp_3,
vp2_dp_4, vp2_dp_5,
v v
vp2_dp_6
vp2_table_no_sort v v
vp2_override v v v v v v v v
vp2_no_uninit_error v v
vp2_update_parent v
vp2_oneshot v
vp2_mon_not_visible v
vp2_mon_disabled v
vp2_no_update_enable v
vp2_immediate_update v
vp2_table_row_select v
vp2_table_disable_header v
vp2_dtype_free v
vp2_dtype_numi v v v
vp2_dtype_numf v v
vp2_dtype_alpha v
pr-0-0-vp2_10.fm
172 00/1014
Appendix - Form Attributes, Function Attributes, Events
12.3 Events
– vp2_on_error
number of the VP2 object detected error
– vp2_action_performed
the ENTER key has been pressed/released onto the object (depending on the
object type)
– vp2_focus_gained, vp2_focus_lost
the object has been selected/unselected
– vp2_chooser_gained, vp2_chooser_lost
the cursor has been moved to/from the object (blue rectangle)
– vp2_on_visible, vp2_on_hidden
the object has become visible/invisible. In VP2.Frames environment this event is
triggered as soon as the Screen becomes visible/invisible. This will then happen
when the frame is displayed for the first time, when the frame is closed, but also
when the frame is maximized/minimized. Note that when the frame is closed, the
vp2_on_win_close event triggers too.
– vp2_on_pressed, vp2_on_released
either the ENTER key or a menu item has been pressed/released
– vp2_on_resize
the object dimension (h or w) has been modified
– vp2_on_textchange
the object text has been modified
– vp2_on_open, vp2_on_close
lo screen è stato aperto o chiuso
– vp2_on_long_pressed, vp2_on_long_released
either a button or a menu item has been long pressed/released (if set to be long
pressed)
– vp2_on_keypressed
a key has been pressed
– vp2_on_mouse_pressed, vp2_on_mouse_released
a mouse key has been pressed/released
– vp2_on_win_close
a currently displayed Screen has been closed (in VP2.Frames environment). This
happens, for instance, when the user clicks either the X symbol (close) in the frame
topmost right corner, or a Green Screen in the VP2.Frames Screens list
(see par. 9.2.2 Screen Page on page 129)
– vp2_on_cell_event
a VP2 Table cell has been modified
– vp2_component_modified_event
a VP2 object dimension/position has been modified.
pr-0-0-vp2_10.fm
00/1014 173
Appendix - Form Attributes, Function Attributes, Events
Progress Bar
Message Bar
Checkgroup
VP2 Tables
Combobox
Roundrect
Checkbox
TreeNode
Tabsheet
DataLink
Menubar
Tabpane
Polygon
Spindial
Textbox
Polyline
Description
Screen
Button
Coldef
Image
Label
Menu
Pane
Rect
Oval
Line
Arc
vp2_on_error v v v v v v v v v v v v v v v v v v v v v v v v v v v
vp2_action_performed v v v v v v v v v v
vp2_focus_gained,
vp2_focus_lost
v v v v v v v v v v v v v
vp2_chooser_gained,
vp2_chooser_lost
v v v v v v v v v v v v v v v v v v
vp2_on_visible,
vp2_on_hidden
v v v v v v v v v v v v v v v v v v v v v v v
vp2_on_pressed,
vp2_on_released
v v v v v v v v
vp2_on_resize v v v v v v v v v v v v v v v v v v v v v
vp2_on_textchange v v v
vp2_on_open,
vp2_on_close
v
vp2_on_long_pressed,
vp2_on_long_released
v
vp2_on_keypressed v v v v v v v v v v v v v v v v v
vp2_on_mouse_pressed,
vp2_on_mouse_released
v
vp2_on_win_close v
vp2_on_cell_event v
vp2_component_modified_
event
v v v v v v v v v v v v v v v v v v v v
pr-0-0-vp2_10.fm
174 00/1014
COMAU Robotics services
Repair: repairs.robotics@comau.com
Training: training.robotics@comau.com
Spare parts: spares.robotics@comau.com
Technical service: service.robotics@comau.com
comau.com/robotics Original instructions