How to disable F1 help in the Visual LANSA Framework

Date:11 October 2006
Product/Release:Visual LANSA Framework V11.3
Abstract:How to disable F1 in VLF (and VL) applications
Submitted By:LANSA Technical Support

The F1 key is commonly used as "HELP" in any windows application (including all VIisual LANSA applications and Visual LANSA Framework applications) and not normally used for any other purpose.

In V11 CU3 Visual LANSA (or VLF) applications there is a way to disable (or capture) F1.

This example demonstrates how to disable the F1=Help key in the Framework.

This approach can be applied to ANY Visual LANSA applications:

This is a customized copy of the shipped user entry point, UF_EXEC, that demonstrates how to disable F1 in the Framework.

Key changes to the standard shipped example are indicated.

To try this example, 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 points in the Framework.

* =============================================================================
* 
* 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 uDesignMode(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 recommended that you always create three entry points for your
* framework:
* 
* -> one for the designer and developers (like the shipped UF_DESGN)
* -> one for an end user administrator (like the shipped UF_ADMIN)
* -> one for normal application end users (like the shipped UF_EXEC).
* 
* To create your own entry points do the following:
* 
* -> Create a VL form with your chosen entry point name (eg: MYDESGN).
* 
* -> Copy the code from UF_DESGN, UF_ADMIN or UF_EXEC (as required) 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 uDesignMode(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 (uDesignMode), 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_ADMIN and UF_EXEC are designed to act as framework entry
* points only. You should not try to use UF_DESGN, UF_ADMIN and UF_EXEC
* (or any copied version of them) inside any framework in any way.
* 
End_Com