Disabling or diverting the F1 Help key in Framework applications

Visual LANSA Framework

Disabling or diverting the F1=Help key in Framework applications

The F1 key is special in all Visual LANSA applications. It invokes the online help, and it is almost impossible in any Windows application created with any tool to use it for any other purpose.

However, you can disable it, or capture it and use it in a different way (for example to display a CHM document).

The following example demonstrates how to capture and disable the F1=Help key. It is a customized copy of the shipped user entry point form UF_EXEC.

To try it, create a form with a name different to UF_EXEC and paste in the following code.

See the notes at the end of this code for more information about creating customized entry point forms.

 

* =============================================================================

* Component   : XX_EXEC

* Type        : Form

* Ancestor    : VF_AC006

*

* =============================================================================

*

* PLEASE NOTE:  This component is a COPY of the shipped version.

*               You may choose to modify it. Refer

*               to the end of this component for more details about making your

*               own version of this component.

*

Function Options(*DIRECT) 

BEGIN_COM ROLE(*EXTENDS #VF_AC006 *implements #Prim_App.IHelpHandler) CLIENTWIDTH(771) LEFT(153) TOP(32) WIDTH(779)

DEFINE_COM CLASS(*ANCESTOR) NAME(#BROWSER) WIDTH(247)

DEFINE_COM CLASS(*ANCESTOR) NAME(#COMMANDHANDLER) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#COMMAND_PANEL) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#INTRO) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#INTRO_PANEL) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#RIGHT_PANEL) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#SELECT_PANEL) WIDTH(247)

DEFINE_COM CLASS(*ANCESTOR) NAME(#TOP_PANEL) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#WORK_PANEL) WIDTH(578)

DEFINE_COM CLASS(*ANCESTOR) NAME(#STATUS) LEFT(239)

DEFINE_COM CLASS(*ANCESTOR) NAME(#TOOLBAR) WIDTH(767)

DEFINE_COM CLASS(*ANCESTOR) NAME(#IDENT_PANEL) WIDTH(767)

DEFINE_COM CLASS(*ANCESTOR) NAME(#MAIN_PANEL) WIDTH(767)

DEFINE_COM CLASS(*ANCESTOR) NAME(#IDENT_BUTTON) LEFT(746)

DEFINE_COM CLASS(*ANCESTOR) NAME(#CURRENT_OBJECT) WIDTH(467)

DEFINE_COM CLASS(*ANCESTOR) NAME(#APPLICATION) WIDTH(185)

DEFINE_COM CLASS(*ANCESTOR) NAME(#LEFT_PANEL) WIDTH(185)

DEFINE_COM CLASS(*ANCESTOR) NAME(#STATUS_BAR) WIDTH(771)

DEFINE_COM CLASS(*ANCESTOR) NAME(#MiniFilter) WIDTH(467)

DEFINE_COM CLASS(*ANCESTOR) NAME(#Right_panel_Main) LEFT(189) WIDTH(578)

 

 

* =============================================================================

* Method Routines

* =============================================================================

 

MthRoutine uInitializeFramework Options(*Redefine)

 

* Set up for end user mode

 

Set #Com_Owner iDesignMode(FALSE)

Set #Com_Owner uAdminMode(FALSE)

 

* Set to start up image name

 

Set #Com_Owner uStartupImage(#uf_im001)

 

* Nominate the XML file containing the Framework design

 

Set #Com_Owner uSystemXMLFile('vf_sy001_system.xml') uSystemXMLChoice('vf_sy001_system_choice')

 

EndRoutine

 

Mthroutine Name(ProcessHelpRequest) Options(*Redefine)

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

* Define_Map For(*input) Class(#prim_alph) Name(#Tag)

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

 

****************************************************************************

* Add logic here to determine if F1 is ignored or not.

****************************************************************************

 

* If Handled is true this will stop the help request going to the normal VL help facility.

 

Set Com(#Handled) Value(True)

 

Endroutine

 

*  =============================================================================

*  MAKING YOUR OWN VERSION OF THIS COMPONENT

*  =============================================================================

*

* It is not recommended that you create development or design entry points for your

* framework. Simply use the shipped ones and use the 'Save As' option to create

* different frameworks. Then only create administrator and user entry points as

* required for production users, locking them into a specific XML file and never

* allowing the end user a framework XML file choice.

*

*  To create your own User entry point do the following:

*

*  -> Create a VL form with your chosen entry point name (eg: MYEXEC).

*

* -> Copy the code from UF_EXEC into your new form. Initially this will cause

* errors to be displayed.

*

*  -> Change the ancestor of your new form to VF_AC006.

*

*  -> The copied code should contain a method routine that will

*  look like this:

*

*  MthRoutine uInitializeFramework Options(*Redefine)

*  Set #Com_Owner iDesignMode(FALSE)

*  Set #Com_Owner uAdminMode(FALSE)

*  Set #Com_Owner uStartupImage(#uf_im001)

*  Set #Com_Owner uSystemXMLFile('vf_sy001_system.xml')

*  EndRoutine

*

*  This code defines whether this entry point should allow application

*  design (iDesignMode),  whether the administration of users and servers

*  should be allowed (uAdminMode). It also defines what the startup bitmap

*  to be shown is (uStartUpImage) and the name of the XML file containing

*  the framework design.

*

*  -> Change these properties as desired and then compile and test your

*  entry point. You should not make any other changes to the logic

*  in your entry point.

*

*  -> Optionally include a uSystemXMLChoice file name to allow the user to

*  select which framework should be opened from a list contained in the

*  specified file.

*

*  -> In design mode entry points only, optionally add the uSystemXMLSaveAs

*  property to indicate the designer can save the framework XML file with a

*  different name.

*

*  -> If you enroll a bitmap into the LANSA repository, say, your company

*  logo under the name #MYLOGO then changing the line:

*

*  Set #Com_Owner uStartupImage(#uf_im001)

*

*  to:

*

*  Set #Com_Owner uStartupImage(#MYLOGO)

*

*  will cause your logo to be presented while the framework is starting.

*

* -> UF_DESGN, UF_DEVEL, UF_ADMIN and UF_EXEC are designed to act as framework

* entry points only. You should not try to use UF_DESGN, UF_DEVEL, UF_ADMIN and UF_EXEC

* (or any copied version of them) inside any framework in any way.

*

 

End_Com