Sha256: 4bff6bf59d6fa21eb7e41ec8e97e2f9bcd96d994c4f92307d10538547929859b

Contents?: true

Size: 594 Bytes

Versions: 5

Compression:

Stored size: 594 Bytes

Contents

require_relative 'BaseAction.rb'

module PPCurses
  class PromptAction < BaseAction

    def initialize(prompt)
      @prompt = prompt
    end

    def setParentAction(action)
      @parent = action
    end

    def xPadding()
      if @parent.nil?
        return self.winPadding()
      else
        return @parent.winPadding()
      end
    end

    def printPrompt()
      @win.setpos(@win.cury(), xPadding())
      @win.addstr(@prompt)
    end

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

    def data
      @data
    end 

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ppcurses-0.0.20 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.19 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.18 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.17 lib/ppcurses/actions/PromptAction.rb
ppcurses-0.0.16 lib/ppcurses/actions/PromptAction.rb