Task 2 - Painting the Menu Details [ HP ALLBASE/4GL Developer Self-Paced Training Guide ] MPE/iX 5.0 Documentation
HP ALLBASE/4GL Developer Self-Paced Training Guide
Task 2 - Painting the Menu Details
To paint the menu details, you use the screen painter program. The
screen painter allows you to interactively create the menu image that is
seen by the end user.
The screen painter can be used to create all types of screens. HP
ALLBASE/4GL varies some of the available functions depending on what type
of screen you are developing.
A menu is composed of literal text, system items such as the date and
time, and menu items. A menu item is composed of two parts; its prompt
(what the user sees) and its action (what is executed when the user
activates the item).
When you use the screen painter, you build an exact image of the screen
as it appears in the application. You use the cursor keys to position
items on the screen and the function keys to select the various available
screen painter options. Any screen item can be located anywhere on the
screen.
The screen painter also provides facilities that allow you to modify
screens by copying, moving, and deleting single items or groups of items
on a screen.
Menu Path
1. From the main menu, select the Screens option.
2. Choose Painter.
The screen painter screen will be displayed.
Using the Screen Painter to Paint a Menu
When you enter the screen painter for the first time, the screen is
cleared and the following prompt appears at the base of the screen.
Screen Painter Prompt
To use the screen painter:
1. Enter the name of the screen you want to paint.
The last screen name used in any of the screen definition screens
appears as a default entry. In this example the name should
default to main.
2. Press Return to start the screen painter.
NOTE If you want to abort the screen painter at any stage you can press
the Abort Painter function key, which is accessed through the
More Keys function key. The screen painter asks you to confirm
the request. Enter Y in response to this message to abort the
screen painter. Any input you have entered will not be saved.
When you enter the screen name, the painter positions the cursor at the
top left corner of the screen, displays some screen identification
details at the bottom of the screen, and displays the screen painter
function keys.
On most terminals, the numbers corresponding to the current cursor
position are displayed between the two sets of four function key labels.
The number on the left is the line number, and the number on the right is
the column number. This information helps you position your screen items
exactly where you need them.
The next figure shows the screen image you are about to paint.
Menu for Training Application
Step 1 - Creating the Screen Title
The first item you need to enter on this menu is the screen title. It
will be located on the top line of the screen.
The top line of a screen is known as the "banner line". When the screen
is displayed at run-time, the banner line is displayed in half-bright
inverse video. The system administrator can change the display
highlighting of all screen items.
To enter the screen title text:
1. Use the cursor keys, cursor right cursor left cursor up and cursor
down to move the cursor to line 1, column 36 on the screen.
The cursor coordinates are displayed between the two sets of
function key labels at the bottom of the screen.
2. Press Return when you have moved the cursor to the correct
postion. The painter displays a message telling you that it is in
Enter Text mode.
3. Type in the text Main Menu.
4. Terminate the text item and the Enter text mode by pressing
Return.
This paints the menu heading. To complete the screen, you will enter
some system items and define actions to be performed.
Before continuing, read the following paragraphs for useful tips on how
to perform actions quickly in the painter such as moving, copying, and
deleting text and blocks of text.
Some Useful Tips on Working with the Painter
Using the Cursor
When in text entry mode, you can use the Insert char, Delete char, Clear
line and Back space keys to edit the text you are entering. Try it out.
Type in a few extra items of text anywhere on the screen. Remember to
press Return to start text entry mode, and to press Return again to
terminate each entry. Don't worry about cluttering up the screen with
extra entries because you will soon learn how to delete them.
Notice that as you move onto a defined item it is highlighted and it
becomes the current item. When an item is highlighted, you can modify it
by pressing Return and typing characters over the item. The screen
painter enters the Modify text mode if you press Return while an item is
highlighted. Press the Return key to complete a text entry or an
alteration.
Using the Tab Key
After you've typed in a few text items, try pressing the Tab key. Each
time you press it, the next item on the screen is highlighted until you
get to the last item on the screen.
Pressing the Tab key again returns the highlight to the first item on the
screen. Pressing Shift + Tab followed by Return takes you backwards
through the fields.
Notice that as you move from one field to another using this method, the
cursor is positioned on the first character of the current item.
Now try pressing the cursor home key followed by Return. The cursor is
positioned in the upper left corner of the screen. When you press Shift
and cursor home followed by Return, the cursor is positioned on the last
item on the screen.
If you've tried out a few of the items described above, your screen is
probably a scattered mess of text items. If you don't have more than one
text item on your screen, enter some now as you'll need them for the next
exercise in this lesson.
Using Layout Keys.
The screen painter layout keys are a set of function keys allowing you to
move, copy, or delete items on a screen.
To use the layout keys:
1. Make sure you are at the main level of function keys.
You can tell this by the fact that one of the function keys is
labelled Exit . If it isn't, press the Main Keys function key.
2. Press the Layout Keys function key and you will see a new set of
keys displayed.
The Layout Keys allow you to modify the layout of existing items
on the screens.
Screen Painter Layout Keys
By using the layout keys, you can move, copy and delete single items or
blocks of items on the screen. For now, all you want to do is delete the
text fields that you don't need on this screen.
To delete items on the screen:
1. Use the Tab key or cursor keys to select the first field you want
to delete, and then press the Delete function key.
The screen painter asks you to confirm the deletion.
2. Type Y and then press Return to confirm the deletion.
The item is erased from the screen. This is how you can delete a
single item from a screen.
To practice deletions:
1. Select another item that you want to delete.
So you can delete a group of fields, choose one that has a few
more items below or to the right of it. If you don't have an area
that looks like this, type in a few extra text items so it does.
2. Press the Delete function key.
The screen painter displays the confirmation message again.
3. Press the Delete function key again.
The next field on the screen is highlighted as well.
As you keep pressing the Delete key, the highlight keeps
advancing until you reach the last field on the screen. Each time
you press the Delete function key, the confirmation message is
displayed. If you keep pressing the Delete function key (and no
other), you will stay in delete mode.
4. When you have highlighted the last field you wish to delete, type
Y and then press Return to confirm the deletion.
All of the highlighted fields are deleted in one operation.
The same method also works for moving and copying screen items. If you
highlight a number of fields by repeatedly pressing a function key, the
action will be performed on all of the highlighted fields.
When you're moving or copying items, the painter issues a warning message
if you specify a destination that causes a clash of fields or do not
allow sufficient room on the screen for any of the items to be moved or
copied. If this happens, move the cursor to a new destination and then
attempt the move or copy again.
Using the Block Function.
The screen painter provides another way of performing a layout function
with a group of screen items. This is a two-step block function. First,
you define a block of fields, then you choose a function to perform on
the defined block.
To define a block:
1. Move the cursor to one corner of the rectangle which is to become
the defined block, and then press the Begin Block function key.
2. Move the cursor to the diagonally opposite corner of the block and
press the End Block function key.
All the fields that are partially or wholly within the block are
highlighted and the function you choose is performed on all of
them.
You are always asked to confirm your actions when you are using
the block delete function. This helps ensure that you don't
accidentally destroy part of a screen that you are creating or
modifying.
To perform different functions on a block:
1. Define a block of fields on your screen, and then press the Move
, copy , or delete function keys.
When you're asked to move the cursor to the new position, move the
cursor to the new position of the upper left corner of the block
and then press the Return key. The fields within the block are
moved or copied to the new location, retaining their relative
positions within the block, or they are deleted.
If any of the fields to be moved or copied clash with any other
fields already on the screen, the painter issues a warning message
and the move or copy is not allowed.
2. To turn the copy mode or the move mode off, or to abort the delete
mode, press the End Function function key.
Create a few text items and try moving or copying single fields about the
screen. Try pressing the Move or Copy key successively to use a
group of items in move or copy mode. When you feel comfortable with
these keys, move on to the next part of the lesson.
NOTE The exercises you have completed so far have only used text items.
All field types, system items, action items, text, and input or
display fields behave exactly the same way. As well as moving the
images of fields on the screen, the screen painter also moves or
copies the attributes of the fields.
Clean up the screen so you have only the text item Main Menu located on
the first line at column 36. Then return to the main screen painter
function keys (by pressing the Main Keys function key if necessary), so
that you can complete painting this menu.
Step 2 - Defining System Items for a Menu Screen
System items include the date and time, the current screen name, and some
dictionary defined items.
You create these system item fields on the screen by using the System
Item prompt, which is accessed with the System Item function key.
System Item Prompt
Some of the available system items are:
* Communication areas.
* The date.
* Application titles.
To display the screen name:
You can use a system item to display the name of the current screen.
1. Move the cursor to column 76 on the first line of the screen and
follow these steps to create the screen name item:
Action Explanation
----------------------------------------------------------------------
Press System Item This displays the system item prompt at the
base of the screen.
Press Next Type This displays another system item.
Pressing the function key again specifies
and displays the next item type until you
reach the end of the list. The list then
starts again.
Press Next Type until This is an abbreviation for Communication
* Communication Area Area Field. You will learn more about
appears these fields later but for now it is
sufficient to know that they are values
maintained automatically.
Press Return This moves the cursor from the small single
character prompt in the left field to the
larger field on the right.
Type SCREEN This is a reference to the communication
area field *SCREEN, which contains the name
of the current screen.
Press Return This creates the system item field on the
screen. The prompt is cleared and the
current screen name, along with the cursor,
is displayed at line 1, column 76.
To display the date:
You can also use a system item to display the current system date on a
screen.
1. Move the cursor to line 2, column 72 and follow the next steps to
create the system maintained date item.
Action Explanation
----------------------------------------------------------------------
Press System Item This displays the system item prompt at the
base of the screen.
Press Previous Type This displays another system item type.
Pressing this function key specifies the
previous type until you reach the start of
the list of available types. You then
start stepping through the list from the
end again.
Specify D Date This is the system date field. It is
maintained by the system. The current
system date is displayed whenever this
screen is used by the application.
Press Return This creates the system item date field on
the screen. The date, along with the
cursor, is displayed at line 2, column 72.
Note that the date is displayed in either
US or European format. The date format on
your system is set by the system
administrator.
To display the time:
A communication area field called *TIME holds the current system time.
You can use a system item to display this field on a screen.
1. Move the cursor to line 2, column 2.
2. Follow the steps below to create a field that displays the current
time.
Action Explanation
----------------------------------------------------------------------
Press System Item This displays the system item prompt at the
base of the screen.
Specify * Communication *TIME is a communication area field.
Area
Press Return
Type TIME This refers to the *TIME communication area
field.
Press Return This creates the time field on the screen.
To display an application title:
An application title is a literal string that can appear anywhere on a
screen. Application titles are stored in the dictionary, and any changes
you make to an application title are automatically reflected in all
screens that use the title. A typical use for application titles is to
display a corporate or department name on all screens in an application.
In this example, you will use an application title to display the name of
the application on the screen.
1. Move the cursor to line 1, column 2.
2. Follow the steps below to create a field that will display an
application title.
You will create the application title in a later lesson.
Action Explanation
----------------------------------------------------------------------
Press System Item This displays the system item prompt at the
base of the screen.
Specify A Application This is another type of system item.
Title
Table 3-0. (cont.)
Action Explanation
----------------------------------------------------------------------
Press Return
Enter application_name The painter displays a warning message
informing you that this item hasn't been
defined in the dictionary. You can still
create the system item on the screen,
creating a reference to the named
application title even though the item
hasn't been defined yet.
At this stage you will only see
A-application_name displayed. The screen
painter does not need to have this field
defined when you first refer to it. When
you define the field later, it is displayed
automatically in this area.
Step 3 - Defining Actions for the Menu Screen
So far you have only entered a text item and some system items. On a
menu you must also define at least one action to be performed when the
user selects the associated prompt.
A menu action can execute any of a number of items in HP ALLBASE/4GL.
These include processes, background processes, reports, or other screens.
The following steps allow you to create an action which, when selected,
executes an HP ALLBASE/4GL process.
To define actions to be performed:
1. Position the cursor at line 7, column 32.
2. Press Action . This displays the action item prompt at the base
of the screen.
Action Item Prompt
3. Complete the following steps to create the action item.
Action Explanation
----------------------------------------------------------------------
Press Next Type Pressing this key specifies and displays
the next action type until you reach the
end of the list of available action items.
You then start stepping through the list
again.
Specify P Process This indicates that this item executes a
process when it is selected. You will
create the process itself in a later
lesson.
Press Return This moves the cursor from the small single
character prompt on the left field to the
larger field to the right. The system is
now waiting for you to enter the name of
the process associated with this item on
the menu.
Type product_proc This is the name of the process that is
executed when the user chooses the Product
Details selection from the menu.
Press Return This creates the name of the action item on
the screen. The process name, along with
the cursor, is displayed at line 7, column
32. Now you can overtype the name of the
action with the prompt that is seen by the
end user.
Enter Product Details This action automatically invokes the text
editing mode and overtypes the process name
that formed the original action title.
You can edit the text of an action title just like any text field.
However, the highlighting differs from that of a text field to enable you
to distinguish between the two.
An end user can select the various choices on a menu by typing the first
letter of an item and then pressing Return. If you use unique initial
letters for each of the items on any one menu, an experienced end user
can move rapidly through menus.
This completes the steps for creating a menu. Your next task is to save
the menu.
MPE/iX 5.0 Documentation