Obtaining Function Key Label Text in Reflection for HP

  • 7021724
  • 03-Dec-2009
  • 31-Mar-2018


Reflection for HP version 13.0 through 14.x


In HP sessions, the host application can set eight function key labels that are displayed at the bottom of the terminal screen. Reflection API functions that return display text do not retrieve function key label text. This technical note describes how to obtain function key definitions, including label text, in Reflection for HP.


The following VBA macro example shows how to obtain function key label text by invoking an HP command to display these values, and then using GetText.

Type FunctionKey
keyLabel As String
keyString As String
keyAttr As String 'T=Transmit, N=Normal, C=Command, L=Local
End Type

Sub GetFunctionKeyLabels()
Dim userKeys(1 To 8) As FunctionKey
Dim rowIndex As Integer
Dim keyIndex As Integer

With Session
.Display Chr$(27) & "j" 'display function key definition
keyIndex = 1
For rowIndex = 0 To 14 Step 2
userKeys(keyIndex).keyLabel = Trim$(.GetText(rowIndex, 12, rowIndex, 66))
Debug.Print userKeys(keyIndex).keyLabel
userKeys(keyIndex).keyAttr = Trim$(.GetText(rowIndex, 3, rowIndex, 3))
userKeys(keyIndex).keyString = Trim$(.GetText(rowIndex + 1, 0, rowIndex + 1, 67))
keyIndex = keyIndex + 1
Next rowIndex
.Display Chr$(27) & "k" 'hide function key definition
End With
End Sub

Additional Information

Legacy KB ID

This document was originally published as Attachmate Technical Note 2480.