2.26.2 iHelpHandler Interface

A flexible way of creating independent (i.e. not stored in the repository) help for components is to use the iHelpHandler interface.

Using the iHelpHandler interface you have the option of implementing whatever help mechanism you like.  You simply need to plug in the appropriate piece of code and the help will be routed via a mechanism that sends notification that help was requested on a particular component. What you do after this is entirely up to you.

This example form implements the iHelpHandler Interface. When F1 is pressed, the focus component will determine whether it is implementing the help interface. If not, help will be handled through the normal automated repository help. If it is, the ProcessHelpRequest method will be executed.

In the following code the Find_Tag method receives a reference to the control that currently has focus. In the example, the ComponentTag property of the requesting component is used to determine the what help to show. If the component has a blank tag, the Handled map on the method is left as false, indicating to LANSA that help should go through the normal channels. However, if the component tag is not blank, it is displayed in a message box. Once control is returned from the message box to the form, the Handled map is set to True indicating that normal repository help should not be shown.

Note that this example uses RDMLX:

Mthroutine Name(Find_Tag) Help('Find a tag for the current control.  Use Parent chain to resolve if none specified') Access(*Private)

Define_Map For(*Input) Class(#prim_objt) Name(#i_Requestor) Pass(*by_reference)

Define_Map For(*Result) Class(#prim_alph) Name(#o_tag)

* If a control is supplied

If ((#i_Requestor *IsNot *null) *AndIf (#i_requestor *Is #prim_ctrl))

* If the Control has a tag, use it, otherwise go up the parent chain, and try again

If (#i_Requestor.ComponentTag <> '')

#o_tag := #i_Requestor.ComponentTag


If (#i_Requestor.Parent *Is #prim_ctrl)

* Look for a tag in the parent

#o_tag := #com_owner.Find_tag( #i_Requestor.Parent )


* If not control supplied, use a default

#o_tag := 'DefaultTag'




* If not control supplied, use a default

#o_tag := 'DefaultTag'



When the ProcessHelpRequest method is being executed, you have complete control over the application. Rather than using normal repository help if the tag is blank, it is quite possible to navigate the parent chain looking for a control that does have a tag. Thus with a simple recursive method it is possible to ensure that regardless of where focus is within a complex for a series of reusable parts, a help tag can be provided. The example Find_Tag method demonstrates this technique.

If this approach to help is adopted within an application, it is necessary to ensure that is implemented for all forms and reusable parts. The recommendation is that the processing be implemented in a base class form and reusable part that all other components inherit.

iHelpHandler Code Example

Function Options(*DIRECT)

Begin_Com Role(*EXTENDS #PRIM_FORM *implements #Prim_App.IHelpHandler) Clientheight(306) Clientwidth(416) Componenttag('Help for the form') Left(91) Top(134) Width(424)

Define_Com Class(#Std_num.Visual) Name(#Std_num) Componenttag('Standard_Number') Displayposition(1) Height(19) Left(8) Parent(#COM_OWNER) Tabposition(1) Top(8) Usepicklist(False) Width(262)

Define_Com Class(#Std_texts.Visual) Name(#Std_texts) Componenttag('Standard_Text_Short') Displayposition(2) Height(19) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(32) Usepicklist(False) Width(401)

Define_Com Class(#Empno.Visual) Name(#Empno) Displayposition(3) Left(8) Parent(#COM_OWNER) Tabposition(3) Top(56) Width(232)

Mthroutine Name(ProcessHelpRequest) Options(*Redefine)

* Define_Map For(*input) Class(#prim_objt) Name(#Requestor) Pass(*by_reference)

* Define_Map For(*input) Class(#prim_boln) Name(#Handled)

#Handled := False

If (#Requestor *IsNot *null)

* If the requesting component has a Tag, interrupt the help and use the user defined help.

If (#requestor.ComponentTag <> "")

* Show Help for the requesting control

#Com_owner.Show_help( #Requestor )

* Set the Handled flag.  If not set to true, normal Repository help will be displayed

#Handled := True




Mthroutine Name(Show_Help)

Define_Map For(*input) Class(#Prim_Objt) Name(#Requestor) Pass(*by_reference)

* This example simply displays the Component tag property of the requesting control

* However, the developer is now in full control of the help request, and can show help as they require

Use Builtin(Message_Box_Show) With_Args(Ok OK Information 'Help' #requestor.ComponentTag)