Environment
Reflection for HP version 13.0 through 14.x
Situation
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.
Resolution
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 FunctionKeykeyLabel As StringkeyString As StringkeyAttr As String 'T=Transmit, N=Normal, C=Command, L=LocalEnd TypeSub GetFunctionKeyLabels()Dim userKeys(1 To 8) As FunctionKeyDim rowIndex As IntegerDim keyIndex As IntegerWith Session.Display Chr$(27) & "j" 'display function key definitionkeyIndex = 1For 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 + 1Next rowIndex.Display Chr$(27) & "k" 'hide function key definitionEnd WithEnd Sub