Screen Wrapper Fundamentals
Define your screen wrapper
A screen wrapper is a VL reusable part of class VF_SY122. You must define it globally scoped as opposed to inside any type of routine.
Define_Com Class(#vf_sy122) Name(#myscreen_wrapper) Parent(#PANL_1) Visible(False) Displayposition(3)
Key Points:
- Set the initial visibility to False. This will ensure it will never show up unless you want to. For example you might want to make it visible in design mode when a fatal error occurs to give you the option of seeing what the current 5250 screen is.
- You might want to make it a child of a panel attached to the center of the main panel. This will make it easier to see when you want to make it visible to track down fatal errors.
Set the uCommand property
In the command's uInitialize method routine, set the screen wrapper's uCommand property:
Mthroutine Name(uInitialize) Options(*REDEFINE)
* Do any initialization defined in the ancestor
Invoke Method(#Com_Ancestor.uInitialize)
Set Com(#myscreen_wrapper) Ucommand(#com_owner)
Endroutine
Key Points:
- Always set uCommand to #com_owner.
- Failure to set uCommand will result in an error message of type VF_INIT_ERROR.
Kick off execution by making RAMP available
Usually you will invoke MakerampTSavailable Method inside the uExecute method of your command for the first time:
#myscreen_wrapper.MakerampTSavailable
Key Points:
- The first time you make RAMP available during the first execution of a command it will take slightly longer for the event to be fired because RAMP is not connected to the host.
- The command regains control in the RampTSAvailable event routine.
Listen to the RampTSAvailable event
Once RAMP has connected and it's ready to be interacted with it will signal back to the command in this event. It means you are ready to start navigation. For example:
Invoke Method(#myscreen_wrapper.navigatetoscreen) Name(EMPLOYEE_SKILLS)
Listen to the RampMessage event
You write error handling logic and handle messages originating in your 5250 application in the RampMessage Event.