Written by

Question Ikh Nam · 5 hr ago

how can i use left arrow key with if function

Hi all,
I'm trying to learn Intersystems Iris. And I have a question.
How can I use left arrow key with if function. Also if it is possible, teach me that how can I make backspace to edit data?
P.S Sorry for bad English.
new var,key,curPos
w $char(27)_"[2J"_$char(27)_"[H"
var="12345abcde"
curPos=$length(var)+1
w $char(27)_"[3;1H"_"First var= "_var
for {
read *key
#; Left Arrow Key
if key="?" {
}
#; Right Arrow Key
elseif key="?" {
}
#; Backspace
elseif key=8 {
}
elseif key=9 {
quit
}
}
!,"Last var= ",var
Kind Regards,
Ikh

Product version: IRIS 2023.1

Comments

Robert Cemper · 3 hr ago

You should use the system variable $KEY to get input the terminator

doc in $KEY
suggested code:

USER>read *in set key=$key
;; after arrow back
USER>ZZDUMP in,key
0000: 32 37                         27
0000: 1B 5B 44                      .[D

so you get the full escape sequence in the variable key
or just 08 for backspace, .....

0