You are on page 1of 176

Comau Robotics

Instruction Handbook

VP2 - Visual PDL2

System Software Rel. 2.30.xx

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.

Copyright © 2008-2013 by COMAU - Date of publication 10/2014


Summary

SUMMARY

PREFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9
Symbols used in the manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Modification History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1. GENERAL SAFETY PRECAUTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...12


Responsibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Safety Precautions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Applicability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Operating Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...22

3. DEVELOPING YOUR OWN GRAPHIC INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . ...23


Glossary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
VP2 Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Callback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
.VPS and .LVP files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
.LST file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
VP2 Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ReadPipe model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Builder model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Outlines about VP2 internal mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Creating the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Sample program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Viewing the VP2 application on the Teach Pendant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Available as SETUP or SERVICE subpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27
Available in the Left Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29
Programming models. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
ReadPipe model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Builder model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
VP2 library (VP2_LIB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
VP2 interface smart programming tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Sample programs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

lb-0-0-vp2TOC.fm
3
Summary

4. FUNCTIONALITY AND USAGE


OF VP2 OBJECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..43
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Common Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Tabsheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Tabpane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Pane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Button . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Progress Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Combobox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Checkbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Checkgroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Textbox. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Spindial. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Menubar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Message Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
DataLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Coldef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73
Line. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
Arc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Rect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
Roundrect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
Polyline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77
Oval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
Polygon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Customizing VP2 objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

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

6. PREDEFINED ROUTINES FOR VP2 PROGRAMS USE . . . . . . . . . . . . . . . . . . . . . . ..87


System Routines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
VP2_SCRN_CREATE Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
VP2_SCRN_ADD Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
VP2_SCRN_DEL Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

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

7. VP2 TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...102


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
VP2 Tables Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Basic VP2 Table Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
VP2 Table “boundaries” . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Total Specified Width of Columns is Greater than Table Width . . . . . . . . . . . . . . . . . . . . .108
Table Width Is Greater Than Total Specified Width of Columns . . . . . . . . . . . . . . . . . . . .109
Height. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
vp2table.h is set to greater than zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
vp2table.h is not specified or set to zero . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
Transposing a VP2 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Table Dimensions When Transposing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
Height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
Adding and Removing Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Appearance of a VP2 Table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Format flags (attr_form) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
‘line’ field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Functional flags (attr_func). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

lb-0-0-vp2TOC.fm
5
Summary

Using fonts with VP2 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115


Cell objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Table cells type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Events on a VP2 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Example - ENTER key on VP2 Table rows (via callback) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Sorting by Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Data Handling in VP2 Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Updating a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Disabling automatic updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

8. VP2 TREES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..123


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
TreeNode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Example of VP2.Tree creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Positioning a TreeNode onto its Container . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Adding new nodes after initial add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
TreeNode updating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

9. VP2.FRAMES (OPTIONAL FEATURE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..127


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Configuring a VP2.Frames session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Session Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Screen Page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Selecting the Screen to be displayed onto the VP2.Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Handling a Screen to be displayed onto the VP2.Frames . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Creating a Screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133
Making a Screen available onto a physical device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134
Positioning and dimensioning a Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136
User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Title Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Menu Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Connect / Disconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
Session Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145
Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145
Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Unable to connect to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

lb-0-0-vp2TOC.fm
6
Summary

VP2.Frames not licensed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146


Connection Lost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Checksum is incorrect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Warning Indicator on VP2 Frame. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
APPENDIX 2: sample program for VP2.Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

10. VP2.BUILDER (OPTIONAL FEATURE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...150


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Errors at VP2.Builder startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
Start Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
New Program Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
Edit Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Components subpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
Properties subpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Hierarchy subpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Events subpage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Program subpage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Edit Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Edit mode program appearance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Editing Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Using the mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Using the keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Structure of a PDL2 program developed with Vp2.Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Callback to handle events related to the Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Variables declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
Example of using VP2.Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

11. TROUBLESHOOTING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...162


The program is running but nothing is displayed on the Screen . . . . . . . . . . . . . . . . . . . . . . . 162
A Component is not displayed, having just X and Y defined . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Impossible to trap events for a specified Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Some Components cannot be seen on the Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Error 1244 is detected (uninitialized Variable) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Error 11298 is detected (Pipe full) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
How to know whether a Screen or a Pane are displayed or not . . . . . . . . . . . . . . . . . . . . . . . 164
DPRO Timeout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
VP2 application page is locked . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Error 40103 is detected (CALL/CALLS failed) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Paging on a wider table on the TP screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Vertical scrollbar not updated on the table. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

lb-0-0-vp2TOC.fm
7
Summary

12. APPENDIX - FORM ATTRIBUTES, FUNCTION ATTRIBUTES, EVENTS . . . . . . . ..166


Format attributes (attr_form) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Form attributes applicability to VP2 objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Functional attributes (attr_func) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Functional attributes applicability to VP2 objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Events applicability to VP2 objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

lb-0-0-vp2TOC.fm
8
Preface

PREFACE
– Symbols used in the manual
– Reference documents
– Modification History

Symbols used in the manual


The symbols for WARNING, CAUTION and NOTES are indicated below together with
their significance.

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:

Comau C5G Control Unit – Technical Specifications


– Transport and installation
– Use of Control Unit.

These manuals are to be integrated with the following documents:


ù

Comau Robot – Technical Specifications


– Transport and installation
– Maintenance
Programming – PDL2 Programming Language Manual
– VP2 - Visula PDL2
– Motion programming
Applications – According to the required type of
application.

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

1. 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.

This specification deals with the following topics:


– Responsibilities
– Safety Precautions.

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 application of these Safety Precautions is the responsibility of the persons


assigned to direct / supervise the activities indicated in the Applicability sectionally
are to make sure that the Authorised Personnel is aware of and scrupulously follow
the precautions contained in this document as well as the Safety Standards in
addition to the Safety Standards in force in the country in which it is installed.
– The non-observance of the Safety Standards could cause injuries to the operators
and damage the Robot System (Robot and Control System).

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 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.

Installation and Putting into Service


The installation is intended as the mechanical, electrical and software integration of the
Robot and Control System in any environment that requires controlled movement of
robot axes, in compliance with the safety requirements of the country where the system
is installed.

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.

Auto / Remote Automatic Mode


Operating mode in which the robot autonomously executes the programmed cycle at the
work speed, with the operators outside the protected area, with the safety barriers
closed and the safety circuit activated, with local (located outside the protected area) or
remote start/stop.

Maintenance and Repairs


Maintenance and repairs are activities that involve periodical checking and / or
replacement (mechanical, electrical, software) of Robot and Control System parts or
components, and trouble shooting, that terminates when the Robot and Control System
has been reset to its original project functional condition.

ge-0-0-0_01.FM
00/1011 13
General Safety Precautions

Putting Out of Service and Dismantling


Putting out of service defines the activities involved in the mechanical and electrical
removal of the Robot and Control System from a production unit or from an environment
in which it was under study.
Dismantling consists of the demolition and dismantling of the components that make up
the Robot and Control System.

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

1.2.4 Operating Modes


Installation and Putting into Service
– Putting into service is only possible when the Robot and Control System has been
correctly and completely installed.
– The system installation and putting into service is exclusively the task of the
authorised personnel.
– The system installation and putting into service is only permitted inside a protected
area of an adequate size to house the robot and the fixtures it is outfitted with,
without passing beyond the safety barriers. It is also necessary to check that under
normal robot movement conditions there is no collision with parts inside the
protected area (structural columns, power supply lines, etc.) or with the barriers. If
necessary, limit the robot working areas with mechanical hard stop (see optional
assemblies).
– Any fixed robot control protections are to be located outside the protected area and
in a point where there is a full view of the robot movements.
– The robot installation area is to be as free as possible from materials that could
impede or limit visibility.
– During installation the robot and the Control Unit are to be handled as described in
the product Technical Documentation; if lifting is necessary, check that the
eye-bolts are fixed securely and use only adequate slings and equipment.
– Secure the robot to the support, with all the bolts and pins foreseen, tightened to
the torque indicated in the product Technical Documentation.
– If present, remove the fastening brackets from the axes and check that the fixing
of the robot fixture is secured correctly.
– Check that the robot guards are correctly secured and that there are no moving or
loose parts. Check that the Control Unit components are intact.
– If applicable, connect the robot pneumatic system to the air distribution line paying
attention to set the system to the specified pressure value: a wrong setting of the
pressure system influences correct robot movement.
– Install filters on the pneumatic system to collect any condensation.
– Install the Control Unit outside the protected area: the Control Unit is not to be used
to form part of the fencing.
– Check that the voltage value of the mains is consistent with that indicated on the
plate of the Control Unit.
– Before electrically connecting the Control Unit, check that the circuit breaker on the
mains is locked in open position.

– 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

Auto / Remote Automatic Mode


– The activation of the automatic operation (AUTO and REMOTE states) is only to
be executed with the Robot System (Robot and Control System) integrated inside
an area with safety barriers properly interlocked, as specified by Safety Standards
currently in force in the Country where the installation takes place.
– Before starting the automatic mode the operator is to check the Robot and Control
System and the protected area to make sure there are no potentially hazardous
irregular conditions.
– The operator can only activate automatic operation after having checked:
• that the Robot and Control System is not in maintenance or being repaired;
• the safety barriers are correctly positioned;
• that there is nobody inside the protected area;
• that the Control Unit doors are closed and locked;
• that the safety devices (emergency stop, safety barrier devices) are
functioning;
– Special attention is to be paid when selecting the automatic-remote mode, where
the line PLC can perform automatic operations to switch on motors and start the
program.

Robot axes release


– In the absence of motive power, the robot axes movement is possible by means of
optional release devices and suitable lifting devices. Such devices only enable the
brake deactivation of each axis. In this case, all the system safety devices
(including the emergency stop and the enable button) are cut out; also the robot
axes can move upwards or downwards because of the force generated by the
balancing system, or the force of gravity.

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.

Maintenance and Repairs


– When assembled in COMAU Robotics & Service, the robot is supplied with
lubricant that does not contain substances harmful to health, however, in some
cases, repeated and prolonged exposure to the product could cause skin irritation,
or if swallowed, indisposition.
First Aid. Contact with the eyes or the skin: wash the contaminated zones with
abundant water; if the irritation persists, consult a doctor.

ge-0-0-0_01.FM
18 00/1011
General Safety Precautions

If swallowed, do not provoke vomiting or take anything by mouth, see a doctor as


soon as possible.
– Maintenance, trouble-shooting and repairs are only to be carried out by authorised
personnel.
– When carrying out maintenance and repairs, the specific warning sign is to be
placed on the control panel of the Control Unit, stating that maintenance is in
progress and it is only to be removed after the operation has been completely
finished - even if it should be temporarily suspended.
– Maintenance operations and replacement of components or the Control Unit are to
be carried out with the main switch in open position and locked with a padlock.
– Even if the Control Unit is not powered (main switch open), there may be
interconnected voltages coming from connections to peripheral units or external
power sources (e.g. 24 Vdc inputs/outputs). Cut out external sources when
operating on parts of the system that are involved.
– Removal of panels, protection shields, grids, etc. is only allowed with the main
switch open and padlocked.
– Faulty components are to be replaced with others having the same code, or
equivalent components defined by COMAU Robotics & Service.

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.

– Trouble-shooting and maintenance activities are to be executed, when possible,


outside the protected area.
– Trouble-shooting executed on the control is to be carried out, when possible
without power supply.
– Should it be necessary, during trouble-shooting, to intervene with the Control Unit
powered, all the precautions specified by Safety Standards are to be observed
when operating with hazardous voltages present.
– Trouble-shooting on the robot is to be carried out with the power supply cut out
(Drive off).
– At the end of the maintenance and trouble-shooting operations, all deactivated
safety devices are to be reset (panels, protection shields, interlocks, etc.).
– Maintenance, repairs and trouble-shooting operations are to be concluded
checking the correct operation of the Robot System (Robot and Control System)
and all the safety devices, executed from outside the protected area.
– When loading the software (for example after replacing electronic boards) the
original software handed over by COMAU Robotics & Service is to be used.
Scrupulously follow the system software loading procedure described in the
specific product Technical Documentation; after loading always run a test cycle to
make sure, remaining outside the protected area
– Disassembly of robot components (motors, balancing cylinders, etc.) may cause
uncontrolled movements of the axes in any direction: before starting a disassembly
procedure, consult the warning plates applied to the robot and the Technical
Documentation supplied.
– It is strictly forbidden to remove the protective covering of the robot springs.

ge-0-0-0_01.FM
00/1011 19
General Safety Precautions

Putting Out of Service and Dismantling


– Putting out of service and dismantling the Robot and Control System is only to be
carried out by Authorised Personnel.
– Bring the robot to transport position and fit the axis clamping brackets (where
applicable) consulting the plate applied on the robot and the robot Technical
Documentation.
– Before stating to put out of service, the mains voltage to the Control Unit must be
cut out (switch off the circuit breaker on the mains distribution line and lock it in
open position).
– After using the specific instrument to check there is no voltage on the terminals,
disconnect the power supply cable from the circuit breaker on the distribution line,
first disconnecting the power conductors, then the earth. Disconnect the power
supply cable from the Control Unit and remove it.
– First disconnect the connection cables between the robot and the Control Unit,
then the earth cable.
– If present, disconnect the robot pneumatic system from the air distribution line.
– Check that the robot is properly balanced and if necessary sling it correctly, then
remove the robot securing bolts from the support.
– Remove the robot and the Control Unit from the work area, applying the rules
indicated in the products Technical Documentation; if lifting is necessary, check the
correct fastening of the eye-bolts and use appropriate slings and equipment only.
– Before starting dismantling operations (disassembly, demolition and disposal) of
the Robot and Control System components, contact COMAU Robotics & Service,
or one of its branches, who will indicate, according to the type of robot and Control
Unit, the operating methods in accordance with safety principles and safeguarding
the environment.
– The waste disposal operations are to be carried out complying with the legislation
of the country where the Robot and Control System is installed.

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:

Tab. 1.1 - Stop spaces in programming modality (T1)

Expected Stopping Stopping


Mode Case
speed time space
Nominal 120 ms 30 mm
T1 250 mm/s
Limit 500 ms 125 mm

Tab. 1.2 - Safety electronics reaction time in programming modality (T1)

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

Mission time (typ. case)


– We remind you that the safety system efficiency covering is equal to 20 years
(mission time of safety-related parts of control systems (SRP/CS), according to
EN ISO 13849-1).

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. DEVELOPING YOUR OWN GRAPHIC


INTERFACE
– Glossary
– Outlines about VP2 internal mechanism
– Creating the program
– Programming models
– VP2 library (VP2_LIB)
– VP2 interface smart programming tips
– Sample programs.

3.1 Glossary
– VP2 Object
– Container
– Component
– Callback
– .VPS and .LVP files
– .LST file
– VP2 Hierarchy
– ReadPipe model
– Builder model.

3.1.1 VP2 Object


A VP2 object is either a Container or a Component.

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

field (e.g. vp2_action_performed).

3.1.5 .VPS and .LVP files


The .VPS file is a binary file containing, for each VP2 object, definition, initialization and
hyerarchical position among the predefined objects (e.g. which vp2pane a certain Label
belongs to).
It is created as the output from the VP2.Builder program. It is loaded into memory
whenever the VP2_LOAD Predefined Procedure is called. It can be saved by calling the
VP2_SAVE Predefined Procedure.
When translated in ASCII form, a .LVP file is generated, allowing the application
programmer to easily edit and develop it, even offline on a PC, if needed.

3.1.6 .LST file


It is an ASCII file automatically created by the VP2.Builder, containing all the callback
definitions for each declared object in the .VPS file.
Such file, <program_name>_callback.lst, must be opened by the programmer and all
the defined callback routines must be copied into the program file (.pdl or .cod). In such
a way, it is impossible to make mistakes in defining the callback routines, avoiding the
subsequent error

40103 CALL/CALLS failed

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.

3.1.7 VP2 Hierarchy


It represents the relationship among the declared VP2 objects.
It is defined by the VP2.Builder upon the objects creation, della creazione degli oggetti,
separated between Containers (Pane, Screen, Tabsheet, etc.) and Components (Label,
Textbox, etc.)

Example
-- VPS Hierarchy
#-ve_screen
| #-ve_menubar
| | #-ve_zero
| | #-ve_refresh
| #-ve_table
| | #-we_cedp_stats

3.1.8 ReadPipe model


This term identifies the classical VP2 program development modality, explicitly reading
(READ statement) from the program pipe, by inserting the definition of all the objects
(both Containers and Components), their fields initialization, into the .cod file, in addition
to READ <lun_pipe>... statement.

pr-0-0-vp2_01 bis.fm
24 00/1014
Developing your own Graphic Interface

3.1.9 Builder model


This term identifies a VP2 program development modality, according to the VP2.Builder
use organization. In addition to the .cod file, it provides a .vps file including the initialized
objects (both Containers and Components), their hierarchy (indicated at the bottom of
the file), the callbacks names (if existing) and a .lst file with their declarations. This
model necessarily implies that the program has been developed by means of the
VP2.Builder, at least during the first setting phase. It is anyway difficult to develop such
a program type without getting any errors caused by wrong definitions, for example.

3.2 Outlines about VP2 internal mechanism


VP2Server is the system software which handles VP2 environment and directs graphic
handling onto the TP/VP2.Frames where Screens and their Components are displayed.
As far as the communication between VP2Server and C5G Controller, the Controller
acts as the Master whereas VP2Server acts as the Slave. The communication channel
is represented by the pipe.
The bi-directional communication between the two parts, is based upon the CEDP
protocol (Comau External Device Protocol).
The Controller drives actions towards TP/Vp2.Frames by executing the VP2 predefined
routines such as VP2_SCRN_CREATE Function, VP2_SCRN_ADD Procedure
/VP2_SCRN_DEL Procedure, VP2_SCRN_REMOVE Procedure, VP2_SCRN_SET
Procedure, VP2_SCRN_PDV_GET Function, VP2_SCRN_AVAIL Procedure,
VP2_SCRN_STATE Predefined Function, VP2_SEL_SET Procedure,
VP2_SCRN_INFO Function.
TP/VP2.Frames communicates with the Controller by sending information and events
(id, code, data) to the programs PIPEs.

3.3 Creating the program


To properly generate an application program, follow the described below steps:

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.

c. define a Screen (it is to be always defined in a program) on which other Containers


of the being displayed graphic objects can be loaded

VAR ve_screen: vp2screen NOSAVE

pr-0-0-vp2_01 bis.fm
00/1014 25
Developing your own Graphic Interface

d. declare the wished Container variables, such as Panes and Tabpanes.

VAR vp_pane: vp2pane NOSAVE

e. declare Component variables to be bloaded onto the Containers.

VAR vlabel: vp2label NOSAVE


When there are several Components of the same type, it is suggested to define
them as an ARRAY, to allow a faster reaction of the 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.

i. While the graphic interface grows up in objects, thus Events/actions to be handled,


use all the power offered by the VP2 and the chosen objects.
Then define:
• Events (ev_code and ev_mask fields); it is suggested to handle the events
which are generated upon interactions with the user (e.g. ENTER key, arrow
keys, ESC key pressure)
• the message bar (msgbar) on which informational and error messages are
displayed
• the program section to properly handle the errors.

j. Choose the application viewing modality (see par. 3.3.2 Viewing the VP2
application on the Teach Pendant on page 27).

k. To develop the application, it is suggested to use the Memory Debug environment


(by inserting break-points, viewing variables values, step-by-step executing the
statement) and display the values of the parameters received from either the pipe
(pipe READ) or the callback routines (if existing).
Some of the previous steps are automatically executed when using the VP2.Builder
(optional feature) environment, thus the program development according to Builder
model.

3.3.1 Sample program


A very easy sample program (also available in the system software CD) folows, to better
explain what previously described.

PROGRAM vp_sample NOHOLD

pr-0-0-vp2_01 bis.fm
26 00/1014
Developing your own Graphic Interface

IMPORT 'vp2_lib

VAR ve_screen : vp2screen NOSAVE -- Declare the VP2 objects


VAR ve_label1: vp2label NOSAVE
VAR vi_scrn_id : INTEGER NOSAVE
BEGIN
ve_screen.ordinal := 1 -- The program will be activated
-- from the TP Left Menu
ve_screen.x := 0 -- Initialize the Screen Component
-- of the program
ve_screen.y := 0
ve_screen.w := -1
ve_screen.h := -1
ve_screen.name := $PROG_NAME -- Screen name
ve_label1.text := 'Hello World' -- text to be displayed
ve_label1.x := -1
ve_label1.y := -1
ve_label1.w := -1
ve_label1.h := -1
vi_scrn_id := VP2_SCRN_CREATE(ve_screen) -- Create the Screen
VP2_ADD (ve_screen, ve_label1) -- add the Label to the Screen
VP2_SCRN_ADD (PDV_TP, vi_scrn_id) -- add the Screen to the TP device
PAUSE -- When the program is deactivated,
-- the Screen will be removed
END vp_sample

3.3.2 Viewing the VP2 application on the Teach Pendant


There are two modalities to view the VP2 application on the Teach Pendant:
– Available as SETUP or SERVICE subpage.
– Available in the Left Menu.

3.3.2.1 Available as SETUP or SERVICE subpage


The VP2 application can be activated from within either the SETUP or the SERVICE
Page.
To do so, create a file in XML format, containing the name of the being activated user
program, together with the search path for the .COD file; the XML file must be present
in the following folder

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):

PROGRAM SpinDial NOHOLD


IMPORT 'VP2_LIB.COD'

VAR ve_screen : vp2screen


vi_scrn_id : INTEGER
ve_spin : vp2spindial

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

– XML file to access SpinDial user page (SpinDial.XML file)

<?xml version="1.0" ?>


<config>

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.

3.3.2.2 Available in the Left Menu


If the user calls the VP2 application by means a Left Menu key, the following steps are
required

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

c. activate such a program (e.g. in the STARTUP phase)

d. the corresponding Left Menu key becomes available

e. press the key whenever the VP2 application page is to be shown/hidden.

Please, note that in this case no XML file is required.

3.4 Programming models


Two modalities are available for programming a V2 Graphic Interface application,
depending on the user’s needs:
– ReadPipe model - classical VP2 programming, for either simple interfaces or smart
programmers
– Builder model - programming model according to the VP2.Builder organization, for
complex interfaces.

The following table lists differences between the two described above programming
models:

Functionality ReadPipe model Builder model


VP2_INIT Procedure must always be called VP2_VB_INIT Procedure is called which
to initialize all needed data for VP2. A creates the program Pipe, allocates needed
Initialization
possible initialization routine created by the resources for VP2 (e.g. errors to be trapped
user can be added to it. on - ERR_TRAP_ON), conditions, etc.

pr-0-0-vp2_01 bis.fm
00/1014 29
Developing your own Graphic Interface

Functionality ReadPipe model Builder model


All objects definitions and their initializations
Insert VAR declaration for each object (even
are inside a .vps file.
VP2 objects if just displayed, not interacting with the
Only if a program statement explicitly refers
declaration user) because it is required to initialize and
to them, they must be declared inside the
refer to them.
.cod file.
VP2_PIPE_CREATE Function must be This is automatically done by VP2_VB_INIT
Pipe creation
called Procedure.
Continuous cycle of reading the PIPE and This is transparent to the programmer,
handling the returned parameters from because it is handled by VP2_VB_MAIN
Loop on input
READ statement (object on which the event Function.
messages
occurred, associated data, event). See The programmer just has to write down the
par. 5.2.1 PIPE reading on page 83 callback routines
Specify the name of the errors handling
PIPE reading and check the vi_code.
routine, as a parameter of VP2_VB_ERRH
Errors handling If vp2_on_error, the programmer has to
Procedure. It is suggested to always handle
properly handle the occurred error
all the possible errors
This model internally uses $SREG_NS
Used global No resources potentially conflict with the predefined variable. If any other program
resources user program also uses it, call VP2_VB_CNFG Procedure
to indicate an alternative variable for VP2
Predefined All the being called predefined routines are All the being called predefined routines are
routines identified by VP2_ prefix identified by VP2_VB_ prefix

3.4.1 ReadPipe model


This modality is always available to the VP2 application programmer, in the system
standard software. It does not need any additional optional environments.
With this modality, all declarations and initializations are to be inserted inside the
program body together with the execution statements.
Furthermore, in a continuous cycle, the events must be explicitly read on the program
PIPE and handled by means of explicitly selecting VP2 objects and their associated
events (SELECT statements).
Here below follows a partial and schematic representation showing the main steps to be
included in a VP2 program in ReadPipe modality. Reading such an instructions flow
could help the user while writing a VP2 program for the first time.
This kind of approach is suggested if the program is quite simple, with few VP2 objects.

PROGRAM schema NOHOLD


VAR ve_screen : vp2screen_v2 NOSAVE -- Screen
VAR ve_panel : vp2pane_v2 NOSAVE -- Pane
VAR vi_pipe : INTEGER NOSAVE -- pipe identifier (returned from
-- vp2_pipe_create routine)
VAR vi_code : INTEGER NOSAVE -- event on the component
VAR vi_id : INTEGER NOSAVE -- identifier of the object
-- associated to the event
VAR vi_scrn: INTEGER NOSAVE -- Screen identifier

pr-0-0-vp2_01 bis.fm
30 00/1014
Developing your own Graphic Interface

VAR ve_screen : vp2screen NOSAVE -- VP2 Screen object


BEGIN
vb_ontp := TRUE -- indicates the program must run
-- on the TP
vb_debug :=FALSE -- set to TRUE to view debug info
ERR_TRAP_OFF(xxxxx, etc…) -- execute the error trap for all
-- defined and trappable errors,
-- to avoid program interruptions
-- if and when they occur
vi_scrn := VP2_SCRN_CREATE(ve_screen) -- create the Screen
-- initialize VP2 objects:
ve_screen.x := 0 -- Screen position and dimension
ve_screen.y := 0
ve_screen.w := 640
ve_screen.h := 381
ve_panel.x := - 1 -- Pane position
ve_panel.y := - 1
..............
VP2_ADD (ve_screen, ve_panel) -- add the Pane to the Screen
vi_pipe := vp2_pipe_create ($PROG_NAME) -- create pipe
vp2_pipe_flush (vi_pipe) -- clean pipe (to be done just once
-- at the beginning!)
CYCLE -- program cycle
REPEAT -- pipe reading continuous cycle
READ vi_pipe (vi_id, vi_code, vs_data)
UNTIL $FL_STS = 0
IF vb_debug THEN
WRITE LUN_CRT ('RcvEventId:',vi_id,' Code:',vi_code::0::2,' ',' Data:',
vs_data, NL)
ENDIF
IF (vi_code = vp2_action_performed) OR (vi_code = vp2_on_pressed) OR
(vi_code = vp2_on_released) THEN
SELECT vi_id OF
CASE (ki_spindial1):
...
CASE (ki_menu1):
ELSE:
...
ENDSELECT
ENDIF
END schema

3.4.2 Builder model


If the being developed interface is quite complex and rich in VP2 objects, it is hard to set

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.

PROGRAM Prg_scheleton NOHOLD, STACK = 5000


IMPORT 'vp2_lib'
VAR vi_pdv : INTEGER NOSAVE -- physical device
VAR vi_scrn_id : INTEGER NOSAVE -- Screen identifier
VAR ve_screen : vp2screen NOSAVE -- Screen object(Container)
VAR vb_ontp : BOOLEAN (TRUE) NOSAVE -- Display on the TP
VAR vi_debug : INTEGER (0) NOSAVE -- View debug information
-- This routine is called when an error is detected in the program
-- The user can insert his own error handling, inside the ruotine
ROUTINE ru_onerror(ai_error : INTEGER) EXPORTED FROM Prg_scheleton
ROUTINE ru_onerror(ai_error : INTEGER)
BEGIN
-- The user inserts his own error handling in here

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

-- Available for SETUP Page on TP


VP2_SCRN_AVAIL(vi_scrn_id,IP_TO_STR($SYS_PARAMS[61]),'255.255.255.0')
ENDIF
ELSE
VP2_SCRN_AVAIL(vi_scrn_id, '172.22.176.0', '255.255.248.0')
ENDIF
ENDIF
CYCLE
SELECT vp2_vb_main OF -- vp2_vb_main is the VP2 Engine
CASE (0): -- Normal
CASE (1): -- Not severe error. The user adds
-- his own error handling
WRITE LUN_CRT ('Error during execution', $THRD_ERROR, NL)
CASE (-1): -- Severe error ($THRD_ERROR can be
-- checked )
DEACTIVATE
ENDSELECT
END Prg_scheleton -- End of program

In the following example, a trace is reported of <program_name>.VPS file.


--
-- Prg_scheleton.vps File
-- Version SW 1.15
--

TYPE vp2screen : RECORD Glob


Fields: 37
x : INT
y : 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
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

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

TYPE vp2pane : RECORD Glob


Fields: 32
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
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
comp_1 : INT
f_name : STR Len: 16
f_style : INT
f_size : INT
line : INT
image : STR Len: 63
callback : STR Len: 31

TYPE vp2label : RECORD Glob


Fields: 33

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

ve_screen REC vp2screen Priv NoSave


x: 0
y: 0
w: -1
h: -1
name: 'prg_scheleton'
id: 1
attr_form: 0
attr_func: 2
units: 1
f_color: 1
b_color: 20
error: 0
visible: ON
enabled: ON
inkey: 0
ev_code: 0
ev_mask: 1
t_up: -1

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'

vpane004 REC vp2pane Priv NoSave


x: 0
y: 0
z: ******
w: 300
h: 300
name: 'vpane004'
id: 4
attr_form: 0
attr_func: 0
units: -1
f_color: 0
b_color: 32
error: 0
visible: ON
enabled: ON
inkey: 0
ev_code: -1
ev_mask: 1
t_up: -1
t_down: -1
t_left: -1
t_right: -1
cm_id: -1
bm_id: -1
in_keymask: -1
comp_1: -1
f_name: 'MONOSPACED'
f_style: 0
f_size: 14
line: 1
image: ''
callback: 'pnl4'

pr-0-0-vp2_01 bis.fm
00/1014 37
Developing your own Graphic Interface

vlabel005 REC vp2label Priv NoSave


x: 10
y: 10
z: ******
w: 120
h: 30
name: 'vlabel005'
id: 5
attr_form: 0
attr_func: 0
units: -1
f_color: 0
b_color: 20
error: 0
visible: ON
focusable: ON
enabled: ON
inkey: 0
ev_code: -1
ev_mask: 1
t_up: -1
t_down: -1
t_left: -1
t_right: -1
cm_id: -1
bm_id: -1
in_keymask: -1
help: 'Help'
f_name: 'MONOSPACED'
f_style: 0
f_size: 14
line: 1
text: 'Questa è una label'
callback: 'lbl5'

-- The following section must be present at the bottom of the


-- .lvp file, to indicate VP2 objects hierarchy to VP2Engine

-- VP2 Hierarchy
#-ve_screen
| #-vpane004
| | #-vlabel005

3.5 VP2 library (VP2_LIB)


VP2_LIB.COD file, automatically installed in UD:\SYS\UTIL folder, by the software
loading procedure, is the VP2 library.
It includes:

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).

PLEASE NOTE THAT:


– vp2_lib is an open not protected library, but it is NEVER to be modified
because compatibility problems with later versions might occur;
– object names with _v2 suffix, refer to version 2 of the same object.

3.6 VP2 interface smart programming tips


– Always insert the suitable statement for importing VP2_LIB library, in order to be
able to use flags and routines defined in it

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

Warning! such a modality slows down execution.

– 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.

3.7 Sample programs


The current paragraph describes how to create a first simple VP2 program, as well as
gives information about how to get sample programs for different purposes.

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

Fig. 3.1 - “Hello World” Program

PROGRAM vp_sample_event NOHOLD


IMPORT 'vp2_lib'
VAR ve_screen: vp2screen NOSAVE
VAR ve_label1 : vp2label NOSAVE
VAR ve_button1 : vp2button NOSAVE
VAR vi_scrn_id, vi_i : INTEGER NOSAVE
BEGIN
ve_screen.ordinal := 1 -- Available on the Left Menu
ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := -1
ve_screen.h := -1
ve_screen.name := $PROG_NAME
ve_label1.text := 'Hello World' -- Text to be displayed
ve_label1.x := -1
ve_label1.y := -1
ve_label1.w := -1
ve_label1.h := 300
ve_label1.f_color := WIN_RED
ve_button1.x := 400 -- Start button
ve_button1.y := 350
ve_button1.h := 40
ve_button1.w := 60
ve_button1.ev_code := 50009
ve_button1.text := 'Start'
vi_scrn_id := VP2_SCRN_CREATE(ve_screen) -- Create the Screen
VP2_ADD(ve_screen, ve_button1, ve_label1) -- Add Button and Label
VP2_SCRN_ADD(PDV_TP, vi_scrn_id) -- Add Screen to the device:
-- TP, in current example
WAIT FOR EVENT 50009 -- Wait for event 50009

pr-0-0-vp2_01 bis.fm
00/1014 41
Developing your own Graphic Interface

WRITE LUN_CRT ('Check Button event ', NL)


FOR vi_i := 10 DOWNTO 1 DO
ve_label1.f_color := vi_i
ENCODE (ve_label1.text, 'Stop ', vi_i)
VP2_UPDATE(ve_label1)
DELAY 1000
ENDFOR
ENCODE (ve_label1.text, 'Program terminated')
VP2_UPDATE(ve_label1) -- The Screen is removed if the
-- program terminates
PAUSE
END vp_sample_event
The vp2button Component interacts with the user.
So it allows, once either pressed or released, to send events to the VP2 program.
This is possible by setting Ev_code: INTEGER field to a value chosen by the user, in a
predefined range from 49152 to 50175, e.g. 50009:

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. FUNCTIONALITY AND USAGE


OF VP2 OBJECTS
This section describes all the objects used in VP2 environment, their features and their
usage. Examples are provided for such objects configuration.
For further information, please refer to Customizing VP2 objects.
VP2 objects always belong to a program. As soon as it is deactivated, the system
cancels everything, unlike what happens for PDL2 procedures and functions handling
Windows and Screens.

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.

4.2 Common Properties


The following properties belong to the most of VP2 objects.

– 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.

– Id: INTEGER, >0


It is the unique identifier of the Vp2 object. This value is normally used to identify
the object within the event loops. It is absolutely needed to assign the identifier, if
some operations will be performed on the object, upon an event.
In order to guarantee the program proper working, it is also needed that such
identifier is unique in the whole program, which means no other objects can exist
having the same value in the id field.
Default: None

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.

– attr_func: INTEGER, >0


It is a set of VP2 objects functional attributes. VP2 objects properties are a bitmask
of velues, corresponding to the wished attributes, OR'ed together and assigned to
attr_func field.

Please refer to par. 12.2 Functional attributes (attr_func) on page 170 for the VP2
objects functional attributes descriptions and applicability.

– f_color, b_color: INTEGER, >0


They are the foreground colour and the background colour of the VP2 object,
respectively. Colour viewing ultimately depends on the colour resolution of the
device, e.g. Teach Pendant (TP).
The following colour values are available for VP2 objects:

Tab. 4.1 - VP2 colours

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

Tab. 4.1 - VP2 colours

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:

WAIT FOR EVENT event_number


inserted into the program by the application/interface programmer.
For any other methods to handle events, refer to par. 5.3 User defined events on
page 85.
Default: 0
– Ev_mask: INTEGER
The ev_mask field allows the user to filter out events received by the associated
I

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.

When the event is triggered, it is notified on the PIPE.


In case of explicit reading from the PIPE,

READ vi_pipe (vi_id, vi_code, vs_data)

the VP2 object identified by vi_id, receives an event, identified by vi_code, to be


properly handled by the programmer.
In case of associated callback to the involved VP2 object

ROUTINE <callback_name> (ai_id, ai_event : INTEGER; as_data : STRING) EXPORTED FROM


<program_name>
the event will be set into the ai_event field.

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

Set the ev_mask field to -1, to enable all events.

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:

ROUTINE <callback_name> (ai_id, ai_event : INTEGER; as_data : STRING) EXPORTED FROM


<program_name>
If the VP2.Builder environment is being used, a file is automatically created called
<program_name>_callback.lst containing the proper callbacks declaration which
added by means of such a tool and which may be copied within the main program
code.

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)

– comp_1: INTEGER - first focusable Component within the Container. In such a


way, as son as the control passes to such a Container, the focus will immediately
be moved to the indicated Component. On the contrary, if no ID is specified, a
default Component will be chosen. Note that this field MUST be specified before
making visible the vp2pane including such Component.

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

– ordinal : INTEGER - is this Tabsheet position within the Tabpane


– callback : STRING[31].

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.

The properties of Pane 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
– Enabled : BOOLEAN
– Ev_mask: INTEGER
– bm_id : INTEGER
– comp_1: INTEGER - first focusable Component id.
– line: INTEGER - Line thickness. Default: 1 pixel.
– image: STRING[32] - it is the name of the image file (search path is included too).
– callback : STRING[31].

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

The properties of Button 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
– 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
– image: STRING[63] - name of the image file including path.
– text: STRING[15] - Text which is displayed on the Button
– callback : STRING[31].

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):

The attr_form field is allowed to contain the OR of such values.


Buttons can appear with the text written in four different fonts. For example with
attr_form field set to the default value, the Button is displayed as follows (depending on
f_name attribute value):

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.

The maximum amount of Labes in a VP2 Page is 80.

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

– Id: INTEGER, >0


– attr_form: INTEGER, >0
– f_color, b_color: INTEGER, >0
– 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] - it is the Label text.
– callback : STRING[31].
The Label properties represented by attr_form are similar to Textbox.

4.4.3 Progress Bar


Datatype: vp2progress

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.

The properties of Progress Bar 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
– Help: STRING[63]
– t_up, t_down, t_left, t_right: INTEGER

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.

0 (Default) vp2_notcomaulnf OR vp2_3dlook vp2_notcomaulnf OR vp2_bstyle1

b_color := WIN_YELLOW b_color := WIN_WHITE


f_color := WIN_BLUE f_color := WIN_GREEN

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

the corresponding value of s_values, which is 8 working hours, is read when


Tuesday is selected.
– callback : STRING[31].

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

VAR ve_mycombobox : vp2combobox


VAR vs_item : STRING[32]
VAR vi_id : INTEGER
VAR vi_code : INTEGER
VAR vi_pipe : INTEGER

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

REPEAT -- Wait for the next command, reading the PIPE


READ vi_pipe (vi_id, vi_code, vs_data)
UNTIL $FL_STS = 0
SELECT (vi_id) OF
CASE (ki_comboid):
IF (vi_code = vp2_action_performed) THEN
DECODE (vs_data, vi_index)
IF vi_index = 1 THEN -- select first item
.....
ENDIF
ENDIF
CASE (...):

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

0 (Default) vp2_notcomaulnf vp2_notcomaulnf


OR vp2_3dlook

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

The properties of Checkbox 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_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

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

f_color := WIN_WIN_YELLOW -- (unchecked)


b_color := WIN_BLUE
u_color := WIN_LIGHTGRAY -- (checked)
s_color := WIN_RED

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:

value := 13 -- i.e. 001101

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

– 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. Default:
f_name - MONOSPACED; f_style - PLAIN; f_size - 14
– line: INTEGER - Line thickness. Default: 1 pixel when not Comau style (NOT
Comau look and feel).
– text :STRING[127] - Current content of the Textbox. Line feed using \n is
supported and text that cannot fit is truncated.
– min_len: INTEGER - Minimum length of text field. Default: 0
– max_len: INTEGER - Maximum length of text field
– callback : STRING[31].

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

vp2_notcomaulnf OR vp2_bstyle1 or vp2_3dlook

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.

The properties of Spindial 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
– 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 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.

– 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. Default:
f_name - MONOSPACED; f_style - PLAIN; f_size - 14
– line: INTEGER - Line thickness. Default: 1 pixel when not Comau style (NOT
Comau look and feel).
– value: INTEGER - the actual value of the Spindial. Default: 0
– min_val: INTEGER - Minimum value that the Spindial can contain. Default: 0

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:

A Spindial is displayed as an INTEGER, by default


To handle it as a REAL, setup the attr_func field so that it includes vp2_dtype_numf and
one of the available choices of vp2_dp_x type (to specify the decimal digits to be
shown).
It is also allowed to specify the increment/decrement type (‘increment’ field, e.g. 0.001
or 0.01).

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

See also Chap.12. - Appendix - Form Attributes, Function Attributes, Events on


page 166

Examples
A few examples for attr_form are as follows:

O(Default)

vp2_notcomaulnf

vp2_notcomaulnf OR vp2_3dlook

vp2_notcomaulnf OR vp2_3dlook OR vp2haright

vp2_notcomaulnf OR vp2_3dlook OR vp2_fill (b_color := WIN_WHITE)

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.

The Menubar must be associated to a Container (e.g. to a Screen or to a Pane).


Example:

ve_screen.bm_id := ve_menubar.id

where ve_screen is a vp2_screen and ve_menubar is a vp2menubar.

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)

Then call VP2_UPDATE Procedure for the Container.


Example

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].

4.4.11 Message Bar


Datatype: vp2msgbar
It is possible to create message dialog boxes in a VP2 program in order to prompt the
users for information or to warn them about something. To do so, the programmer would
create a variable of type vp2msgbar and add it to the Screen (VP2_ADD Procedure).
When the user wishes to display it, the show field is to be set to TRUE and an update
operation (VP2_UPDATE Procedure) is to be performed.
This will display the dialog on the Screen and disable any other Component on the page.
The user can however navigate to alternative pages on the left and right menus as
normal.
The programmer must specify the message text to be displayed together with the
required buttons and the severity. The severity level will guide the colour of the
message and, if the ability to display an icon with the message is enabled by setting the
vp2_useicon bit in the attr_form field, the icon itself too.
When the user presses one of the buttons associated to the message, the dialog box
will automatically disappear.

The record definition is as follows:


– Id: INTEGER, >0 - User id of this Component
– attr_form: INTEGER, >0 - Default: 1
– Ev_mask: INTEGER - the default event is vp2_on_error OR vp2_action_performed
– message: STRING[127] - Message to be displayed on the dialog box. Default:
none
– show: BOOLEAN - Enable/disable the disaply of the message. Default: FALSE -
disabled
– callback : STRING[31].
When the user releases the Message Bar, a vp2_action_performed event is generated
associated to the message identifier. The data string contains the identifier of the button
that was pressed and must be decoded into an INTEGER variable and compared with
the following constants in the VP2 library:
vp2_idok, vp2_idcancel, vp2_idyes, vp2_idno, vp2_idabort, vp2_idretry,
vp2_idskip, vp2_idack, vp2_idignore, vp2_idreset, vp2_idtrue, vp2_idfalse,
vp2_idon, vp2_idoff.
To know the available Dialog Buttons for the Message Bar, refer to par. 12.1 Format
attributes (attr_form) on page 167

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:

ve_msgbar.attr_from := vp2_b_ok or vp2_b_cancel

There are two routines to handle the message bar:


– ru_ask - is a routine asking a question to the user by means of the message bar
which displays OK and CANCEL keys.

ROUTINE ru_ask(ai_code : INTEGER; as_message : STRING)


BEGIN
ve_msgbar.message := 'Do you want to end this session?'
ve_msgbar.attr_form := vp2_b_ok OR vp2_b_cancel
ve_msgbar.callback := 'ru_dialog'
ve_msgbar.show := TRUE
VP2_UPDATE(ve_msgbar, vp2_update_later)
VP2_UPDATE(ve_screen, vp2_update_sweep)
END ru_ask

– ru_dialog - is the callback called when an action is performed on the message bar

ROUTINE ru_dialog (ai_id, ai_event : INTEGER; as_data :


STRING) EXPORTED FROM myProg -- callback associata alla
message bar
ROUTINE ru_dialog (ai_id, ai_event : INTEGER; as_data :
STRING)
VAR li_code , li_sts: INTEGER
BEGIN
li_sts := 0
DECODE(as_data, li_code)
IF li_code = vp2_b_ok THEN
ru_complete_session
ELSE
IF li_code = vp2_b_cancel THEN
ru_restore_the_session
ENDIF
ENDIF
END ru_dialog

The message bar field for the callback must be set to the ru_dialog routine name

ve_msgbar.callback := 'ru_dialog'

where ve_msgbar must have previously been declared as follows:

VAR ve_msgbar: vp2msgbar NOSAVE

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.

To setup a DataLink means:

a. create a vp2datalink type record

b. set the data field value

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

Polygon is a filled graphical VP2 Component of up to 16 points connected with lines.

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).

A Polygon 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.
– points: INTEGER [16,2] - Matrix of the polygon points
– callback : STRING[31].

pr-0-0-vp2_04.fm
80 00/1014
Functionality and usage of VP2 objects

4.5 Customizing VP2 objects


In VP2 programs, users may define new versions of a predefined object, adding some
user defined fields.
If the user wishes to put together, in just one data type, both the VP2 object information
and the ones needed by the programmer, it is allowed to customize the VP2 data type,
by adding the new user fields as the last ones, if possible.
The user defined data type must keep the existing prefix, plus an underscore ‘_’
character followed by a name, chosen by the user, which allows to customize it. The
predefined VP2 fields MUST NOT be renamed!

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.

TYPE vp2label_mylabel = RECORD GLOBAL


x : INTEGER -- x position
y : INTEGER -- y position
z : INTEGER -- z depth ordinal
w : INTEGER -- Width
……
Fi_num_lines: INTEGER - new field, added by the user
ENDRECORD

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.

5.1 Events handling


Current section refers to programs developed by means of the Builder model (with or
without VP2.Builder).
The programmer can define events which, when triggered, will call a specified routine
performing all needed operations.
To do this, the following definition must be inserted within the program initialization
section:

VP2_VB_ONUE('ru_onuserevent') -- callback name in case of


-- user event
where:
– ru_onuserevent is the routine name, created by the user to perform actions upon
the associated event is triggered
– VP2_VB_ONUE Procedure is the VP2_LIB routine to handle the ru_onuserevent
routine call, when the event is triggered.
The event is then forwarded by means of VP2_VB_RSUE Procedure.
Example:

CONDITION[2] SCAN (500 DIV 20), NODISABLE :


WHEN vb_open DO
VP2_VB_RSUE (KI_FLOW_OPEN)
ENDCONDITION
or a different program:

VP2_VB_RSUE (KI_FLOW_OPEN, my_Vp2program)

VP2_VB_RSUE (KI_FLOW_OPEN, my_Vp2program)

pr-0-0-vp2_06.fm
82 00/1014
Events

5.2 Events associated to VP2 objects


The ev_mask field must include one or more ORed predefined event values, in order to
monitor some events associated to a VP2 object.
The value of 0 is suggested for those static objects which don’t need to be monitored for
any event.
The -1 value indicates all events will be monitored for such an object: please note that,
if it is not needed, this could cause too much trafic on the PIPE and interface low
reactivity.

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).

5.2.1 PIPE reading


An event which is associated to an abject belonging to the graphic interface written by
the VP2 programmer, is read from the LUN of the PIPE created for such a program.
An example follows of a PDL2 program structure, reading events on the Components
from a PIPE:

PROGRAM vp_skel NOHOLD


IMPORT 'vp2_lib'

CONST ki_tickid = -2 -- event tick from ISR

VAR vb_tick : BOOLEAN


vi_pipe : INTEGER NOSAVE
vi_event : INTEGER NOSAVE -- event code
vi_id : INTEGER NOSAVE
vs_data : STRING[128] NOSAVE

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:

READ vi_pipe(vi_id, vi_event, vs_data)

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_spindial.ev_mask := vp2_action_performed OR vp2_on_textchange

ve_msgbar.ev_mask := vp2_action_performed OR vp2_on_keypressed OR vp2_on_pressed

ve_table.ev_mask := vp2_on_keypressed OR vp2_chooser_gained OR vp2_chooser_lost


OR vp2_on_error
Upon reading the PIPE, the following statements could be used:

READ vi_pipe(vi_id, vi_event, vs_data)


SELECT (vi_id) OF
CASE(100): -- let’s suppose 100 is the ve_spindial id of the
-- shown above example
IF (vi_event = vp2_on_textchange) THEN
-- perform the expected actions

5.2.2 Callback on the VP2 object (Builder Model)


When using the Builder model, a so called callback routine can be associated to each
VP2 object, including the wished programmed actions to be performed upon an event
occurrence.
This could be implemented by means of either the following statements

ve_pane.callback := ‘ru_pane’
ve_pane.ev_mask := vp2_on_error or vp2_on_visible or vp2_on_hidden

or directly inside the object declaration in the .vps/.lvp file:

pr-0-0-vp2_06.fm
84 00/1014
Events

ve_pane REC vp2pane Priv NoSave


x: 0
y: 0
z: ******
w: 550
h: 350
name: 'myPane'
id: 2
attr_form: 0
attr_func: 0
units: -1
f_color: 0
b_color: 32
error: 0
visible: OFF
enabled: ON
inkey: 0
ev_code: -1
ev_mask : 193 -- vp2_on_error or vp2_on_visible or vp2_on_hidden
t_up: -1
t_down: -1
t_left: -1
t_right: -1
cm_id: -1
bm_id: 13
in_keymask: -1
comp_1: 19
f_name: 'MONOSPACED'
f_style: 0
f_size: 14
line: 1
image: ''
callback: 'ru_pane'

where

ROUTINE ru_pane (ai_id, ai_event : INTEGER; as_data : STRING)


ROUTINE ru_pane (ai_id, ai_event : INTEGER; as_data : STRING)
BEGIN
IF (ai_event = vp2_on_visible) THEN
..
END ru_pane

5.3 User defined events


The ev_code field, just available for few objects (e.g. Menu), can contain a value in the
range 49152 - 50175 which the interface programmer associates a special meaning.
Thus, at program level, an ev_code can be associated to an object in order to be able
to detect the event triggered by a specified action upon the such an object.
Example:

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

some actions can be performed to handle it.

WAIT FOR EVENT 50009


Refer to vp_sample_event sample program.

pr-0-0-vp2_06.fm
86 00/1014
Predefined Routines for VP2 Programs use

6. PREDEFINED ROUTINES FOR VP2


PROGRAMS USE
– System routines - their icode is written in the system software language and they
are inside the system software itself; at PDL2 level, there is only the opportunity to
call theml
– PDL2 routines belonging to the VP2_LIB - their code is written in PDL2 language
and they are inside the VP2_LIB; however, they should NOT be modified in any
way, in order not to irrecoverably compromise all programs using VP2
environment.

Tab. 6.1 - Summary of VP2 routines

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

PDL2 routines belonging to the VP2_LIB


VP2_INIT Procedure Initialize VP2 global variables
VP2_PIPE_CREATE Function Create the wished PIPE
VP2_PIPE_FLUSH Procedure Flush the specified PIPE
VP2_EVENTTXT Function Return a text string describing the specified event
Warning - The listed below routines are 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 87
Predefined Routines for VP2 Programs use

Tab. 6.1 - Summary of VP2 routines (Continued)


VP2_VB_INIT Procedure Initialize the event handling environment (condition, pipe, etc.)
VP2_VB_MAIN Function Handle events by reading the PIPE and calling the associated
callback function
VP2_VB_EXIT Function Needed to exit from the program vp2_vb_main
VP2_VB_ERRH Procedure Needed to specify the callback routine for errors handling
VP2_VB_ONUE Procedure Needed to specify the callback routine for VP2 user errors
handling
VP2_VB_CNFG Procedure Routine to configure some parameters
VP2_VB_RSUE Procedure Routine to generate a user event
VP2_VB_PROP Procedure Routine to propagate events

pr-0-0-vp2_05.fm
88 07/0113
Predefined Routines for VP2 Programs use

6.1 System Routines


– VP2_SCRN_CREATE Function
– VP2_SCRN_ADD Procedure
– VP2_SCRN_DEL Procedure
– VP2_SCRN_AVAIL Procedure
– VP2_SCRN_PDV_GET Function
– VP2_SCRN_REMOVE Procedure
– VP2_SCRN_SET Procedure
– VP2_SCRN_STATE Predefined Function
– VP2_SCRN_INFO Function
– VP2_SCRN_INFO Function
– VP2_ADD Procedure
– VP2_REMOVE Procedure
– VP2_UPDATE Procedure
– VP2_LOAD Predefined Procedure
– VP2_SAVE Predefined Procedure
– VP2_INFO Predefined Function.

6.1.1 VP2_SCRN_CREATE Function

Calling Sequence: VP2_SCRN_CREATE(scrn_rec)

Return Type: INTEGER

Parameters: Scrn_rec : vp2screen [IN]

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

6.1.2 VP2_SCRN_ADD Procedure

Calling Sequence: VP2_SCRN_ADD(<pdv_id>, <scrn_id>)


Parameters: pdv_id : INTEGER [IN]
scrn_id : INTEGER [IN]
Comments: This predefined routine forces the specified Screen to be opened by a physical device.
The physical device is either the Teach Pendant (PDV_TP) or another device (identified
by an IP address expressed as a PDL2 string) on which the VP2 page is to be displayed;
the default is the Teach Pendant.
Examples: To display the Screen on the Teach Pendant:
VP2_SCRN_ADD(PDV_TP, scrn_id) -- Display the Screen on the TP

6.1.3 VP2_SCRN_DEL Procedure

Calling Sequence: VP2_SCRN_DEL (scrn_id)

Parameters: scrn_id : INTEGER [IN]

Comments: This predefined routine deletes the Screen from the physical device which displayes it
(e.g. Teach Pendant)
Examples: VP2_SCRN_DEL (scrn_id)

6.1.4 VP2_SCRN_AVAIL Procedure

Calling Sequence: VP2_SCRN_AVAIL (scrn_id<,ip_addr> <,subnet> <,remotename>)


Parameters: scrn_id : INTEGER [IN]
ip_addr: STRING [IN] (optional)
subnet : STRING [IN] (optional)
remotename : STRING [IN] (optional)
Comments: This predefined routine makes the Screen available to any physical device (which could
even be unknown at the routine call time) with IP address, subnet mask and name,
matching the ones specified as calling parameters.
srcn_id is the Screen id
ip_addr is the IP address of the device on which the Screen is to be displayed
subnet is the subnet mask address of the device on which the Screen is to be displayed
remote_name is the name of the device on which the Screen is to be displayed
The Screen availability can be changed at any time, whenever it is no longer to be
displayed.
Examples: -- To allow the Screen to be displayed onto a specific range of
-- devices:
VP2_SCRN_AVAIL(scrn_id, "tp", "255.255.255.0", name) -- or
VP2_SCRN_AVAIL(scrn_id, "10.3.12.1", "255.255.255.0",name)

pr-0-0-vp2_05.fm
90 07/0113
Predefined Routines for VP2 Programs use

6.1.5 VP2_SCRN_PDV_GET Function

Calling Sequence: VP2_SCRN_SCRN_PDV_GET(scrn_id<,obj_array>)

Return Type: INTEGER

Parameters: scrn_id : INTEGER [IN]


obj_array : ARRAY OF STRING [OUT]
Comments: This predefined function indicates the Physical Device (e.g. PDV_TP) which the
specified Screen (scrn_id, returned from VP2_SCRN_CREATE Function during
the Screen creation) is currently displayed onto.
PDV_TP - Teach Pendant physical device
PDV_CRT - WinC5G Terminal Screen
The expected returned values are:
– -1 : no currently displayed Screen
– 1 : PDV_TP (the physical device is the Teach Pendant)
– n (other values) : VP2.Frames (optional feature) session identifier
The returned PDV value can be later used to add a new Screen (by means of
VP2_SCRN_ADD Procedure).
obj_array which is returned, is a VP2 Components list, together with the
associated version, for each one of them.
The most experienced users can use this predefined function to get the version
of each VP2 Component belonging to the specified Screen.

6.1.6 VP2_SCRN_REMOVE Procedure

Calling Sequence: VP2_SCRN_REMOVE(pdv_id, scrn_id)

Parameters: pdv_id : INTEGER [IN]


scrn_id : INTEGER [IN]
Comments: This predefined routine removes the displayed Screen from a physical device.
The Screen is not actually deleted but it is just removed from the display. In order to
display it again, it will need to be either Added (VP2_SCRN_ADD Procedure) or made
Available(VP2_SCRN_AVAIL Procedure).

6.1.7 VP2_SCRN_SET Procedure

Calling Sequence: VP2_SCRN_SET (pdv_id, scrn_id)

Parameters: pdv_id : INTEGER [IN]


scrn_id : INTEGER [IN]
Comments: This predefined routine forces the specified Screen to be displayed onto a physical
device. This includes the System Screens too.
For example, it forcely assigns the specified Screen to the TP. This wouldn’t be
recommended while the user is interacting with the TP itself! It is then important that this
routine is just used in very special cases, such as applications startup.
pdv_id can assume the following values:

pr-0-0-vp2_05.fm
07/0113 91
Predefined Routines for VP2 Programs use

– PDV_TP - Teach Pendant physical device


– PDV_CRT - WinC5G Terminal Screen
scrn_id can assume the following values, represented by the corresponding predefined
constants:
– SCRN_MOTION - MOTION Page
– SCRN_ALARM - ALARM Page
– SCRN_PROG - PROG Page
– SCRN_IDE - IDE Page
– SCRN_IO - IO Page
– SCRN_APPL - Application Page
– SCRN_FILE - FILE Page
– SCRN_SETUP - SETUP Page
– SCRN_DATA - DATA Page
– SCRN_SERVICE - Service Page
– SCRN_TPINT - TP-INT Page
– SCRN_VP2 - VP2 Page
– SCRN_LOGIN - Start/Login Page
Examples: VP2_SCRN_SET(PDV_TP, SCRN_MOTION)-- Set a system screen on the TP

6.1.8 VP2_SCRN_STATE Predefined Function

Calling Sequence: VP2_SCRN_STATE (scrn_id<,ip_address> <,name> <,session_id>)

Return Type: INTEGER

Parameters: scrn_id : INTEGER [IN]


ip_address : STRING [OUT] {optional}
name : STRING [OUT] {optional}
session_id: INTEGER [OUT] {opzional}
Comments: scrn_id is the id of the returned Screen from VP2_SCRN_CREATE Function while
creating such a Screen
ip_address is the Target device IP address value
name is the session name
session_id is the session identifier.

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.

6.1.9 VP2_SCRN_INFO Function

Calling Sequence: VP2_SCRN_INFO (list_of_screens, scrn_id)

Return Type: INTEGER

pr-0-0-vp2_05.fm
92 07/0113
Predefined Routines for VP2 Programs use

Parameters: list_of_screens : ARRAY OF STRING [IN]


scrn_id : ARRAY OF INTEGER [IN]
Comments: This predefined routine gives information about all the Screens. It returns the
total amount of existing Screens.
Its parameters have the following meaning:
list_of_screens - array including the Screens names
scrn_id - array including the Screens identifiers

6.1.10 VP2_SEL_SET Procedure

Calling Sequence: VP2_SEL_SET(comp_rec <,edit> <,scrn_id> <,arr_idx1> <,arr_idx2>)

Parameters: comp_rec : vp2* [IN]


edit : BOOLEAN [IN] {optional}
scrn_id : INTEGER [IN] {optional}
arr_idx1 : INTEGER [IN] {optional}
arr_idx2 : INTEGER [IN] {optional}
Comments: This predefined routine allows setting either focus or chooser (direct choice) onto a
specified Component.
comp_rec is the Component
edit indicates whether the Component is to be edited or just to be reached (TRUE means
move focus and edit field)
scrn_id is the Screen identifier
arr_idx1 and arr_idx2 are just used when the Component is an array, in order to specify
the being referred element.
The suggestion is to first call VP2_UPDATE Procedure for the Container, then current
VP2_SEL_SET Procedure to select the being focused Component.

6.1.11 VP2_ADD Procedure

Calling Sequence: VP2_ADD(comp_parent, comp_child <,comp_more>)

Parameters: comp_parent : VP2* [IN]


comp_child : VP2*[IN]
comp_more : VP2* [IN] {optional, up to 8}
Comments: This predefined routine adds one or more abjects to a Container. For example, it adds a
Pane to a Screen, a Button to a Pane, a Tabsheet to a Tabpane, a Pane to another Pane,
etc.
Provided that the VP2 Screen has initially been created by the user program, an object
can be added to a Container already belonging to such a Screen (e.g. by means of calling
VP2_ADD to add such a Container to the Screen). The being added object can be both a
Component and a Container (except DataLink Component which can be added to a
Component).
A Component cannot be added to another Component.
If an error occurs during VP2_ADD routine execution, the already added Components still
remain added, whereas the other ones won’t be added at all.
After calling VP2_ADD routine, it is needed to call VP2_UPDATE Procedure for the
Component.

In the following figure, the VP2 Containers hierarchy is shown:

pr-0-0-vp2_05.fm
07/0113 93
Predefined Routines for VP2 Programs use

6.1.12 VP2_REMOVE Procedure

Calling Sequence: VP2_REMOVE(comp_to_remove<, comp_to_remove>)

Parameters: comp_to_remove: VP2* [IN]

Comments: This predefined routine removes an object from its Container. Several objects can be
specified, separated by comma.

6.1.13 VP2_UPDATE Procedure

Calling Sequence: VP2_UPDATE(obj_rec <,update_mode> <,obj_rec…>)

Parameters: obj_rec : VP2* [IN]


update_mode : INTEGER [IN] (optional)
obj_rec : VP2* [IN] {optional, up to 7}
Comments: This predefined routine forces updating a VP2 object value in two different
situations:
– from C5G Controller towards TP / VP2.Frames (optional feature), or
– from TP / VP2.Frames (optional feature) towards the Controller (this is the
case of Disabling automatic updating).
If the involved VP2 object is a Container, the objects inside it will be repainted as
well.
– obj_rec is the name of the VP2 object;
– update_mode - updating modality (see also, for VP2 Tables, par. 7.12.2
Disabling automatic updating on page 120).
This parameter allows specifying whether to update or just to mark objects
for future updating and, in case of Updating Backwards, whether to just
update the really modified values or not.
The value contained in this parameter can be the result of combining the
following flags:
• vp2_update_modified
update backwards just if the object has really been modified
From TP/VP2.Frames to Controller
• vp2_update_sweep
update all previously marked objects with vp2_update_later flag
From Controller to TP/VP2.Frames

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)

in order to update them all later, in just one operation:

VP2_UPDATE (<father_object>, vp2_update_sweep).


See also: In case of VP2 Tables, please refer to par. 7.12.1 Updating a Table on page 119.

6.1.14 VP2_LOAD Predefined Procedure

Calling Sequence: VP2_LOAD (file_name<, executing_program> <,root>)

Parameters: file_name : STRING [IN]


executing_program : STRING [IN] {optional}
root : STRING [IN] {optional}

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

6.1.15 VP2_SAVE Predefined Procedure

Calling Sequence: VP2_SAVE (file_name<, executing_program> <,root>)

Parameters: file_name : STRING [IN]


executing_program : STRING [IN] {optional}
root : STRING [IN] {optional}
Comments: Allows to save viewing information about all VP2 objects of a specified page, in a
binary file of .VPS type.
file_name is the name of the .VPS file for saving the information
executing_program is the name of the currently executing program
root is the (optional) starting object from which to save the VP2 objects hierarchy
in file_name file.
This functionality will later allow loading (by means of VP2_LOAD Predefined
Procedure), all the specified page VP2 objects, without being forced to explicitly
set their properties.
See also: VP2_LOAD Predefined Procedure

6.1.16 VP2_INFO Predefined Function

Calling Sequence: VP2_INFO (obj_record<, parent> <, children>)

Return Type: BOOLEAN

Parameters: obj_record : VP2* [IN]


parent : STRING [IN] {optional}
children :ARRAY OF STRING [IN] {optional}
Comments: Restituisce TRUE o FALSE per indicare se l’oggetto VP2 specificato esista o no.
obj_record is the being found VP2 object
parent is a STRING containing the name of the VP2 parent object
children is an ARRAY containing the names of all its children.

pr-0-0-vp2_05.fm
96 07/0113
Predefined Routines for VP2 Programs use

6.2 PDL2 routines belonging to VP2_LIB


– VP2_INIT Procedure
– VP2_PIPE_CREATE Function
– VP2_PIPE_FLUSH Procedure
– VP2_EVENTTXT Function
– VP2_VB_INIT Procedure
– VP2_VB_MAIN Function
– VP2_VB_EXIT Function
– VP2_VB_ERRH Procedure
– VP2_VB_ONUE Procedure
– VP2_VB_CNFG Procedure
– VP2_VB_RSUE Procedure
– VP2_VB_PROP Procedure.

6.2.1 VP2_INIT Procedure


V

Calling Sequence: VP2_INIT

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.

6.2.2 VP2_PIPE_CREATE Function

Calling Sequence: VP2_PIPE_CREATE(as_pipe, ai_size)

Parameters: as_pipe : STRING [IN]


ai_size : INTEGER [IN]
Returned type: INTEGER

Comments: This routine creates the pipe, specified by:


– as_pipe - pipe name
– ai_size - pipe dimension
Returns the being created pipe identifier.

pr-0-0-vp2_05.fm
07/0113 97
Predefined Routines for VP2 Programs use

6.2.3 VP2_PIPE_FLUSH Procedure

Calling Sequence: VP2_PIPE_FLUSH(ai_pipe)

Parameters: ai_pipe : INTEGER [IN]

Comments: This routine executes the specified pipe flush:


– ai_pipe - identifier of the previously created pipe (VP2_PIPE_CREATE
Function).
It is suggested to immediately call this routine after the pipe creation. It is not
recommended to call it somewhere else, because some events could be lost,
which are useful for the program functioning.

6.2.4 VP2_EVENTTXT Function

Calling Sequence: VP2_EVENTTXT(ai_event)

Parameters: ai_event : INTEGER [IN]

Returned type: STRING

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.

6.2.5 VP2_VB_INIT Procedure

Calling Sequence: VP2_VB_INIT (<ai_timeout> <, ai_chnum> <, ai_pipe_size>)

Parameters: ai_timeout : INTEGER [IN]


ai_chnum : INTEGER [IN]
ai_pipe_size : INTEGER [IN]
Comments: This routine initializes the conditions handling initialization for the Buildee. It is to
be called as the first VP2 predefined routine because it takes care of initializing
all the VP2 functional structures.
IT MUST BE CALLED JUST ONCE!
– ai_timeout - it is the message read timeout (optional)
– ai_chnum - it is the condition number which is set by this routine. It is useful
to avoid any conflict with already defined conditions within the same program
(optional). Default is 1
– ai_pipe_size - it specifies the pipe dimension (optional). Default is 512.

6.2.6 VP2_VB_MAIN Function

Calling Sequence: VP2_VB_MAIN

pr-0-0-vp2_05.fm
98 07/0113
Predefined Routines for VP2 Programs use

Parameters: none

Returned type: INTEGER

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).

6.2.7 VP2_VB_EXIT Function

Calling Sequence: VP2_VB_EXIT(as_progname)

Parameters: as_progname : STRING [IN]

Returned type: BOOLEAN

Comments: This routine is to be used to make a VP2 program (specified in as_progname) to


exit from vp2_vb_main.
It can only be called from within another program. It returns TRUE when
successfully completed.

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).

6.2.8 VP2_VB_ERRH Procedure

Calling Sequence: vp2_vb_errh(as_routine<, as_progname>)

Parameters: as_routine : STRING [IN]


as_progname : STRING [IN]
Comments: This routine specifies the routine name for errors handling.
– as_routine - name of the 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).

6.2.9 VP2_VB_ONUE Procedure

Calling Sequence: vp2_vb_onue(as_routine<, as_progname>)

Parameters: as_routine : STRING [IN]


as_progname : STRING [IN]

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).

6.2.10 VP2_VB_CNFG Procedure

Calling Sequence: vp2_vb_cnfg(ai_timeout, ai_sreg, ai_debug, as_progname)

Parameters: ai_timeout : INTEGER [IN]


ai_sreg : INTEGER [IN]
ai_debug : INTEGER [IN]
as_progname : STRING [IN]
Comments: This routine is to be called for some parameters configuration:
– ai_timeout - timeout for reading values. Default is 0 which means no timeout
– ai_sreg - index of $SREG_NS register which VP2 could use for internal
purpose. It is to be specified whenever the user application already uses
$SREG_NS variable and the same element of such a variable MUST NOT
be used by VP2
– ai_debug - LUN for debug output (0 means no debug information)
– as_progname - name of the program associated to such settings.

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).

6.2.11 VP2_VB_RSUE Procedure

Calling Sequence: vp2_vb_rsue(ai_id, as_data, as_progname)

Parameters: ai_id : INTEGER [IN]


as_data : STRING [IN]
as_progname : STRING [IN]
Comments: This routine generates a user event
– ai_id - event identifier
– as_data - event associated data
– as_progname - name of the program receivng the event notification (if not
specified, it is the current program).

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

6.2.12 VP2_VB_PROP Procedure

Calling Sequence: vp2_vb_prop(as_progname)

Parameters: as_progname : STRING [IN]

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

7.2 VP2 Tables Fields


The fields of the VP2 Table object are shown in the following program declaration
section:

TYPE vp2table = RECORD


x : INTEGER -- x position
y : INTEGER -- y position
z : INTEGER -- z depth ordinal
w : INTEGER -- Width
h : INTEGER -- Height
name : STRING[64] -- Caption
id : INTEGER -- User ID of this VP2 object
attr_form : INTEGER -- Form attributes
attr_func : INTEGER -- Function attributes
ev_mask : INTEGER -- Event mask
-- Fields specific to this VP2 object
f_name : STRING[16] -- Font name
f_style : INTEGER -- Font style
f_size : INTEGER -- Font size
row_h : INTEGER -- Height of each row
col_w : INTEGER -- Width of each column (only when table is transposed)
line : INTEGER -- Thickness of the table's grid-lines (between cells)
callback : STRING[31] -- name of the callback routine used to handle all
-- expected events on this VP2 object
ENDRECORD

Further information about these fields is given in the following sections.

7.3 Basic VP2 Table Examples


This example is intended to illustrate a 'minimal' VP2 Table, including the basic
requirements for adding a VP2 Table to a VP2 page (the result is shown in par. 7.13
Appendix on page 120).
Please note that in order to add rows and columns to the table, we add Row Records
and Coldefs respectively, and that each column is associated to a field of the Row
Record, by means of its 'data' field:

PROGRAM vp2table_basic NOHOLD

-- Declaration of modified version of vp2screen:


TYPE vp2screen_min = RECORD
x : INTEGER -- x position
y : INTEGER -- y position
w : INTEGER -- Width
h : INTEGER -- Height
name : STRING[15] -- Caption
ordinal : INTEGER -- Position in either the left menu (if >0) or setup (if <0)
ENDRECORD

TYPE vp2coldef = RECORD


w : INTEGER -- Width

pr-0-0-vp2_12.fm
00/1014 103
VP2 Tables

name : STRING[64] -- Caption


id : INTEGER -- User ID of this VP2 object
ev_mask : INTEGER -- Event mask (applies to all the cells in this column)
-- Specific fields to this VP2 object
ordinal : INTEGER -- The position of this column within its parent table
data : STRING[127] -- Field name, in each row, corresponding to this column
ENDRECORD

TYPE vp2table = RECORD


x : INTEGER -- x position
y : INTEGER -- y position
z : INTEGER -- z depth ordinal
w : INTEGER -- Width
h : INTEGER -- Height
name : STRING[64] -- Caption
id : INTEGER -- User ID of this VP2 object
attr_form : INTEGER -- Form attributes
attr_func : INTEGER -- Function attributes
ev_mask : INTEGER -- Event mask
-- Specific fields to this VP2 object
f_name : STRING[16] -- Font name
f_style : INTEGER -- Font style
f_size : INTEGER -- Font size
row_h : INTEGER -- The height of each row
col_w : INTEGER -- The width of each column (only when table is transposed)
line : INTEGER -- Thickness of the table's grid-lines (between cells)
callback : STRING[31] -- name of the callback routine used to handle all
-- the expected events associated to this VP2 object
ENDRECORD

TYPE UserRow = RECORD


fi_int_example1 : INTEGER
fr_real_example1 : REAL
ENDRECORD

-- 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

VAR vp2_update_all : INTEGER EXPORTED FROM vp2_lib

BEGIN

-- Initialize the screen:


ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := 600
ve_screen.h := 440
ve_screen.name := 'VP2Table'
ve_screen.ordinal := 1

-- Initialize the table:


ve_table1.x := 5 -- X coordinate of top left corner of the table
ve_table1.y := 5 -- Y coordinate of top left corner of the table

pr-0-0-vp2_12.fm
104 00/1014
VP2 Tables

ve_table1.w := 0 -- ‘0’ means get the width from the columns


ve_table1.h := 0 -- ‘0’ means use the default row height
ve_table1.name := 'Basic Table Example' -- caption of the table

-- Initialize column of type 1:


ve_col1.w := 100 -- column width is in pixels
ve_col1.name := 'Col 1' -- column header name
ve_col1.ordinal := 1 -- Column position in the table, starting from left
ve_col1.data := 'fi_int_example1' -- variable of the being inserted row

-- Initialize column of type 2:


ve_col2.w := 100
ve_col2.name := 'Col 2'
ve_col2.ordinal := 2
ve_col2.data := 'fr_real_example1'

-- Initialize the first row:


veMyFirstRow.fi_int_example1 := 10 -- Data associated to col 1
veMyFirstRow.fr_real_example1 := 11.123 -- Data associated to col 2

-- Initialize the second row:


veMySecondRow.fi_int_example1 := 40 -- Data associated to col 1
veMySecondRow.fr_real_example1 := 49.456 -- Data associated to col 2

-- Create the screen:


vi_scrn_id := VP2_SCRN_CREATE(ve_screen)

-- Add screen to the physical device:


VP2_SCRN_ADD(PDV_TP, vi_scrn_id)

-- Add two columns to the table:


VP2_ADD(ve_table1, ve_col1, ve_col2)

-- Add two rows to the table:


VP2_ADD(ve_table1, veMyFirstRow)
VP2_ADD(ve_table1, veMySecondRow)

-- Add the table to the screen


VP2_ADD(ve_screen, ve_table1)

-- Update the screen:


VP2_UPDATE(ve_screen, vp2_update_all)

PAUSE

END vp2table_basic

pr-0-0-vp2_12.fm
00/1014 105
VP2 Tables

When the program is run, the resulting VP2 Table is as follows:

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.

7.4 VP2 Table “boundaries”


The 'boundaries' of a VP2 Table are its position and size.
The position is specified by means of X and Y fields. Note that these are referred to the
Container which the VP2 Table is added to.
Specifying Width and Height is slightly more complicated, and is explained in detail
below:
– Width
– Height

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.

VAR vp2_column_override: vp2label NOSAVE

vp2_column_override.attr_func := vp2_override -- to override


-- the column
vp2_column_override.attr_form := vp2_haleft OR vp2_multiline
VP2_ADD(ve_table, vp2_column_override)

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

7.4.1.1 Total Specified Width of Columns is Greater than Table Width


If the table width is set to a value which is smaller than the total specified width of its
columns, then the actual table width will be the total amount of the specified widths for
its columns.
As in the vp2table_basic sample program (where the table is assigned a width of zero),
each column is just added to the table with its declared width. This allows the VP2
programmer to precisely specify the width of each column. The total width of the table
will simply be the total amount of the widths of its columns, plus the width (thickness) of
the grid lines that separate each column and that border the table.
For example, if we have four columns in a table, with widths 50, 60, 75 and 80
respectively, and the table itself is declared with a width of 100, and its grid (line field)
is one pixel thick, its actual dimensions will be as follows:

pr-0-0-vp2_12.fm
108 00/1014
VP2 Tables

In this scenario the width of each column is always honoured.


The table width must be set to zero, in order to avoid any confusion (see
vp2table_basic sample program).

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.

7.4.1.2 Table Width Is Greater Than Total Specified Width of Columns


If the table width is greater than its specified columns width, then the table will honour
such a width.
This allows the VP2 programmer to precisely specify the total width of the table.
Each specified column width will be anyway honoured.
Any column that does not have a specified width is given an equal partition of the total
table width after any specified width columns have been accounted for.

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

7.4.2.1 vp2table.h is set to greater than zero


In this scenario, the vp2table.row_h field is ignored. The total height of the table will be
that specified by the vp2table.h field.
The height of each row will be an equal division of the table height, excluding the grid
lines, i.e.
height_of_each_row = (total_table_height - grid_lines) / total_number_of_rows.

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.

Fig. 7.1 - Row height

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

7.4.2.2 vp2table.h is not specified or set to zero


In this scenario, the height of each row will be the value of the vp2table.row_h field. If
this field either is not set to any value or is infinite, the default value of 25 pixels will be
used.
The total height of the table will just be the total amount of rows (including the table and
column header rows, as shown in Fig. 7.1) multiplied by vp2table.row_h value, plus the
thickness of the grid lines and border.
This modality allows the VP2 programmer to precisely control the height of the individual
rows.

7.5 Transposing a VP2 Table


The default layout of the table is with a set of column headers running horizontally along
the top of the table above the rows.
However, it is also possible to specify that the table should be laid out with the column
headers running vertically, down the left hand side of the table, with the rows appearing
as vertical lines of cells to the right of the column headers.
This is referred to as transposing the table (see the following figures).

Transposed Table Same Table - Untransposed

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

where vp2_transpose is imported from VP2_LIB. However, using a transposed layout


will affect the way in which the table dimensions can be specified.

7.5.1 Table Dimensions When Transposing


In a transposed table, rows appear vertically, with each one appearing on the right of the
previous one. Thus, in the following descriptions, row means a vertical line of cells, and
not a horizontal line of cells as for a normal table. Column means a horizontal line of
cells starting with a column header in the left-most position.

pr-0-0-vp2_12.fm
00/1014 111
VP2 Tables

A detailed description follows about table dimensions in case of transposition:


– Width
– Height

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.

7.6 Adding and Removing Rows and Columns


It is possible to add, by means of VP2_ADD Procedure, and to remove, by means od
VP2_REMOVE Procedure, arrays of rows and vp2coldefs to a VP2 Table.
When adding columns and rows to the table, it is necessary to update the table by
means of VP2_UPDATE Procedure.
When removing columns, the repainting is automatically handled; whereas when
removing rows or arrays of rows, it is necessary to UPDATE the table Container, by
means of VP2_UPDATE Procedure, so that the table is properly displayed.

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

It optimizes the data refresh times.

--
-- VP2 example for Table.
--
PROGRAM Table2 NOHOLD

IMPORT 'vp2_lib'

TYPE UserRow = RECORD


field1 : INTEGER
field2 : REAL
field3 : REAL
field4 : REAL
field5 : REAL
field6 : REAL
field7 : REAL
field8 : REAL
field9 : REAL
field10 : REAL
field11 : REAL
field12 : REAL
field13 : REAL
field14 : REAL
field15 : STRING[35]
ENDRECORD

CONST NUM_LINES = 10 -- Total amount of existing rows in the Table

-- 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

ve_table1.y := 0 -- Y coordinate of the table top left corner


ve_table1.w := 0 -- '0' means width is taken from columns
ve_table1.h := 0 -- '0' means the default height for rows is used
ve_table1.name := 'Basic Table Example' -- Table header

-- Create Screen:
vi_scrn_id := VP2_SCRN_CREATE(ve_screen)

-- Add Screen to the Physical Device:


VP2_SCRN_ADD(PDV_TP, vi_scrn_id)

-- 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

-- Add columns to the Table:


VP2_ADD(ve_table1, ve_cols)

-- Add rows to the Table:


FOR i := 1 TO NUM_LINES DO
veData[i].field1 := i
veData[i].field2 := i / 2
veData[i].field3 := i / 3
veData[i].field4 := i / 4
veData[i].field5 := i / 5
veData[i].field6 := i / 6
veData[i].field7 := i / 7
veData[i].field8 := i / 8
veData[i].field9 := i / 9
veData[i].field10 := i / 10
veData[i].field11 := i / 11
veData[i].field12 := i / 12
veData[i].field13 := i / 13
veData[i].field14 := i / 14
veData[i].field15 := 'Associated data to column 15'
ENDFOR

VP2_ADD(ve_table1, veData)

-- Add Table to Pane


VP2_ADD(ve_pane, ve_table1)

-- Add Pane to Screen


VP2_ADD(ve_screen, ve_pane)

-- Update Screen
VP2_UPDATE(ve_screen, vp2_update_all)

PAUSE
END Table2

pr-0-0-vp2_12.fm
114 00/1014
VP2 Tables

7.7 Appearance of a VP2 Table


– Format flags (attr_form)
– ‘line’ field
– Functional flags (attr_func)
– Using fonts with VP2 Table

7.7.1 Format flags (attr_form)


As far as a VP2 Table format, please refer to par. 12.1.1 Form attributes applicability to
VP2 objects on page 168

7.7.2 ‘line’ field


This is an INTEGER field of vp2table TYPE. It defines the grid lines drawn among the
table cells. If vp2_hide_grid flag is selected, the grid lines are not displayed, but cells are
anyway separated according to the value existing in this field.

7.7.3 Functional flags (attr_func)

Note, however, that the Using fonts with VP2 Table is still used to determine how much
space to put between the cells.

7.7.4 Using fonts with VP2 Table


Flags f_name, f_style, f_size: STRING[16], INTEGER, INTEGER are vp2table fields
specifying name, style and dimension of the font used for the Table, the same way it
happens for e.g. Textboxes. The specified font is not only used for the displayed text in
the Table (e.g. table Header) but also for all added VP2 objects.

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.

7.8 Cell objects


While building a VP2 Table, a new VP2 object for each row-record is created which has
a corresponding Coldef in the Table (this means the name of the field in a row-record
must match the content of a Coldef data field, otherwise it will not be displayed).
The TYPE of the VP2 object created to represent such a field, is automatically
determined according to the default values (see par. 7.8.1 Table cells type on
page 116), but the VP2 Programmer is anyway allowed to modify it.

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.

7.8.1 Table cells type


The cell-objects TYPE has got the following defaults, depending on how the Table fields
are declared:
– Integer - Spindial
– Real - Spindial
– Boolean - Combobox
– String - Textbox
– Vector - Spindial x 3
– Position - Spindial x 6
– JointPos - Spindial for each axis
– XtndPos - Spindial for each axis
The user is allowed to represent a table content in a different way than the default one,
by using a template of the wished type.
To do so, add an object of the wished type to the column (Coldef) including the field to
be represented in a different way, before the Coldef is added to the Table.

Example
In VP2 Tables, the default object to represent an INTEGER value, is the Spindial, as
shown in the following figure.

If the programmer wishes to represent an INTEGER value using a Textbox,

the procedure is as follows:

a. declare a vp2textbox type variable and assign it vp2_override attribute


es.
VAR ve_myinteger: vp2textbox NOSAVE
ve_myinteger.attr_func := vp2_override
ve_myinteger.visible := ON

pr-0-0-vp2_12.fm
116 00/1014
VP2 Tables

b. add the Textbox (by means of VP2_ADD Procedure) to vp2coldef which


corresponds to the INTEGER field (in the row) to be represented by means of a
Textbox instead of a Spindial.

VP2_ADD (ve_myColumn2, ve_myInteger)

c. Add all vp2coldef records to the Table

VP2_ADD (ve_myTable, ve_myColumn1, ve_myColumn2, ...)

d. Add all the rows to the Table

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.

Integer Real Boolean String

Button Value on object Value on object On / Off Value on object

Label Value on object Value on object On / Off Value on object

TextBox Value on object Value on object On / Off Value on object

SpinDial Value on object Value on object - -

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 -

7.9 Events on a VP2 Table


Usually, when an object issues an event to the pipe, three data are sent: the ID of the
object which sent the event, the event code, any other associated data depending on
such an event type.
In case of VP2 Tables, cells don’t have any ID because they are created by VP2 itself
and not by the programmer, when populating the Table.
Data read from the pipe are as follows:
– vp2coldef ID of the associated modified object;
– vp2_on_cell_event event code;
– data including: name of the row issuing the event, event code, any further
associated data to the event.
In the shown below Table, the value of ‘ve_myfirst_Row’ cell is modified in ‘col A’
column.

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:

7.10 Example - ENTER key on VP2 Table rows (via


callback)
Let’s consider vp2_on_keypressed (vp2_on_keypressed := 0x40000) event, defined in
the VP2_LIB and its decimal representation in ASCII string form: '262144'.
There is an associated callback to handle the ENTER key. Within it, the string passed
to the callback in the as_data field will be parsed. Its format is as follows:

<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.

CONST KS_ENTER_KEY_PRESSED := '262144' -- ASCII representation of 0x40000 which


-- is vp2_on_key_pressed event
CONST KI_EVENT_ON_ENTER = 5 –- this is the ENTER key pressure event, monitored
-- by the routine defined in vp2_vb_onue
TYPE ye_type_row = RECORD

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

7.11 Sorting by Columns


VP2 Tables are provided with a sort function. If the user pushes (or clicks if using
VP2.Frames (optional feature)) the column header button, the rows of the Table will be
sorted using the data of the selected column.

7.12 Data Handling in VP2 Tables


– Updating a Table
– Disabling automatic updating

7.12.1 Updating a Table


A VP2 Table can be either completely updated or just referring to single row records.
A Table is up-to-date when its values match the ones stored in the program execution
memory.
Basically, updating (VP2_UPDATE) a VP2 Table acts onto the whole Table, which
means onto all its elements. It is anyway allowed to carefully select the objects which
are really interested in such an updating operation, in order to reach a more efficient
performance.
The update modality for a VP2 Table depends on the passed flags to VP2_UPDATE
routine which are the same used for the other graphic objects too: no flags,
vp2_update_all, vp2_update_later, vp2_update_later, vp2_update_backwards,

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.12.2 Disabling automatic updating


The vp2_noautoup flag (available for attr_func field of a VP2 Table) indicates that
modifying a Table cell does not cause its associated variable, loaded into the program
execution memory, to be immediately updated.
This “non automatic” way of updating allows cancelling the modification, when needed,
and restoring the cell old value.
When updating thte Table is wished, with all the inserted data onto the graphic object,
VP2_UPDATE Procedure will be called passing vp2_update_backwards flag, either
combined or not with any other flags (see above examples).
If it is wished to restore the old value in the modified cells, instead, VP2_UPDATE
Procedure will be called passing either vp2_update_all or vp2_update_later so that all
values currently in the execution memory, are copied to the Table.

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

Fig. 7.2 - vp_table_basic - two columns of simple data types

Fig. 7.3 - vp_table_array - three columns displaying a complex data


type (ARRAY)

Fig. 7.4 - vp_table_over - example of a data type override

pr-0-0-vp2_12.fm
00/1014 121
VP2 Tables

Fig. 7.5 - vp_table_dyn - dynamic adding/removing of rows and


columns

Fig. 7.6 - vp_table_transpose - transposing a table

Fig. 7.7 - vp_table_update - examples of table updating

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.

Fig. 8.1 - A sample VP2.Tree

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.

– Id: INTEGER, >0 .


– attr_func: INTEGER, >0
– Focusable : BOOLEAN
– Enabled : BOOLEAN
– value - this field indicates whether the node is open or closed (1=open, 0=closed).
The default is 0. From within PDL2 program, it is allowed to handle a node
opening/closing, by modifying this value and updating the tree.
– Ev_mask: INTEGER - When the associated button is pressed, the tree issues an
event of vp2_action_performed type. The corresponding value (0=closed,
1=open) is passed as a data.
– callback : STRING[31].

8.3 Example of VP2.Tree creation


A section of Vp_all.pdl program (provided in the System Software CD) is now shown,
together with additional comments, in which the tree structure in Fig. 8.1 is created.

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

-- Root node coordinates on the Screen


ve_root.x := 30
ve_root.y := 30
ve_lbl_root.text := 'root' -- Label to be assigned to the root
ve_lbl_root.x := 0
ve_lbl_root.y := 0
ve_level_1_child_1.X:=0; ve_level_1_child_1.Y:=0;

-- First level of nodes


ve_lbl_level_1_child_1.text := 'level_1_child_1' ; ve_lbl_level_1_child_2.text :=
'level_1_child_2'

-- Second level of nodes


ve_lbl_level_2_child_1.text := 'level_2_child_1'; ve_lbl_level_2_child_2.text :=
'level_2_child_2'; ve_lbl_level_2_child_3.text := 'level_2_child_3'

-- Creation of the VP2 Tree


VP2_ADD(ve_screen, ve_root)
VP2_ADD(ve_root, ve_level_1_child_1, ve_level_1_child_2)
VP2_ADD(ve_level_1_child_1, ve_level_2_child_1, ve_level_2_child_2)
VP2_ADD(ve_level_1_child_2, ve_level_2_child_3)

-- Assigning Label objects to the VP2 Tree nodes (as an example)


VP2_ADD(ve_root, ve_lbl_root)
VP2_ADD(ve_level_1_child_1, ve_lbl_level_1_child_1)
VP2_ADD(ve_level_2_child_2, ve_lbl_level_2_child_2)
VP2_ADD(ve_level_2_child_1, ve_lbl_level_2_child_1)
VP2_ADD(ve_level_1_child_2, ve_lbl_level_1_child_2)
VP2_ADD(ve_level_2_child_3, ve_lbl_level_2_child_3)
....

8.4 Positioning a TreeNode onto its Container


The programmer must be aware that the Container on which the starting node (root) will
be placed must be big enough to be able to contain the whole tree. This implies that,
when the nodes are closed, the ones displayed outside the screen will not be cancelled.

8.5 Adding new nodes after initial add


To add new nodes to a VP2 Tree, just operate like for the other objects, by calling
VP2_ADD Procedure which adds the child node to the tree.

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).

8.6 TreeNode updating


When operating on a tree node (e.g. opening/closing a node), it is needed to update
(VP2_UPDATE Procedure) its Container viewing on which the node is placed. If such a
Container includes other VP2 objects, they will be updated as well.
To be more efficient, as far as the execution speed, pleace the treee (root) onto a
Container not including any other VP2 objects.

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. 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:

java -jar vp2frames.jar -f D:\vp2\vp_example.vpc


JAVA runtime must have already been installed on the PC, with a version greater than
1.13, downloadable from www.oracle.com site.
A connection must be established and maintained between the PC, where the VP2
pages are to be displayed, and the C5G Controller where the VP2 programs are run.
Entering VP2.Frames environment, perform the following operations:
– Configuring a VP2.Frames session
– Selecting the Screen to be displayed onto the VP2.Frame.

9.2 Configuring a VP2.Frames session


Entering VP2.Frames environment, the Configuration Page is displayed for the current
session.

Fig. 9.1 - Configuration Pages

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 -

General rule for using the above commands:


– Apply command applies the inserted modifications to the currently displayed
subpage (but NOT to the others!!)
– OK command makes operational the inserted modifications, not only for the
currently selected page, but for all subpages, and closes the dialog window
– Cancel command closes the dialog window deleting all the inserted modifications

WARNING: any modifications applied by means of the Apply command, cannot be


cancelled!

9.2.1 Session Page


A SESSION is identified by means of all the parameters defining the connection to the
Controller, such as the chosen Controller Unit IP_address/Username/Password.
The user must specify the required information and press either OK, Apply or Cancel
according to the described above criteria.

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.

Image cache path


In order to be more efficient, VP2 keeps a local copy of the image file used by the
Screen, instead of loading it from the Controller, each time such Screen must be
displayed.
Thus, a folder exists (image cache) on the target device (e.g. the local PC) representing
the “images memory”.
Such a folder is set to a default value, read from either the “TEMP” environment variable
of the PC or, if not found, as a "VP2_Image_Cache" folder in the current working folder.
The image cache path is then the search path for the local folder used as the Image
Cache for the current session Screens.

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)

file upon either the Save or Save As command.


– Automatically connect to controller - when selected, VP2 will automatically try
to connect to the Controller during all the time the session remains open. When
NOT selected, the attempt to connect will only performed when the user explicitly
asks it by means of the Connect command (see par. 9.4.3 Toolbar on page 144).
– Allow move of screens - when selected, a visible Screen of the current session
can be moved to an internal area of the page.
To do so:
• move the mouse cursor to the wished frame Title Bar,
• press the mouse left key (drag),
• drop the frame to the new position.

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.

This mechanism allows protecting against unauthorized modifications.

9.2.2 Screen Page


The Screen Page is used to add some Screens to the current session and configure
them. It is allowed to add whatever Screens, but the Screen Page just displays
information for one Screen at a time.
In order to specify which Screen is to be displayed, it has to be selected from within the
Screen menu (topmost menu in the subpage), identifying each Screen with its name and
search path, enclosed in square brackets (as shown in the following figure).

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.

Note that it is not needed to indicate the file extension (.COD).


– X, Y, Width, Height - these fields indicate the X and Y coordinates of the leftmost
corner in the frame displaying the Screen, as well as its height and width in pixels.
The coordinates indicate an absolute position on the device (e.g. a PC monitor)
where the VP2 Screen is displayed.
If Width and/or Height are set to -1, the width and/or height specified by the VP2
program will be used (vp2screen.w e vp2screen.h fields).
– Flags setting
• Automatically open screen - when selected, the connection to the
Controller will automatically activate the corresponding VP2 program onto the

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.

9.3 Selecting the Screen to be displayed onto the


VP2.Frame
At the end of the Configuration Session (see par. 9.2 Configuring a VP2.Frames session
on page 127), go on displaying the wished Screen.

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)

There are three available states, with three different colours:


– Red
– Orange
– Green
respectively, even though the status has a slightly different meaning depending on
whether added or made available Screen.

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.

9.3.1 Handling a Screen to be displayed onto the VP2.Frames


To create Screens to be displayed onto VP2.Frames, either VP2.Builder (optional
feature) can be used or a VP2 user program can be implemented to be displayed as a
VP2.Frame.

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.

9.3.1.1 Creating a Screen


In the following example, a modified version of the Screen object (vp2screen) is created
including just the 5 fields of vp2screen which are used by the program:

TYPE vp2screen_min = RECORD


x : INTEGER -- x position
y : INTEGER -- y position
w : INTEGER -- Width
h : INTEGER -- Height
name : STRING[15] -- Name
ENDRECORD

Let’s now declare a reduced version of the Screen:

VAR ve_screen : vp2screen_min

Such fields must be initialized as shown below:

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)

onto the target device.


After the fields initialization, the Screen is created by means of the
VP2_SCRN_CREATE Function.

vi_scrn_id := VP2_SCRN_CREATE(ve_screen)

9.3.1.2 Making a Screen available onto a physical device


There are two ways to display a VP2 Screen: calling either VP2_SCRN_ADD Procedure
or VP2_SCRN_AVAIL Procedure, depending on, respectively, the Screen is to be a
added onto a device, or made available.
This also apply to display it onto the VP2.Frames.

-- Check whether the ID of a physical device has been supplied as


-- a program calling parameter.
-- If so, add the Screen, otherwise make it available:
IF STR_LEN($PROG_ARG) > 0 THEN
DECODE ($PROG_ARG, vi_pdv)
VP2_SCRN_ADD(vi_pdv, vi_scrn_id)
ELSE
VP2_SCRN_AVAIL(vi_scrn_id,$SYS_PARAMS[61],'255.255.0.0')
ENDIF

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:

IF STR_LEN($PROG_ARG) > 0 THEN


DECODE ($PROG_ARG, vi_pdv)

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)

9.3.1.3 Positioning and dimensioning a Screen


X and Y coordinates, width and height dimensions, can be defined within the Screen
object by indicating its position within the frame.
If they are not set, the Screen is in 0,0 position, related to the frame, and its dimensions
are the ones of the frame, reduced by an offset to display some information (such as
title). If the frame's dimensions have not been previously set, then default values are
used which are the TP's values for width and height.
X, Y, W and H Screen values specify its position inside the frame, whereas X, Y, W and
H Screen values set in the Configuration Pages and 'host_x, host_y host_w host_h'
parameters of the Screen specify the position of the frame on the monitor. They can be
set by either the Screen Page of the Configuration Pages, or PDL2 program or inside
.vps file.

X/Y/W/H set by both


In this situation the Screen will be in the list of the ones displayed onto the VP2.Frame.
Data set by the Configuration Pages have priority over 'host_x, host_y, host_z e host_w'
values defined within the the program.

X/Y neither set within VP2 program nor in the ScreenPage


If X and Y are neither set by the VP2 program nor by the Screen Page of the
Configuration Pages, the Screen is placed at the next cascaded position, referred to the
already existing Screen.
If W and H are not set by Screen Page of the Configuration Pages, and host_w and
host_h of the VP2 program Screen are not set either, the width and height values related
to the TP are used.

Example of using vp2screen_vf


This example has been created by using vp_all, con il nuovo oggetto Screen
vp2screen_vf program, and shows the effects of using a different initialization of the
new property.

1. If the vp2screen_vf object fields are set to the following values:

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

both VP2.Frame and vp2screen_vf are properly displayed.

3. With the following Screen initialization:

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

the Vp2.Frame is displayed with the proper dimension and position.


The menu has not got the proper dimension: (x, y) property does not take effect on the
menu and it is displayed as it were not anchored to the Screen; the position is like the
one with (x,y)=(0,0). About 50 pixels are cut to the Screen, both as width and height.
4. With the following Screen initialization:

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.

5. With the following Screen initialization:

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

both the Screen and the Vp2.Frame are properly displayed.

9.4 User Interface


The purpose of the current section is to supply a list of the available commands in the
VP2.Frames User Interface, to help the user who just need to read either a single
command or a commands menu description.
– Title Bar
– Menu Bar
– Toolbar
as shown in the following picture.

pr-0-0-vp2_11.fm
08/0713 139
VP2.Frames (optional feature)

9.4.1 Title Bar


The Title Bar displays the name and the path of the currently open .VPC file. Such file
includes the configuration settings for the program use.
If the path is very long it will be truncated, and the missing characters will be indicated
by the "~" character, for example:

9.4.2 Menu Bar


– File
– Screens
– Tools
– View
– Help

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.3.1 Session Configuration


Opens the Configuration Pages. They are:
– Session Page allowing to configure the current session properties;
– Screen Page allowing to add and configure new Screens, for the current session.
For further details of how to use the Configuration Pages, see par. 9.2 Configuring a
VP2.Frames session on page 127.

9.4.2.3.2 Logging Options


This command allows the user to specify special messages types which will be logged
and, if wished, saved in a file (in addition to be displayed in the Log window).

9.4.2.3.3 Clear Image Cache


This command empties the Image Cache (i.e. the local folder containing copies of the
images required by the Screens).

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:

They are referred to the following commands:


– Connect / Disconnect
– Session Configuration
– Save

9.4.3.1 Connect / Disconnect

Allows either to Connect to the Controller (par. 9.4.2.1.5


Connect on page 142) or Disconnect from it.

pr-0-0-vp2_11.fm
144 08/0713
VP2.Frames (optional feature)

9.4.3.2 Session Configuration

This button executes Tools>SessionConfiguration command described


in par. 9.4.2.3.1 Session Configuration on page 143, bringing up the
Configuration Pages.

9.4.3.3 Save

This button executes File>Save command.


As already told for the Save command, note that the button is disabled
(greyed out) when there aren’t any changes to be saved, for the current
session.

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

9.5.1 Unable to connect to


When trying to connect an error message such as the following is shown:

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)

9.5.2 VP2.Frames not licensed


When trying to connect an error message such as the following is shown:

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.

9.5.3 Connection Lost


While connected to the Controller, the following dialog is suddenly displayed:

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.

9.5.4 Checksum is incorrect


When trying to open a vpc file, an error message such as the following is displayed:

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.

9.5.5 Warning Indicator on VP2 Frame


When displaying a VP2 Frame, the filename appears as a warning icon, i.e. a yellow
triangle:

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.

9.6 APPENDIX 2: sample program for VP2.Frames


Here follows a simple VP2 program, vp2_frames_ex1, which could be viewed onto the
VP2.Frames, including meaningful elements for real VP2 applications, such as VP2
objects, pipe and ability of reacting to preset events.
Such a VP2.Frame will be displayed as follows:

The source code is available here below:

PROGRAM vp2_frames_ex1 NOHOLD


-- Dichiara la versione modificata di vp2screen:
TYPE vp2screen_ex = RECORD
x : INTEGER -- x position
y : INTEGER -- y position
w : INTEGER -- Width
h : INTEGER -- Height
lun_name : STRING[32] -- Pipe name
c_path : STRING[127] -- search path
name : STRING[15] -- name displayed on the key
ENDRECORD
-- vp2label modified version declaration:
TYPE vp2label_ex = RECORD
x : INTEGER -- x position
y : INTEGER -- y position
w : INTEGER -- Width
h : INTEGER -- Height
text : STRING[127] -- text

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:

VAR vp2_update_later : INTEGER EXPORTED FROM vp2_lib -- Update later


VAR vp2_update_sweep : INTEGER EXPORTED FROM vp2_lib -- Clean all selected
-- VP2 objects
VAR vp2_on_released : INTEGER EXPORTED FROM vp2_lib

-- Library Routine to create a pipe


ROUTINE vp2_pipe_create(pipe : STRING) : INTEGER EXPORTED FROM vp2_lib

-- Library Routine to clean a pipe


ROUTINE vp2_pipe_flush(pipe : INTEGER) EXPORTED FROM vp2_lib
BEGIN

-- Initialize the screen:


ve_screen.x := 0
ve_screen.y := 0
ve_screen.w := 600
ve_screen.h := 440
ve_screen.lun_name := STR_CAT('pipe:', $PROG_NAME)
ve_screen.c_path := 'ftp://C5G/'
ve_screen.name := 'vp2_frames_ex1'

-- Initialize the label:


ve_label1.x := 10
ve_label1.y := 10
ve_label1.w := 150
ve_label1.h := 28
ve_label1.text := '0'

-- Initialize the button:


ve_button1.x := 180
ve_button1.y := 10
ve_button1.w := 150
ve_button1.h := 28
ve_button1.text := 'Increment'
ve_button1.id := ki_button1_id
ve_button1.ev_mask := vp2_on_released

-- Create the screen:


vi_scrn_id := VP2_SCRN_CREATE(ve_screen)
-- Add label and button to the screen:
VP2_ADD(ve_screen, ve_label1, ve_button1)

pr-0-0-vp2_11.fm
148 08/0713
VP2.Frames (optional feature)

-- Create the pipe


vi_pipe := vp2_pipe_create($PROG_NAME)
-- Clean the pipe
vp2_pipe_flush(vi_pipe)

-- Check whether the ID of a physical device has been supplied as a program


-- calling parameter. If so, add the Screen, otherwise make it available

IF STR_LEN($PROG_ARG) > 0 THEN


DECODE ($PROG_ARG, vi_pdv)
VP2_SCRN_ADD(vi_pdv, vi_scrn_id)
ELSE
VP2_SCRN_AVAIL(vi_scrn_id, $BOARD_DATA[1].SYS_PARAMS[61], '255.255.0.0')
ENDIF

-- reset the counter:


vi_cnt := 0

CYCLE

-- Continuously read the pipe:


REPEAT
READ vi_pipe (vi_id, vi_code, vs_data)
UNTIL $FL_STS = 0

-- Echoe the code onto the lun:


WRITE LUN_CRT ('CODE: ', vi_code, NL)
-- Events handling:
SELECT vi_id OF

CASE (ki_button1_id): -- Event coming from ve_button1


IF (vi_code = vp2_on_released) THEN -- Event is ve_button1 released
vi_cnt += 1 -- increment counter
ENCODE (ve_label1.text, vi_cnt)
VP2_UPDATE(ve_label1, vp2_update_later)
ENDIF

ELSE:

ENDSELECT

-- Perform an update_sweep operation to update any objects


-- which is currently marked for being updated later
-- (ad es. ve_label1 se è stato modificato):
VP2_UPDATE(ve_screen, vp2_update_sweep)

END vp2_frames_ex1

pr-0-0-vp2_11.fm
08/0713 149
VP2.Builder (optional feature)

10. 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.

Detailed description is supplied about the following topics:


– Installation
– Start Page
– New Program Page
– Edit Page
– Edit Mode
– Structure of a PDL2 program developed with Vp2.Builder
– Example of using VP2.Builder.

10.2 Installation
To install VP2.Builder it is needed to:

a. switch to the UD:\inst Controller directory

b. copy vp2binstall.zip compressed file to UD:\inst directory

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.

e. Select VP2.Builder (vp2b) program from the Screens menu

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.

10.2.1 Errors at VP2.Builder startup


A list of some errors follow which could occur at the VP2.Builder startup:
– VP2.Builder Init failure: VP2B.VAR not loaded. Indicates there is a problem
related to vp2b.zip.
– VP2.Builder Init failure: VP2.Builder not licensed. VP2.Builder is subject to a
licence. This message indicates that the Controller on which it is supposed to be
run, has not got the license for VP2.Builder use. Please contact COMAU
(service.robotics@comau.com) to purchase such a license.
– VP2.Builder Init failure: Invalid controller version. This message indicates that
the System Software version does no comply with the Vp2.Builder version. Be
sure to use the same software version, both Controller side and Vp2.Builder side.

10.3 Start Page


When VP2.Builder is started, the Start Page is displayed (see Fig. 10.1).

pr-0-0-vp2_14.fm
00/1014 151
VP2.Builder (optional feature)

Fig. 10.1 - VP2.Builder - Start Page

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.

10.4 New Program Page


The New Program page, displayed when the user clicks the New (3) button (see
Fig. 10.1) contains fields to allow data about the new program to be entered.
Referred to Fig. 10.2, such fields are:
– Author (1) - it is the program author. The default is the currently logged in user,
on the Controller.
– VP2 Program (2) - it is the name of the being created VP2 program.

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).

Fig. 10.2 - New Program Page

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)

10.5 Edit Page


The Edit Page consists of a Tabpane with five tabs that let the user view and edit various
different aspects of the program being worked on.
The Bottom Menu contains six context keys, all available on each subpage.
– Add (F1) - if short pressed, it adds the currently selected Type to the currently
selected Container (see par. 10.5.0.1 Components subpage on page 154).
If long pressed, it does not add the Type to the Buildee, but instead it moves the
focus to the Component name field. This allows users who are using VP2.Builder
without a mouse (i.e. on the Teach Pendant) to edit the Component name and
check which Container the Components are added to.
– Delete (F2) - it deletes the currently selected Components from the Screen (see
par. 10.5.1 Properties subpage on page 155). If short pressed, the Component is
deleted both from memory and from the program hierarchy. If long pressed, the
Component is only deleted from the program hierarchy. This is to allow
programmers to visually edit a Component properties, then remove it so that the
Component can be added by the program, calling.VP2_ADD Procedure.
– Edit/Run (F3) - it toggles the Buildee between Edit and Run mode and viceversa
(see par. 10.5.2 Hierarchy subpage on page 156).
– Restart (F4). it deactivates and restarts the Buildee. If modified, the user will be
prompted to save the Buildee before restarting it.
– Save (F5) - save the .vps of the Buildee.
– Close (F6). Returns to the Start Page so that a new program may be selected or
created. This does not deactivate the Buildee, and the user will be prompted to
save the program if it has been modified.

10.5.0.1 Components subpage

Fig. 10.3 - Components subpage

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.

10.5.1 Properties subpage


Fig. 10.4 - Properties subpage

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.

10.5.2 Hierarchy subpage


Fig. 10.5 - Hierarchy subpage

The Hierarchy subpage is a visual representation of the Component hierarchy of the


Buildee as a tree. The tree Nodes can be opened and closed but the hierarchy CANNOT
be edited from this page.

pr-0-0-vp2_14.fm
156 00/1014
VP2.Builder (optional feature)

10.5.3 Events subpage


Fig. 10.6 - Events subpage

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)

10.5.4 Program subpage


Fig. 10.7 - Program subpage

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

10.6 Edit Mode

Fig. 10.8 - The Buildee in Edit Mode

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.

10.6.1 Edit mode program appearance


There are some differences between the way a VP2 program is displayed in Edit Mode
and the way it is displayed in Run Mode:
– VP2 Containers display a grid to allow Components to be accurately laid out by the
user
– VP2 Components are outlined in red
– the focus highlight colour is green.

10.6.2 Editing Components


It is allowed to edit both the size and location, by means of either the mouse or the
keyboard.

10.6.3 Using the mouse


– To edit a Component size, move the mouse near one of either one of the edges or
of the corners of the Component. The mouse cursor will change to the resize cursor
(double-headed arrow). Click and drag the mouse to edit the Component size.
– To move a Component, move the mouse to the middle of the Component, so that
the cursor is displayed as normal. Click and drag to move the Component towards
the new location.

10.6.4 Using the keyboard


To edit Components using the keyboard, it must first be focused. This is accomplished
in the same way as in Run Mode; use the arrow keys until the Component is reached
and then press ENTER to confirm. The highlight will change colour to indicate that the
wished Component is now focused.
Then it is needed:
– to use arrow keys to move the Component . Each pressure of the arrow key will
move it 1 pixel in the direction indicated by the key. If the SHIFT key is also
pressed, each pressure of the arrow key will move it 10 pixels in the chosen
direction;
– to use page up and down keys to edit the Component size. Page up moves the
bottom border up (decreasing theComponent height) and page down moves the
border down (increasing the Component height).

pr-0-0-vp2_14.fm
00/1014 159
VP2.Builder (optional feature)

Shift+PageUp/PageDown resizes the Component width by moving the right-hand


border to the right and left respectively.
When the wished modifications have been made, push ENTER key to confirm or the
ESC key to cancel the modifications.

10.7 Structure of a PDL2 program developed with


Vp2.Builder
All programs created in VP2.Builder environment, basically have the same structure.
They are composed by a .cod file (containing main and routines to be executed during
the program life), by a .vps file (containing all the created VP2 objects), by a .lst file
(containing the callback functions skeleton, to be edited and then copied inside the
program code). This last file purpose is just to be able to copy, to the .cod file, the
definitions of the added callbacks of the objects created by the VP2.Builder.
The user must decide first, whether develop his program in the Vp2. Builder
environment or not: it allows creating some well organized definitions over some files
with a well defined mutual and hyerarchical relationship.
From within the Vp2. Builder environment it is only allowed to edit programs which have
been created in it and keep the predefined initial structure.
Note that it is very important to save the Buildee before deactivating it, in order to store
the Components hierarchy in the .vps file which would just remain in the execution
memory and would not be created again in a further activation (which reads from .vps
file), thus preventing from displaying it on the screen.

10.7.1 Callback to handle events related to the Components


The viewing VP2 software communicates events to the PDL2 program by writing the ID
of the Component which caused the event, the event code and all the associated data,
into the PIPE.
In the basic use version, a VP2 program is composed by a SELECT structure, following
the pipe reading CYCLE, which detects the needed action to be performed upon an
occurring event on a Component.
Developing a VP2 program in VP2.Builder environment, it is convenient instead, to
associate a function called callback to the Component, in order to handle the event
related to such a Component.
Using a callback means to have declared a routine representing the callback itself, in
the callback : STRING[31] field of the Component.
The callback will be executed, called by VP2_VB_MAIN Function of VP2_LIB, as soon
as the Component causes the event.
A callback function must:
– be EXPORTED FROM the Buildee;
– have two INTEGER parameters and one STRING parameter

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.

When called, the passed parameter is


– the ID of the Component which caused the event,
– the event code and
– all the associated data, depending on the object.
The callback functions must be manually written by the programmer (by directly
modifying the .cod file of the Buildee) and must specify all the actions to be performed
upon the event on such an object.

10.7.1.1 Variables declaration


Programs developed with the Builder model don’t include all the created VP2 objects
declarations, because such objects and their position inside the hierarchy are stored in
the .vps file.
If the PDL2 programmer would like to use one of such variables in a statement (in either
the main body or a routine), the variable should be declared in the program declaration
section (VAR <var_name>: <var_type>).
To make everything easier, .lst file of the callbacks also includes the variable
declarations (as comments) for the VP2 objects belonging to the Buildee, in order to be
able to copy-and-paste them and reference them.

10.8 Example of using VP2.Builder


It is available a DEMO providing some examples about how to use VP2.Builder.

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.

11.1 The program is running but nothing is displayed


on the Screen
Usually a VP2 program uses a CYCLE statement to implement the loop which detects
any events.
If the program has not got any Component interacting with the user, add a PAUSE
statement after the Screen creation and before the program END statement.

11.2 A Component is not displayed, having just X and Y


defined
Each Component provided with x/y/w/h must have them all initialized; if the Component
must inherit them from its parent, the programmer should explicitly specify -1.
Be especially careful to the Screen fields, in case they are not initialized, because no
other Components would be displayed.

11.3 Impossible to trap events for a specified


Component
Properly set the ev_mask attribute, including either the wished event or all events (-1).

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.

11.4 Some Components cannot be seen on the Screen


VP2 Components can just be added to Screen, Pane and Tabsheet type objects. If they
are added to Tabpane type objects, they are not displayed.
Also check the visible attribute is not set to FALSE.

11.5 Error 1244 is detected (uninitialized Variable)


VP2_LIB has not been included in the VP2 program source code.

11.6 Error 11298 is detected (Pipe full)


The communication pipe between VP2 and PDL2 program is full.
When this situation occurs
– activate the program again
– enable debug to check which are the detected problems
– display the value of the variable related to the pipe read
– be sure to have initialized all the elements
– be sure to have set the events monitoring, by means of the ev_xx fields, just for
the wished Components and not for all of them (value -1) without exception
– check that the fields related to the events monitoring (ev_mask) of the
Components, is set to just monitor the wished events (ev_mask field set to -1
means to monitor all the existing events for such a Component)
– use carefully VP2_UPDATE Procedure, avoiding to update whole Containers
when it would be possible just to update the modified Components
(vp2_update_later + vp2_update_sweep instead of vp2_update_all)
– if necessary, use a wider pipe. By default, the PIPE is 512 bytes. The message
length also depends on the Component name length.
For example, this is a typical message:
• 2 bytes for the ID
• 2 bytes for the EVENT
It is needed to decrease the total amount of messages for each event.
The OVERRIDE VP2 page is programmed to receive many events every time a
softkey is released:
• PRESSED
• ACTION PERFORMED
• RELEASED
so, for each short pressure of either "OVERRIDE+" or "OVERRIDE-" key, three
messages are sent along the PIPE. The user can modify the ev_mask setting for

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).

11.7 How to know whether a Screen or a Pane are


displayed or not
To do it, use vp2_on_visible, vp2_on_hidden events.
Using a callback on the Component, it will detect such events and will understand, by
means of the visible field, whether the Component is visible or hidden.
This information is useful to avoid any update operations (calling VP2_UPDATE
Procedure) on hidden objects, then optimizing the interface performance.

Example
VAR ve_screen : vp2screen NOSAVE -- Screen Container
VAR ve_pane: vp2pane NOSAVE -- Pane Container

-- Callback associated to the Screen


ROUTINE ru_Screen(ai_id, ai_event : INTEGER; as_data : STRING)
EXPORTED FROM myprog
ROUTINE ru_Screen(ai_id, ai_event : INTEGER; as_data : STRING)
BEGIN
IF (ai_event = vp2_on_visible) THEN
-- check which Pane (if more than one) is visible
-- on the Screen, by means of its ‘visible’ field
WRITE lun_crt ('SCREEN is visible',NL)
ELSE
WRITE lun_crt ('SCREEN is hidden',NL)
ENDIF
END ru_Screen

--Callback associated to the Pane


ROUTINE ru_Pane(ai_id, ai_event : INTEGER; as_data : STRING)
EXPORTED FROM myprog
ROUTINE ru_Pane(ai_id, ai_event : INTEGER; as_data : STRING)
BEGIN
WRITE LUN_CRT ('ai_id = ', ai_id, ' ai_event = ', ai_event, '
as_data = ', as_data, NL)
IF (ai_event = vp2_on_visible) THEN
WRITE lun_crt('pane is visible',NL)
ELSE
WRITE lun_crt ('pane is hidden',NL)
ENDIF
END ru_Pane

--Main program initializations


ve_screen.callback :='ru_Screen'
ve_pane.callback :='ru_Pane'

ve_screen.ev_mask := vp2_on_visible OR vp2_on_hidden


ve_pane.ev_mask := vp2_on_visible OR vp2_on_hidden

pr-0-0-vp2_09.fm
164 00/1014
Troubleshooting

11.8 DPRO Timeout


In some special situations of TP overload, the DPRO timeout error could occur. This
error means that, in fact, the TP is requested to do “too much”. Execute an
ERR_TRAP_ON(40089) and check for the associated 10880 error.

11.9 VP2 application page is locked


This could happen when a VP2 page attempts to update some fields and the TP is not
connected.
It could happen in DPRO Timeout situations, but also in usual situations: wireless TP
unpairing, power failure, etc.
It is needed to handle such errors at the application level, by using the
ERR_TRAP_ON (40089) and checking the associated error.
In fact the VP2 page should never take the TP is always connected for granted.

11.10 Error 40103 is detected (CALL/CALLS failed)


This error depends on how callback routines are declared in the main program.
The EXPORTED FROM clause and/or the expected predefined parameters definition
could be missing.

11.11 Paging on a wider table on the TP screen


In a table, paging downwards moves the cursor at the table end, and no longer displays
it.
The table can be no matter how big, but the Pane including it CANNOT be bigger
(neither wide, nor high) than the available space on the TP.
If it is difficult to calculate the Pane dimensions, it is suggested to set h and w fields to
-1, so that the VP2 will take care of computing them.

11.12 Vertical scrollbar not updated on the table


In the case in which, scrolling along the table by means of either the down arrow key or
the PAGE key would not update the vertical scrollbar, check the Pane height.
If it is difficult to calculate the Pane dimensions, it is suggested to set h and w fields to
-1, so that the VP2 will take care of computing them.

pr-0-0-vp2_09.fm
00/1014 165
Appendix - Form Attributes, Function Attributes, Events

12. APPENDIX - FORM ATTRIBUTES, FUNCTION


ATTRIBUTES, EVENTS
– Format attributes (attr_form)
– Functional attributes (attr_func)
– Events.

pr-0-0-vp2_10.fm
166 00/1014
Appendix - Form Attributes, Function Attributes, Events

12.1 Format attributes (attr_form)


– vp2_notcomaulnf
disables Comau style (default style). In case of Tabpane, if this attribute is
selected, it is allowed to set the character size for its label.
– vp2_bstyle1..vp2_bstyle4
border style: 1..4
– 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, vp2_b_reset, vp2_b_true, vp2_b_false,
vp2_b_on, vp2_b_off, vp2_b_none
message bar - OK, Cancel, Yes, No, Abort, etc. keys
– vp2_sev_info, vp2_sev_warn, vp2_sev_err
message bar - informational, warning or error severity type
– vp2_show_row_name
VP2 tables - enables viewing the row name
– vp2_add_coldefs_as_rows
VP2 tables - enables viewing the column as a row of data
– vp2_always_display_as_column
VP2 tables - enables viewing as column, even if vp2_add_coldefs_as_rows
attribute has been previously specified
– vp2_transpose
VP2 tables - enables viewing as a transpose
– vp2_hide_grid
VP2 tables - disables viewing the grid
– vp2_hide_title
VP2 tables - disables viewing the title bar
– vp2_hide_column_headers
VP2 tables - disables viewing columns header
– vp2_haleft, vp2_haright, vp2_hacenter
horizontally align text, on the left, right or centre
– vp2_vatop, vp2_vacenter, vp2_vabot
vertically align text up, down or centre
– vp2_fill
fill the outline with the background color (b_color)
– vp2_text_left
insert the description text on the left
– vp2_3dlook
3-dimensional look object
– vp2_nofill
don’t fill the outline with the background color (b_color)
– vp2_mark_sel
fill the checkbox or the radio button, with the expected color for either ‘selected’
(s_color) or ‘unselected’ (u_color)
– vp2_square

pr-0-0-vp2_10.fm
00/1014 167
Appendix - Form Attributes, Function Attributes, Events

square form checkbox


– vp2_symbol_spot, vp2_symbol_cross, vp2_symbol_check, vp2_symbol_prop
checkbox selection symbol: dot, cross, tick
– vp2_showscrnm
enable viewing the Screen name in the page topmost right corner
– vp2_noimagescroll
Pane - disable the background image scrolling
– vp2_multiline
allow new line in the displayed text
– vp2_useicon
enable displaying an icon in the message bar.

12.1.1 Form attributes applicability to VP2 objects


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

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

12.2 Functional attributes (attr_func)


– vp2_mode_ovr
enables/disables overwriting in a text field (toggle)
– vp2_presel
enables pre-selection mode
– vp2_exclusive
exclusive Checkgroup
– vp2_typnrm, vp2_typlngpr, vp2_typterm
menu type: normal pressure (F1..F6 keys), long pressure, terminal menu item
(there is not an associated submenu to such an item)
– vp2_scrlhor, vp2_scrlver
enables either the horizontal or the vertical scrollbar
– vp2_noautoup
disables automatic update for the VP2 object
– vp2_noremove
disables automatic remove for the Message bar, upon the key pressure. It is up to
the user to handle the ‘show’ field
– vp2_shownmid, vp2_showdim, vp2_showinf
displays information about the VP2 object (name and id, dimensions, version, etc.)
– vp2_dp_0, vp2_dp_1, vp2_dp_2, vp2_dp_3, vp2_dp_4, vp2_dp_5, vp2_dp_6
total amount of decimal digits (integer from 1 to 7) to view a REAL value in a
spindial

NOTE about the effect of using vp2_dp_x, on a DataLink.


If a DataLink is monitoring a REAL type value, to update a STRING type value, the
“dp = decimal places” are used to determine how the REAL value will be formatted,
while converting into STRING.

– 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.

12.2.1 Functional attributes applicability to VP2 objects


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

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

12.3.1 Events applicability to VP2 objects

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

You might also like