lib/ppcurses/menu/RadioMenu.rb in ppcurses-0.0.21 vs lib/ppcurses/menu/RadioMenu.rb in ppcurses-0.0.22

- old
+ new

@@ -3,10 +3,11 @@ module PPCurses #noinspection RubyResolve class RadioMenu < BaseMenu + # TODO - duplicate code from Menu ... def initialize( menu_items, action_items ) @items = Array.new @actions = Array.new @menu_length = 0 @@ -56,11 +57,11 @@ while 1 c = @win.getch self.handle_menu_selection(c) - if c == 27 # ESCAPE + if c == ESCAPE @win.clear @win.refresh break end @@ -72,30 +73,27 @@ def handle_menu_selection(c) n_choices = @items.length if c == KEY_RIGHT if @selection < n_choices - 1 then @selection += 1 else @selection = 0 end - self.show() + self.show end if c == KEY_LEFT if @selection > 0 then @selection -= 1 else @selection = n_choices-1 end - self.show() + self.show end - if c == 10 then # ENTER + if c == ENTER then unless @actions.nil? - @actions[@selection].execute() - self.show() + @actions[@selection].execute + self.show end end end - def close - @win.close() - end end end