Aveva Pdms PML Basic Guide Forms Menus Romeldhagzgmailcom PDF
Aveva Pdms PML Basic Guide Forms Menus Romeldhagzgmailcom PDF
Aveva Pdms PML Basic Guide Forms Menus Romeldhagzgmailcom PDF
Menus
notation
Example:
!!MyForm.Textfield
Form name
Form member
notation
Example:
!!MyForm.Textfield.Val
Gadget as a member
Member variable
Format:
!!MyForm
!!MyForm.GadgetName
!!MyForm.GadgetName.Val
Forms
Syntax:
setup form !!formname
exit
Example:
setup form !!hello
paragraph .Message text Hello world
button .Bye Goodbye OK
exit
Message is the name of the gadget and the dot(.) indicates that the gadget is a
member of the form
button command adds a button gadget named .Bye. The text on the button will
be Goodbye
The keyword OK is a form control attribute that specifies that the action of this button is to
remove the form from the screen
Form Attributes
Form Types:
MAIN
DOCUMENT
DIALOG
BLOCKINGDIALOG
Examples:
setup
setup
setup
setup
setup
setup
setup
form
form
form
form
form
form
form
!!MyForm
!!MyForm
!!MyForm
!!MyForm
!!MyForm
!!MyForm
!!MyForm
Form Attributes
The
exit
Or
setup form !!MyForm
exit
INITCALL !this.init()
exit
Or
setup form !!MyForm
!!Myform.InitCall = !this.init()
exit
OKCALL !this.approveData1()
exit
CANCELCALL !this.cancelForm1()
exit
QUITCALL !this.quitForm1()
exit
APPLY
CANCEL
RESET
HELP
Examples:
button .Ok OK callback !!MyOKFunction OK
button .Apply Apply callback $
!!MyApplyFunction APPLY
button .Cancel Cancel callback $
!!MyCancelFunction CANCEL
button .Reset Reset RESET
button .Help Help HELP
A Simple Form
Example (simpleForm.pmlfrm):
setup form !!simpleForm
title 'My Form'
icontitle 'Myform'
paragraph .message text 'Hello world!'
button .bye 'Goodbye' ok
exit
Each method begins with define method and ends with endmethod
Loading a form:
loadform !!formname
Removing
a form definition:
kill !!formname
To show a form:
!!MyForm.Show()
!!MyForm.Show(FREE)
!!MyForm.Show(At,0.3,0.5)
$* automatically FREE
To hide a form:
!!MyForm.Hide()
endif
These are variables which can be any of the PML data types,
including ARRAYS and OBJECTS
setup form !!MyForm
exit
The value of a form member can be set and used in just the
same way as an object member
!this.MyNumber = 42
!this.MyString = Gadz
!Num = !this.MyNumber
Form Gadgets
Callbacks
a form
Execute a command directly
Run a function or method
Callbacks
Example:
setup form !!MyForm
paragraph .Message text Hello world
button .Change Change Message callback $
|!this.Message.Val = Modified|
button .Bye Goodbye OK
exit
a gadget callback is defined by the callback command followed by a
command or PML functions enclosed in text delimiters
for defining complicated callback, it is recommended to use a form
method
Callback Example
exit
exit
Callback Example
exit
or
setup form !!MyForm
exit
Example:
setup form !!MyForm
title Display Your Message
paragraph .Message width 15 height 1
text .Capture Enter message: width 15 is STRING
button .Bye Goodbye OK
exit
define method .MyForm()
$* default constructor set gadget default values
!this.Message.Val = Hello world!
!this.Capture.Callback = !this.Message.Val = !this.Capture.Val
!this.OKcall = !this.Success()
endmethod
define method .Success()
!this.Message.Val = Hello again!
!this.Capture.Val =
endmethod
Example:
define method .Success(!output is GADGET, !input is GADGET)
!output.Val = Hello again!
!input.SetFocus()
endmethod
define method .setGadget(!output is GADGET) is BOOLEAN
!output.Val = Gadget initialized!
handle any
return FALSE
endhandle
return TRUE
endmethod
Example:
Open Callback:
endfunction
Types of Gadgets:
FRAME
PARAGRAPH
BUTTON
TOGGLE
RGROUP
OPTION
LIST
DATABASE SELECTOR
TEXT
TEXTPANE
VIEW
SLIDER
RTOGGLE
exit
Format:
type
name
{common prop.}
{specific prop.}
Example:
list
.List1
at X Y
Common properties:
position
tag
tooltip
callback
anchor
docking
width 10 lines 3
Example:
exit
frame .fr2 Frame 2 at xmin ymin width.fr1 height 15
exit
!this.but1.AddPixmap(C:\pic.png)
Gadget Members
Visible
Active
Callback
Tag
!!MyForm.List1.Visible = FALSE
!!MyForm.List1.Visible = TRUE
$* Invisible
$* Visible
$* De-activate
$* Activate
Gadget Members
Frame Gadgets
Frame Definition:
frame .MyFrame at x0 y3 My Frame
exit
Frame Size:
exit
Tabset Frames
Frame Definition:
exit
frame .Tab2 Tab 2
exit
exit
Paragraph Gadgets
Button Gadgets
Toggle Gadgets
Using Pixmap:
toggle .GridOn pixmap /C:\gridon.png callback
!this.enableGrid()
RGroup Gadgets
Example:
rgroup
add
add
add
exit
endif
RToggle Gadgets
Option Gadgets
Example:
option .Circle Circles at callback !!MyFunc() pixmap
width 256 height 128
!CircleDtext[1] = C:\circle1.png
!CircleDtext[2] = C:\circle2.png
!CircleRtext[1] = Circle 1
!CircleRtext[2] = Circle 2
!this.Circle.Dtext = !CircleDtext
!this.Circle.Rtext = !CircleRtext
Option Gadgets
!!MyForm.Colour.Select(Dtext,Color Black)
!!MyForm.Colour.Select(Rtext,Black)
!!MyForm.Circle.Select(Dtext,C:\circle1.png)
Reading
!Selected = !this.Colour.Selection()
!Selected = !this.Colour.Selection(Dtext)
!Selected = !this.Colour.Selection(Rtext)
Slider Gadgets
Responds
events
List Gadgets
List Gadgets
Form Exercise 1
Form Exercise 1
Use the functions you created in the previous exercises 3 & 4
found in Part 1.
Handle invalid input (0 and string). Input should be a REAL
object.
Define a constructor method.
Oriented - SETCOLUMNS()
=
=
=
=
Flange_B1
Elbow_B2
Type is Flange
Type is Elbow
!rtext[1] = =156/256
!rtext[2] = =157/257
!this.Components.SetHeadings(!head)
!this.Components.SetColumns(!col)
!this.Components.Rtext = !rtext
Oriented - SETROWS()
=
=
=
=
Flange_B1
Type is Flange
Elbow_B2
Type is Elbow
!rtext[1] = =156/256
!rtext[2] = =157/257
!this.Components.SetHeadings(!head)
!this.Components.SetRows(!row)
!this.Components.Rtext = !rtext
a mechanism for
displaying the current database
element along with its owner
and members
User can interact with a selector
to change the current element
selector
selector
selector
selector
selector
.Sel
.Sel
.Sel
.Sel
.Sel
keyword is mandatory
OWNERS and MEMBERS are optional
AUTO and MULTIPLE cannot be used together
To get and set values for a selector:
!element = !this.Sel.Selection()
RTEXT
Text Gadgets
Text Gadgets
Example:
!!MyForm.Txt1.ValidateCall = !this.Validate()
VALIDATECALL
Textpane Gadgets
Setting contents:
!Lines[1] = Hello World
!Lines[2] =
!Lines[3] =
!Lines[4] = Goodbye World
!this.Txt.Val = !Lines
To a LIST gadget:
do !field list !!FormA.ListA
enddo
To a SELECTOR gadget:
do !field selector !!FormA.SelectorA
enddo
To a TEXTPANE gadget:
do !line pane !!FormA.TextpaneA
enddo
View Gadgets
ALPHA
PLOT
2D Graphical Views
3D Graphical Views
View Gadgets
View Gadgets
exit
To define the content of the plot view, specify the PLOTFILE path with
the Add() method
View Gadgets
put CE
put /SITE/SHEET
Example:
view .Drawing at AREA
height 10 width 20
put /MDS-ABA-3-VIEWS(METRIC)-PS00001-AREA
limits 200 100 to 600 500
exit
!this.Drawing.Background = beige
View Gadgets
Example:
view .Pid at COMPARE
height 20 width 40
put /SHEET
cursortype pointer
exit
!this.Pid.Background = darkslate
View Gadgets
exit
define method .MyForm()
!this.Model.Borders = false
!this.Model.Shaded = true
endmethod
Full list of members and methods is found in VANTAGE Plant Design Software
Customisation Reference Manual
Form Layout
Form Layout
Complex Form Layout
Gadget Positioning
left
0
1
2
3
4
5
6
7
8
9
0 1 2 3 4 5 6 7 8 9
Gadget Auto-Placement
Gadget Auto-Placement
Example:
button .But1
PATH DOWN
$* default placement
.But1
HALIGN CENTRE
VDIST 4.0
para .Par2 width 4 height 2
toggle .Tog3
.Par5
$* auto-placed
$* auto-placed
.Par2
PATH RIGHT
HDIST 6.0
VALIGN BOTTOM
list .Lis4 width 5 height 4
$* auto-placed
PATH UP
HALIGN RIGHT
para .Par5 width 6 height 5
$* auto-placed
.Tog3
.Lis4
YMIN
XMAX
YMAX
XMAX
YMAX
XMIN
YMIN
gadget
0 1 2 3 4 5 6 7 8 9
X
previously created gadget used as
reference
YMAX
.Msg
YMAX + 2
XMIN
0 1 2 3 4 5 6 7 8 9
.Para
YMAX.Para
.Frm
YMAX.Para+5
.Msg
Y
new paragraph gadget
XMIN.Para-5
Example:
Example:
toggle .OnOff at 4 3.5
toggle .OnOff at x 4 y 3.5
0
1
2
3
4
5
6
7
8
9
0 1 2 3 4 5 6 7 8 9
Note: Absolute positioning is not recommended way to define your gadget positions,
use relative positioning
These
ANCHOR Attribute:
Allows
forms:
For
gadgets:
applicable to gadgets
Menus
menu
Popup menu
Execute
a callback
Display a form
Display a sub-menu
Example of a complete
menu definition:
-- Menu1 definition
!menu1 = !this.newMenu('MENU1,Main)
!menu1.Add('CALLBACK',Query Elbows',!!queryElbows())
!menu1.Add('SEPARATOR')
!menu1.Add('MENU','Pull-right','PULLR')
-- PULLR menu definition
!pullr = !this.newMenu('PULLR,Main)
!pullr.Add(CALLBACK,Menu 1,show !!MyForm)
!pullr.Add(FORM',Gadz Menu','gdzMainForm')
General Syntax:
!menu.Add(<Fieldtype>,<Dtext>,<Rtext>, {<Fieldname>})
<Fieldtype>
<Dtext>
Display text
<Rtext>
CALLBACK
TOGGLE
MENU
FORM
<Fieldname>
callback string
callback string
menu name string (cannot be blank)
form name string without !! (cannot be blank)
Popup Menus
Popup Menus
Another Way:
button .But1 'A Button' at
!popit = !this.newMenu(POPIT,Popup)
!popit.Add(TOGGLE,Active/Inactive,!this.Control()
!this.But1.SetPopup(!popit)
Toggle Menus
A menu field with a callback action and a tick-box to show that the
field has been selected or unselected
Example:
setup form !!Myform Dialog size 30 5
!menu = !this.newMenu(Test,popup)
!menu.add(TOGGLE',Active/Inactive,'!this.toggle(,'OnOff')
exit
define method .toggle(!menu is MENU, !action is STRING )
!name = !menu.Fullname()
!field = !menu.PickedFieldName
$P menu $!name $!action field: $!field
endmethod
ALERT Objects
Alerts are always blocking: they prevent interaction with any other form until
they have been actioned
Examples:
!!Alert.Error(You cannot do this!)
!!Alert.Message(Saving your data now)
!!Alert.Warning(Do not press this button again!)
!answer = !!Alert.Confirm(Are you sure?)
!answer = !!Alert.Question(OK to delete component?)
ALERT Objects
INPUT Alerts
allows the user to obtain textual input from the operator via a
blocking alert which overrides all other interactive activities.
The alert can be summoned by the alert methods:
!!Alert.Input( !prompt is STRING, !default is STRING) is STRING
Examples:
!!Alert.Error(You cannot do this!)
!!Alert.Message(Saving your data now)
!!Alert.Warning(Do not press this button again!)
!answer = !!Alert.Confirm(Are you sure?)
!answer = !!Alert.Question(OK to delete component?)
Form Exercise 2
When stretched;
Form Exercise 2
The Choose Template list gadget:
The list only shows the name and the description of the template
Upon choosing each item on the list;
The plot file will change based on the plot file defined in the option file
The tag of the frame in the parameters frame will also change base on the name
Example (If the selected templates required arguments are only 2, then parameter field 3 will be
disabled and parameter 1 and 2 will be enabled. Same concepts apply to all.)
Form Exercise 2
The Create button:
If successful to all checking, create the equipment and revert the forms
mode to initialization mode.
Form as initialized:
This means, the plot file, parameter frame tag and enabled/disabled
parameter fields are also based on the default item selected
Supplied files:
The option file, plot files, and macro files will be supplied.
It is delivered together with this manual under Form Exercise 2 folder