lib/ppcurses/actions/GetIntegerAction.rb in ppcurses-0.0.11 vs lib/ppcurses/actions/GetIntegerAction.rb in ppcurses-0.0.12
- old
+ new
@@ -1,17 +1,21 @@
-require "curses"
+require 'ppcurses/actions/PromptAction.rb'
-class GetIntegerAction < PromptAction
+module PPCurses
- def execute()
- x = @parent.winPadding()
- y = @win.cury()
- begin
- @win.setpos(y,x)
- @win.clrtoeol()
- @win.addstr(@prompt)
- @data = @win.getstr()
- end while not @data =~ /^\d+$/
+ class GetIntegerAction < PromptAction
+
+ def execute()
+ y = @win.cury()
+ begin
+ @win.setpos(y,xPadding())
+ @win.clrtoeol()
+ @win.addstr(@prompt)
+ echo
+ @data = @win.getstr()
+ noecho
+ end while not @data =~ /^\d+$/
+ end
+
end
end
-