HelpHandler Interface (PRIM_APP.IHelpHandler)

User defined help handler interface used to replace inbuilt F1 handling

Ancestors - None

Details

The iHelpHandler interface is implemented to override the default LANSA F1 runtime help mechanism.
 
When F1 Is pressed, the ProcessHelpRequest method is executed.
 
The ProcessFocusRequest is currently not implemented and will have no effect.

Example

This example shows a simple form using the help interface. When F1 is pressed a simple routine starts by inspects the Requestor object, in this case using the ComponentTag, for a value.  If none is found, it routes the request to the parent object until either a value is found or a default value is finally used.
 
The fields on the form all have a value specified for their ComponentTag, but the two buttons do not. F1 on the buttons will resolve a tag when the parent is evaluated.
 
This simple technique can be coded in a base class or shared application scope object, to provide a very simple contextual help mechanism.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM *implements #Prim_App.iHelpHandler) Theme(#SYS_THEME<2015Blue>) Clientwidth(551) Clientheight(301) Left(165) Top(204) Width(567) Componenttag('EmployeeEditor')
 
   Define_Com Class(#EMPNO.Visual) Name(#EMPNO) Componentversion(1) Displayposition(1) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(1) Top(8) Usepicklist(False) Width(251) Componenttag('EmployeeNumber')
   Define_Com Class(#SURNAME.Visual) Name(#SURNAME) Displayposition(2) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(32) Componenttag('Surname')
   Define_Com Class(#GIVENAME.Visual) Name(#GIVENAME) Displayposition(3) Left(8) Parent(#COM_OWNER) Tabposition(3) Top(56) Componenttag('GivenName')
   Define_Com Class(#ADDRESS1.Visual) Name(#ADDRESS1) Displayposition(4) Left(8) Parent(#COM_OWNER) Tabposition(4) Top(80) Componenttag('Address')
   Define_Com Class(#ADDRESS2.Visual) Name(#ADDRESS2) Componentversion(1) Displayposition(5) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(5) Top(104) Usepicklist(False) Width(537) Componenttag('Address')
   Define_Com Class(#ADDRESS3.Visual) Name(#ADDRESS3) Componentversion(1) Displayposition(6) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(6) Top(128) Usepicklist(False) Width(537) Componenttag('Address')
   Define_Com Class(#PRIM_PHBN) Name(#Cancel) Caption('Cancel') Displayposition(7) Left(464) Parent(#COM_OWNER) Tabposition(7) Top(264)
   Define_Com Class(#PRIM_PHBN) Name(#OK) Caption('OK') Displayposition(8) Left(376) Parent(#COM_OWNER) Tabposition(8) Top(264)
 
   Mthroutine Name(ProcessHelpRequest) Options(*Redefine)
 
      #Handled := True
 
      #Com_owner.Caption := #Com_owner.FindTag( (#Requestor *As #Prim_ctrl) )
 
   Endroutine
 
   Mthroutine Name(FindTag)
   Define_Map For(*Input) Class(#Prim_Ctrl) Name(#Requestor) Pass(*By_Reference)
   Define_Map For(*Result) Class(#Prim_alph) Name(#Result)
 
      If (#Requestor *Is *null)
 
         #Result := "NoHelpTag"
 
      Else
 
         If (#Requestor.ComponentTag <> "")
 
            #Result := #Requestor.ComponentTag
 
         Else
 
            #Result := #Com_owner.FindTag( #Requestor.Parent )
 
         Endif
 
      Endif
 
   Endroutine
 
End_Com

Methods

NameDescription
ProcessFocusControlExecuted on a change of focus
Handled, Requestor, Tag
ProcessHelpRequestExecuted when F1 is pressed in a desktop application
Handled, Requestor, Tag

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2