Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
     EXCHANGE  FIELDS(#OBJECTKEY)

...

 OPTION(*ALWAYS)
BEGIN_LOOP
REQUEST   FIELDS(#OBJECTKEY)

...

 IDENTIFY(*DESC)
          CURSOR_LOC(*

...

ATFIELD #OBJECTKEY)
END_LOOP

Q & A 

What does the program do?  

It does one and only one thing. Allow the user to identify the object that they wish to work with by typing in its "key".

What if the user doesn't know the "key" value?

Then they would use the prompt key to search through the list of objects in some order and choose the one they wish to work with. This feature is available via normal LANSA prompt key handling described in other sections of this guide. Inclusion of other advanced CUA features like prompting is vital to simple, yet highly functional action bar applications.

Can I validate the "key" that they specify?

You can, but the validation logic would only be executed if the user pressed the Enter key.

...

In this case, this particular function never regains control after executing the DISPLAY command. The user chooses another function, causing this one to end, and the new one to start.

Does this mean an invalid "key" can be accepted?

It sure does. However, this is not a problem because all functions in an action bar are designed to be highly robust, self contained applications that never trust the fact that another function has been run before them, or will run after them.

So if the user keyed in an invalid "key", moved to the action bar and chose something like "Display Object", then the "Display Object" routine would quite easily handle the "not found" situation with an appropriate error message (e.g.: Object to be displayed cannot be found ... select desired object')

Why is the CURSOR_LOC(*ATFIELD #OBJECTKEY) parameter used?

You will find that you have to use the CURSOR_LOC parameter on most DISPLAY or REQUEST commands that are part of an action bar process.

The reason is simple, if you leave the parameter off the command, the operating system will position the cursor up to the first option in the action bar (by default). In most cases you actually want the cursor to position to the first field in the "panel body", so the CURSOR_LOC parameter is required, even if all the fields on the panel are output only fields.

How does the program ever end?

This program has an apparently endless loop.

...

An accelerator key may be used as well, which is functionally identical to choosing from a pull down.

What program runs after this program?

That's up to the user controlling the application, and is of no concern to this particular program.

...