This example shows how to make a form that has text fields which display input from a user.
Making the form's user interface
Begin by creating an application, adding a visual part to it, and opening a Composition Editor on the visual part. Then, in the Composition Editor, create the form:
Next, add one
(Text part) and one
(Multi-line Edit part). Both of these are in
(Data Entry category). Arrange the parts so the form looks like the
following:
Adding actions
So other parts can display data in the text fields, add scripts that provide a public interface for the text fields:
setName:
Then, select Add with defaults.
setAddress:
Defining code for the actions
Now, select
to go to the Script Editor. In the Script
Editor, change the scripts generated so they set values for the text
fields:
setName: parm1 "Perform the setName: action." (self subpartNamed: 'Text1') object: parm1
Repeat the previous steps for setAddress, only paste the setter for the object attribute of the Multi-line Edit subpart. After you change the code, it resembles:
setAddress: parm1 "Perform the setAddress: action." (self subpartNamed: 'Multi-line Edit1') object: parm1
Finally, save the part. You can now use the form in other applications.