Software Customisation Guide

Form Concepts: Getting Started : Revisiting our Simple Form
Our simple form !!Hello, which the user has constructed earlier in this section, is not very intelligent. Once the user has clicked the Change button the .Message paragraph will read ‘Modified’ for ever more, even if the user hides the form and re-shows it.
First save the definition in a file called hello.pmlfrm and make sure that its directory is in the users PMLLIB search-path.
Figure 13:3.
title sets the formtitle member and hence displays a title;
para adds a PARAGRAPH gadget size 15 chars by 1 line with no content;
text adds a TEXT field gadget with tag ‘Enter message’, width 15 chars, to hold data of type STRING.
The constructor method .hello() does the following:
sets the form member Okcall (in the line beginning !this.Okcall). This is a callback that gets executed when a button with control-type OK is pressed.
The definition of method .success() does the following:
This will auto-load the form definition and execute the default constructor method (which will set the message paragraph to ‘Hello world’ and define the gadget and form callbacks). It will also display the form.
Type a message into the Enter message field and press the Enter key. This will execute the field’s callback, which will write the typed text into the message paragraph.
Type a new message and press Enter. The paragraph updates to reflect what the user has typed.
Click the Goodbye button. This executes the form’s Okcall action which calls the success() method. The success() method sets the paragraph to ‘Hello again’ and blanks out the text field. Finally, the OK control action hides the form.
Show the form again and observe that the paragraph reads ‘Hello again’ and not ‘Hello world’. This demonstrates that when the user re-shows the form the form’s constructor is not run, because the form is already loaded.

1974 to current year. AVEVA Solutions Limited and its subsidiaries. All rights reserved.
AVEVA Logo