RAMP TSAD08 Step 3 Understanding the Screen Wrapper Code

RAMP-TS

RAMP-TSAD08 Step 3. Understanding the Screen Wrapper Code

In this step you will examine the code in the screen wrapper.

1.   Display the screen wrapper source code in the Visual LANSA editor.

2.   The screen wrapper is a command handler, therefore it's ancestor has to be  #VF_AC010:

3.   The first thing to note is in the DEFINE_COM statement which defines the screen wrapper component which enables the command handler to communicate with the underlying 5250 screen:

 

4.   Next, in the uInitialize even routine,  note the statement that sets the screen wrapper's uCommand property to #COM_OWNER :

 

You must always set uCommand to #com_owner, otherwise an error message of type VF_INIT_ERROR will be issued because the screen wrapper will not have access to the command handler.

5.   Then notice that RAMP execution is kicked off by the MakerampTSavailable method in the uExecute method routine:

 

6.   When RAMP is available, you specify the destination screen to which you want the wrapper to navigate in the #myscreen_wrapper.RampTSAvailable event routine:

  

7.   The vHandleArrive event routine first checks that the screen that has arrived is DisplayEmployee. For error handling, it checks if there is an UPDATE_EMPLOYEE payload (issued when the user clicks the Save button). If there isn't, the wrapper retrieves the values from the fields on the screen and displays them:

 

 

8.   Locate the event routine handling the Save button on the screen wrapper which assigns the values on the fields on the wrapper to the fields on the screen and then emulates the pressing of  the Enter key:

 

9.   Lastly have a look at the routine handling the #myscreen_wrapper.RampMessage event to see how RAMP-TS can handle different types of errors in a screen wrapper: