RosettaCodeData/Task/Handle-a-signal/Liberty-BASIC/handle-a-signal.basic
2023-07-01 13:44:08 -04:00

29 lines
613 B
Text

nomainwin
WindowHeight=DisplayHeight
open "Handle a signal" for graphics as #1
#1 "trapclose [quit]"
#1 "down;setfocus;place 10 20"
#1 "\Press CTRL + C to stop."
#1 "when characterInput [keyPressed]"
start=time$("ms")
timer 500, [doPrint]
wait
[quit] close #1:end
[doPrint]
if sigInt then
timer 0
#1 "\Seconds elapsed: ";(time$("ms")-start)/1000
else
i=i+1
if i mod 20 = 0 then #1 "cls;place 10 20"
#1 "\";i
end if
wait
[keyPressed]
if len(Inkey$)>1 then
if left$(Inkey$,1)=chr$(8) then sigCtrl=1 else sigCtrl=0
end if
if sigCtrl=1 and Inkey$=chr$(3) then sigInt=1
wait