Add Method - Function Keys

Add a new Function Key to the Function Keys collection.

App.ActiveForm.FunctionKeys.Add(Name, Text, Key)

Client support

   Newlook Smartclient

   Newlook Server

Parameters

Name - (String, Required)

A string that is used to specify the name of the new function key. It can then be used in the same manner as any other named control created in designer to reference the control and its properties/methods.

Text - (String, Optional)

The string that appears in the FunctionKey label.

Key - (String, Required)

When adding a Function Key to the Function Keys collection this parameter is required and specifies the key that will be sent to the host when the Function Key is pressed. The value specified can be either the integer value of the AID key or one of the nlKeyxxx constants (eg. nlKeyF3).

Refer to the Aid Key Constants topic for a list of available constants.

Use

This method allows you to dynamically insert a new function key onto the form. This method is typically used with the OnReceive event of the form to provide users with custom function keys. Note that it is not possible to assign a macro or script to a dynamically added function key. To do this you will need to add the function key via Designer. Use the Enable or Visible properties to modify the display of function keys dynamically.

Examples

The following example will add a new disabled F4 prompt key to the function keys on the form. This function key can be turned on and off as needed.

J SCRIPT

function AddPromptKey()

{

//Create a disabled FunctionKey to be turned on dynamically as needed.

App.ActiveForm.FunctionKeys.Add("fkPrompt", "Prompt", nlKeyF4);

App.ActiveForm.FunctionKeys.FncPrompt.Enabled = 0;

}

 

VB SCRIPT

Sub AddPromptKey

'Create a disabled FunctionKey to be turned on dynamically as needed.

App.ActiveForm.FunctionKeys.Add "fkPrompt", "Prompt", nlKeyF4

App.ActiveForm.FunctionKeys.fkPrompt.Enabled = false

End Sub

See Also

RefreshForm Method | Remove Method | Aid Key Constants | AddNew method | AddItem method | AddRecord method | Node object | ListItem object | ColumnHeader object | Add Method - Controls | Add Method - Nodes | Add Method - ColumnHeaders | Add Method - Items

Applies To

FunctionKey collection


© 2004-2021 looksoftware. All rights reserved.