forum-msg-id-136823-edit

Original date:2022-05-06 08:21:19 Edited by: ChrisB Subject: Re: Backspace doesn't work in 4.1.0 programs?

Hi

Sorry, I should have been more specific - prompt_string() doesn't work because of the windows console in modern windows PC and eu. Annoying I know, I had the same problem on linux, so essentially wrote my own. It does mean you have to keep tighter control over what the screen is displaying though.

add this code onto the end (remove the other entry tests)

--------------------------------------------------------------------------------------------------------------------- 
global procedure printat(sequence coords, sequence text) 
--displays test a a position 
--------------------------------------------------------------------------------------------------------------------- 
 position(coords[1],coords[2]) 
 puts(1,text)     
end procedure 
 
--clear_screen() 
position(10,1) puts(1, "Enter string : ") 
sequence str = "" 
while 1 do 
    printat({10, length("Enter string : ")}, str & "  ") 
    position(10, length("Enter string : " & str)) 
    c = wait_key_nn() 
    if c = bksp then 
        if length(str) > 1 then 
            str = str[1..length(str) - 1] 
        end if 
    else 
        str = str & c   --note - no checking for valid keys! 
    end if 
 
    if c = 13 then exit end if 
 
end while 
 
puts(1, "\n" & str & "\n") 
--need to do some tidying up, but thats the principle 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu