0
我有以下代码STDIN.getc锁定我的应用程序
class TimeReport
def run
init_screen
lines = Curses::lines
cols = Curses::cols
read=""
begin
crmode
noecho
gotoDay diaActual.data.to_s #loads the screen with data
while !read.eql?("q")
printPrompt #simply prints the command prompt
read=STDIN.getc
printOnSpot 10,10,read.to_s #prints what was read
if(!read.empty? && !read.strip.empty?)
processPrompt(read,@ecra) # process the read command
else
printInfo "Say What??"
end
end
ensure
echo
nocrmode
close_screen
end
end
end
TimeReport.new.run
当我尝试运行应用程序的应用程序锁和犯规初始化屏幕。 如果我使用Curses.getch不会发生此问题。
谁能开导我,为什么出现这种情况?以及如何解决这个问题?
多数民众赞成好,漂亮,但因为我无法找到使用Curses.getch一个解决方案,我的问题似乎被STDIN来解决我决定我应该尝试一下。请参阅http://stackoverflow.com/questions/897687/ruby-keyboard-event-handling – 2009-06-03 11:31:33