Sha256: dfcd99759041245dfd0d71ec670b3aa151cd61d4616b8cc826d3c155541f0ceb

Contents?: true

Size: 573 Bytes

Versions: 1

Compression:

Stored size: 573 Bytes

Contents

require 'ppcurses/actions/BaseAction.rb'

module PPCurses
  class PromptAction < BaseAction

    def initialize(prompt)
      @prompt = prompt
    end

    def setParentAction(action)
      @parent = action
    end

    def printPrompt()
      if @parent.nil?
        @win.setpos(@win.cury() + 1, self.winPadding())
      else
        @win.setpos(@win.cury(), @parent.winPadding())
      end
      @win.addstr(@prompt)
    end

    def execute()
      printPrompt()
      echo
      @data = @win.getstr()
      noecho
    end

    def data
      @data
    end 

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ppcurses-0.0.10 lib/ppcurses/actions/PromptAction.rb