Re: Help wanted!
re: enter key scrolling last line
i'd suggest writing your own input routine, to handle all the keys,
including the Enter key. the initial pain of writing the routine is
compenstated by the fine control that you get in the long run.
it's not that hard to write; something like:
-- CODE BEGINS HERE
include get.e -- wait_key()
constant BACKSPACE = 8, ENTER = 13
function input_at( integer line, integer col, sequence prompt, integer size
)
integer key, n
sequence text
text = ""
-- prompt
position( line, col )
puts( 1, prompt & "[" & repeat( 249, size ) & "]" )
-- input start position
col = col + length(prompt) + 1
while 1 do
-- display the text
position( line, col )
puts( 1, "" & text )
-- pad the remaining
n = length( text )
if n < size then
puts( 1, repeat( 249, size - n ) )
end if
-- position cursor
position( line, col + n )
-- wait for a key
key = wait_key()
if key = ENTER then
exit
elsif key = BACKSPACE then
-- text to remove?
if n > 0 then
text = text[1..n-1]
end if
elsif key >= ' ' then
-- room?
if n < size then
-- add
text = text & key
end if
end if
end while
return text
end function
-- try it out
sequence x
x = input_at( 2, 3, "First Name", 32 )
-- CODE ENDS HERE
hope this helps.
-- david cuny
|
Not Categorized, Please Help
|
|