Advanced
Lesson 1: Creating Forms with the XFT Form Layout Tool
XFT
Forms
Although you
have a lot of control over the appearance and behavior of XMetaL Author using
CSS properties and scripts, there are times when you may want to create a form
for the easy entry of data. There are many examples of times when you would
want to do this, but let's consider the Journalist sample included with XMetaL
Author. There are some XFT forms included as part of this sample, so let's look
at one of them now:
- Open XMetaL
Author.
- Click
File >
New.
- Click the
Journalist tab and select
Article. A new document is created
based on the Journalist schema.
- If you are not
already in Tags On View, switch to it
now.
- If it is not
already visible, show the Element
List, by clicking View >
Element List.
- Enter any title
for the document, and move to the cursor to after the
</Title>
element tag.
- From the
Element List, click the
Author element, then click
Apply.
You are now
looking at an inline XFT form which is embedded in the Article document. Note
how there are form controls to enter data. You could also create forms that are
modal, form containing buttons, text boxes, lines, etc. If you wish, enter some
author information in the XFT Author form and save the document.
Advanced
Lessons 1 and 2 discuss how to create forms such as the Author form.
This lesson
will take about 20 minutes to complete.
The
XFT Form Layout Tool
You can use
the XMetaL Forms Toolkit (XFT) to create your own forms that can be run from
within XMetaL either as modal dialog boxes or embedded within a document. In
addition, you can create forms that are bound to XML content, such as elements
and attributes, and apply your organization's business logic via
scripting.
Before you
begin creating your own forms, you should familiarize yourself with the XMetaL
Form Layout Editor.
To create a
form:
- Open a Windows
Explorer window and navigate to the folder that contains the XMetaL Form Layout
Tool executable file ({install
path}\Blast Radius\XMetaL 4.5\Developer\Bin).
- Double-click
XFLayout.exe.
The Form Layout Tool opens.
If it is
installed, XMetaL Author opens at the same time. This is so that you can
quickly and easily debug your forms using XMetaL Author.
- Click
File >
New. A dialog box opens asking which
scripting language you want to use.
- Select the
language you want to use from the list, and click
OK. A blank form appears.
You are now
ready to start designing the form.
Note: If, instead of following the above
instructions, you started the XFT Form
Layout Tool from XMetaL
Developer, you must specify which scripting language to start the Form
Editor with in the Add New Item
dialog.
The
Object Bar
At this point,
examine the object bar. It looks like this:
It contains
all of the objects that you can use on your XFT form. For more information
about individual objects (including their available properties and methods),
see The Object Bar in the reference
section of the Customization Guide
that accompanies XMetaL Developer.
To put a
control on your form, click and hold any object on the object bar, and drag it
onto the form. In this example, a combo box was dragged from the object bar
onto the form:
Try dragging
different objects onto the form. Once objects are on the form, you can resize
them and move them to other locations. By adding and arranging objects, you can
design and lay out the form.
The
Property Sheet
Each object
has its own set of properties. The Form
Layout Tool shown in Step 3 (above) displays the property sheet,
although property sheets may not always be visible.
Show the
property sheet (if it is not already shown):
- Right-click the
object whose properties you want to display or edit.
- On the menu that
appears, click Object Properties.
(To hide the
property sheet, follow the same steps.)
The property
sheet displays the properties for only the selected object. To display the
properties for another object, select that object first. Below is a sample
property sheet for a text object:
To edit the
properties for an object:
- If it is not
already visible, display the property sheet.
- Scroll through the
list of properties to find the one(s) you want to edit.
- Click in the text
area to the right of the name of the property you want to edit.
- Enter the new
value.
If you want
to, you can set the tab order for controls: Click
Layout >
Objects. The
Object Sheet (Tab Order) dialog box
appears. From this dialog box you can control the tab order of objects.
Object
events
Each object
always has a set of events. The events allow you to define specialized behavior
for an object using script. Event sheets are not visible by default.
Show the event
scripting window (if it is not already shown):
- Right-click the
object for which you want to display or edit the events.
- On the context
menu that appears, click Object
Scripting.
Advanced
Advanced
(To hide the
event scripting window, follow the same steps.)
Below is the
event scripting window for a combo box object:
Edit the event
for an object:
- If it is not
already visible, show the event scripting window.
- Scroll through the
list of events to find the one(s) for which you want to write a script.
- Enter the script
for the chosen event.
Once you have
created a form, added objects to it, and edited the properties for the objects,
you must save your form. Form name extensions default to .xft. It is important
to remember where you save your forms, because you will need to know the
location of them when it comes time to integrate the forms into XMetaL.
- Click
File >
Save.
- Enter the folder
and filename for your form.
Note: XFT forms should be saved in the
...\Program
Files\Blast Radius\XMetaL 4.5\Author\Forms subfolder.
- Click
OK.
Continue with the next lesson: Binding XFT Forms
to XML content...
Last modified: Friday, May 21, 2004 3:18:46 PM