The methods of the VirtualKeyCodes class can be used for all objects of the WindowsProgramManager and WindowObject classes. These classes inherit from the VirtualKeyCodes class. The VirtualKeyCodes class cannot be used as a standalone class.
The VirtualKeyCodes class requires the class definition file WinSystm.cls:
::requires "WinSystm.cls"
Instances of the VirtualKeyCodes class implement the methods described in the following sections.
>>-aVirtualKeyCodes~VCode(--keyname--)-------------------------><
The VCode method returns the decimal value of a symbolic key name.
The only argument is:
The symbolic key name. See Symbolic Names for Virtual Keys for a list of key names.
The decimal value of the symbolic key name. If the symbolic name is not found, 255 is returned.
>>-aVirtualKeyCodes~KeyName(--vcode--)-------------------------><
The KeyName method returns the symbolic key name of the specified hexadecimal code.
The only argument is:
The hexadecimal code of the key.
The symbolic key name of the specified code.
The following example deletes or inserts an item in a tree view depending on the selected key:
::method OnKeyDown_IDC_TREE use arg treeId, key curTree = self~GetTreeControl(treeId) /* if the Delete key is pressed, delete the selected item */ if self~KeyName(key) = "DELETE" then curTree~Delete(curTree~Selected) else /* if the Insert key is pressed, simulate pressing the New button */ if self~KeyName(key) = "INSERT" then self~IDC_PB_NEW