Home > Code Library > SmartMenuXP > KeyLabel

Last Update 01 Nov 2001

 


Search:



  

Options:

   

   

   

   



SmartMenuXP Reference

KeyLabel Property

Returns or sets the text used to display a KeyCode when building the shortcut string.

Syntax

object.KeyLabel(keycode) [= string]

The KeyLabel property syntax has these parts:

Part Description
object An object expression that evaluates to a SmartMenuXP object.
keycode A numeric expression that evaluates to a VB KeyCodeConstant.
string A string expression that evaluates to the text associated with keycode.


Remarks

Menu items can have a shortcut which is a combination of a ShiftConstant flag and a KeyCodeConstant value. Shortcuts are displayed to the right of the menu window and the menu item can be selected by just typing its shortcut. An example of a shortcut is ALT+Q for the menu item "Exit".

Every key code has its corresponding key label. By default, all key labels are created in English. You may want to use a different key label when creating global applications. The KeyLabel property is useful for localising applications.

Let's see an example. Suppose you want to exit your application by typing "ALT+CTRL+END". You would probably create the menu item as follows:

    .Add "keyFile", , , "E&xit", , vbAltMask + vbCtrlMask, vbKeyEnd

The default key label for vbKeyEnd is "End". Thus, the shortcut string will be created by default as "Ctrl+Alt+End".

If you were running your application in Spain you might want to use the Spanish key label for "End", which is "Fin". You can do this by just adding the following code:

    .KeyLabel(vbKeyEnd) = "Fin"

 

 
Copyright © 2001, Andrés Pons (andres@vbsmart.com). All rights reserved.