Written by

Question Ikh Nam · Apr 7

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 · Apr 7

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
Ikh Nam  Apr 7 to Robert Cemper

thank you very much

0

Hi @Ikh Nam, welcome to the InterSystems Developer Community 👋

Just a quick note: we have 5 other regional Developer Communities in different languages. This way you may choose the language you prefer.

You can switch to another Community in the top right corner of the page (EN menu).

Hope this makes your experience with the community even better!

0