S_230RH1

LANSA

S_230RH1
* ===================================================================
*
* Component : S_230RH1
* Type : Reusable Part
* Ancestor : PRIM_OBJT
*
* Description : This reusable part is the common interface to the
* main CHM help manager component S_230RH2. This interface
* is used to so that a single shared instance of S_230RH2
* can be used by all active forms.
*
* Disclaimer : The following material is supplied as example material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================
FUNCTION OPTIONS(*DIRECT)
BEGIN_COM Role(*EXTENDS #PRIM_OBJT)

* ======================================================
* Define the help manager as a scope(*Shared) object
* ======================================================

DEFINE_COM Class(#S_230RH2) Name(#HELP_MANAGER) Scope(*Shared)

* ======================================================
* Define the members used to keep track of the parent
* form and any help or online guide buttons it may have
* ======================================================

DEFINE_COM Class(#PRIM_form) Name(#Help_Form) Reference(*dynamic)
DEFINE_COM Class(#PRIM_PHBN) Name(#HELP_BUTTON) Reference(*dynamic)
DEFINE_COM Class(#PRIM_PHBN) Name(#Guide_BUTTON) Reference(*dynamic)

* ======================================================
* Define the help and online guide short cut keys
* ======================================================

DEFINE_COM Class(#PRIM_STPG) Name(#HELP_SHORTCUT_KEY) Reference(*Dynamic)
DEFINE_COM Class(#PRIM_STPG) Name(#GUIDE_SHORTCUT_KEY) Reference(*Dynamic)

* ======================================================
* Handle a request by a parent form to register for help
* ======================================================

Mthroutine uRegisterForHelp

Define_Map *input #Prim_Form #uForm Pass(*By_Reference)
Define_Map *input #Prim_PhBn #uHelpButton Pass(*By_Reference)
Define_Map *input #Prim_PhBn #uGuideButton Pass(*By_Reference)

* Record details of the form and any help or online guide
* buttons that it has

Set_Ref #Help_Form #uForm
Set_Ref #Help_Button #uHelpButton
Set_Ref #Guide_Button #uGuideButton

* Create a short cut key (Ctrl+H) for help and link
* it up to the parent form

Set_Ref #Help_ShortCut_Key (*Create_as #Prim_StPg)
Set #Help_ShortCut_Key Parent(#Help_Form) Shortcut(Ctrl+H)

* Create a short cut key (Ctrl+G) for the online guide and
* link it up to the parent form

Set_Ref #Guide_ShortCut_Key (*Create_as #Prim_StPg)
Set #Guide_ShortCut_Key Parent(#Help_Form) Shortcut(Ctrl+G)

Endroutine

* ========================================================
* Handle a request by a parent form to unregister for help
* ========================================================

Mthroutine uUnRegisterForHelp

* Destroy the short cut keys

Set_Ref (#Help_ShortCut_Key #Guide_ShortCut_Key) *Null

* Reset all other dynamic references to null

Set_Ref (#Help_Button #Guide_Button #Help_Form) *Null

Endroutine

* ============================================================
* Handle a request by a parent form to set the current topic
* by passing the request straight through to the help manager
* ============================================================

Mthroutine uSetCurrentTopic
Define_Map *input #Prim_Objt #uForComponent Pass(*By_Reference)
Invoke #Help_Manager.uSetCurrentTopic uForComponent(#uForComponent)
Endroutine

* ==============================================
* If the help (ie: parent) form becomes activated
* set the current topic to be the parent form
* ==============================================

Evtroutine Handling(#Help_Form.Activate) Options(*NOCLEARERRORS *NOCLEARMESSAGES)
Invoke #Help_Manager.uSetCurrentTopic uForComponent(#Help_Form)
Endroutine

* ================================================
* If the help button on the parent form is clicked
* or if the help short cut key is used ask the help
* manager to show the current topic
* ==============================================

EVTROUTINE HANDLING(#Help_Button.Click #Help_ShortCut_Key.Pressed) Options(*NOCLEARERRORS *NOCLEARMESSAGES)
Invoke #Help_Manager.uShowCurrentTopic
ENDROUTINE

* ==============================================
* If the online guide button on the parent form
* is clicked or the short cut key is used ask
* the help manager to show the online guide
* ==============================================

EVTROUTINE HANDLING(#Guide_Button.Click #Guide_ShortCut_Key.Pressed) Options(*NOCLEARERRORS *NOCLEARMESSAGES)
Invoke #Help_Manager.uShowOnlineGuide
ENDROUTINE

END_COM