def display_columns config={}
      prompt = config[:prompt] || "Choose: "
      require 'canis/core/util/rcommandwindow'
      layout = { :height => 5, :width => Ncurses.COLS-0, :top => Ncurses.LINES-6, :left => 0 }
      rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] || "Menu"
      w = rc.window
      r = 4
      c = 1
      color = $datacolor
      begin
        menu = @options
        $log.debug " DISP MENU "
        ret = 0
        len = 80
        while true
          h = {}
          valid = []
          labels = []
          menu.each{ |item|
            if item.respond_to? :hotkey
              hk = item.hotkey.to_s
            else
              raise ArgumentError, "Promptmenu needs hotkey or mnemonic"
            end
            # 187compat 2013-03-20 - 19:00 throws up
            labels << "%c. %s " % [ hk.getbyte(0), item.label ]
            h[hk] = item
            valid << hk
          }
          #$log.debug " valid are #{valid} "
          color = $datacolor
          #print_this(win, str, color, r, c)
          rc.display_menu labels, :indexing => :custom
          ch=w.getchar()
          rc.clear
          #$log.debug " got ch #{ch} "
          next if ch < 0 or ch > 255
          if ch == 3 || ch == ?\C-g.getbyte(0)
            clear_this w, r, c, color, len
            print_this(w, "Aborted.", color, r,c)
            break
          end
          ch = ch.chr
          index = valid.index ch
          if index.nil?
            clear_this w, r, c, color, len
            print_this(w, "Not valid. Valid are #{valid}. C-c/C-g to abort.", color, r,c)
            sleep 1
            next
          end
          #$log.debug " index is #{index} "
          item = h[ch]
          # I don;t think this even shows now, its useless
          if item.respond_to? :desc
            desc = item.desc
            #desc ||= "Could not find desc for #{ch} "
            desc ||= ""
            clear_this w, r, c, color, len
            print_this(w, desc, color, r,c)
          end
          action = item.action
          case action
            #when Array
          when PromptMenu
            # submenu
            menu = action.options
            title = rc.title
            rc.title title +" => " + action.text # set title of window to submenu
          when Proc
            #rc.destroy
            ##bottom needs to be refreshed somehow
            #FFI::NCurses.ungetch ?j
            rc.hide
            ret = action.call
            break
          when Symbol
            if @caller.respond_to?(action, true)
              rc.hide
              $log.debug "XXX:  IO caller responds to action #{action} "
              ret = @caller.send(action)
            elsif @caller.respond_to?(:execute_this, true)
              rc.hide
              ret = @caller.send(:execute_this, action)
            else
              alert "PromptMenu: unidentified action #{action} for #{@caller.class} "
              raise "PromptMenu: unidentified action #{action} for #{@caller.class} "
            end

            break
          else 
            $log.debug " Unidentified flying class #{action.class} "
            break
          end
        end # while
      ensure
        rc.destroy
        rc = nil
      end
    end
def display_columns config={}
      prompt = config[:prompt] || "Choose: "
      require 'canis/core/util/rcommandwindow'
      layout = { :height => 5, :width => Ncurses.COLS-0, :top => Ncurses.LINES-6, :left => 0 }
      rc = CommandWindow.new nil, :layout => layout, :box => true, :title => config[:title] || "Menu"
      w = rc.window
      r = 4
      c = 1
      color = $datacolor
      begin
        menu = @options
        $log.debug " DISP MENU "
        ret = 0
        len = 80
        while true
          h = {}
          valid = []
          labels = []
          menu.each{ |item|
            if item.respond_to? :hotkey
              hk = item.hotkey.to_s
            else
              raise ArgumentError, "Promptmenu needs hotkey or mnemonic"
            end
            # 187compat 2013-03-20 - 19:00 throws up
            labels << "%c. %s " % [ hk.getbyte(0), item.label ]
            h[hk] = item
            valid << hk
          }
          #$log.debug " valid are #{valid} "
          color = $datacolor
          #print_this(win, str, color, r, c)
          rc.display_menu labels, :indexing => :custom
          ch=w.getchar()
          rc.clear
          #$log.debug " got ch #{ch} "
          next if ch < 0 or ch > 255
          if ch == 3 || ch == ?\C-g.getbyte(0)
            clear_this w, r, c, color, len
            print_this(w, "Aborted.", color, r,c)
            break
          end
          ch = ch.chr
          index = valid.index ch
          if index.nil?
            clear_this w, r, c, color, len
            print_this(w, "Not valid. Valid are #{valid}. C-c/C-g to abort.", color, r,c)
            sleep 1
            next
          end
          #$log.debug " index is #{index} "
          item = h[ch]
          # I don;t think this even shows now, its useless
          if item.respond_to? :desc
            desc = item.desc
            #desc ||= "Could not find desc for #{ch} "
            desc ||= ""
            clear_this w, r, c, color, len
            print_this(w, desc, color, r,c)
          end
          action = item.action
          case action
            #when Array
          when PromptMenu
            # submenu
            menu = action.options
            title = rc.title
            rc.title title +" => " + action.text # set title of window to submenu
          when Proc
            #rc.destroy
            ##bottom needs to be refreshed somehow
            #FFI::NCurses.ungetch ?j
            rc.hide
            ret = action.call
            break
          when Symbol
            if @caller.respond_to?(action, true)
              rc.hide
              $log.debug "XXX:  IO caller responds to action #{action} "
              ret = @caller.send(action)
            elsif @caller.respond_to?(:execute_this, true)
              rc.hide
              ret = @caller.send(:execute_this, action)
            else
              alert "PromptMenu: unidentified action #{action} for #{@caller.class} "
              raise "PromptMenu: unidentified action #{action} for #{@caller.class} "
            end

            break
          else 
            $log.debug " Unidentified flying class #{action.class} "
            break
          end
        end # while
      ensure
        rc.destroy
        rc = nil
      end
    end
Display prompt_menu in columns using commandwindow
 This is an improved way of showing the "most" like menu. The earlier
 format would only print in one row.