Sha256: fc53780712e8a5648842b584fd552feadfb5648b19c18eab985683821a7562b7

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

require 'rbcurse/app'

# this was a test to see how i could have a class and an app inside
# and i could call methods in the class and have variables available
# inside App.
#
# instance_eval inside stack and others was causing the issue putting everything in
# App. However, i have to change the app, to use yield in order not to lose context

class Testy
  attr_accessor :value
  def initialize val
    @value = val
    @my = "oldval"
    run
  end
  def amethod
    $log.debug "XXXX amethod called... " if $log.debug? 
    alert " self #{self.class} amethod "
    @my = "hellothere"
  end
  def run
    puts @value
    app = App.new 
    $log.debug " APP : value #{value}" if $log.debug? 
    header = app.app_header "rbcurse #{Rbcurse::VERSION} " , :text_center => " #{@value} Demo", :text_right =>"New Improved!", :color => :black, :bgcolor => :white, :attr => :bold 
    app.message "Press F10 to exit from here #{@value} "

    app.stack :margin_top => 2, :margin => 5, :width => 30 do |s|
      app.label "Hello: ", :attr => :reverse
      f=app.field "abc"
        #amethod() 
      f.bind(:CHANGE) { 
        amethod() 
        app.message "now #{@my} "
      }

    end # stack
    app.safe_loop
  end
end
if __FILE__ == $PROGRAM_NAME
  Testy.new "FFI-NCURSES"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rbcurse-1.4.1 examples/testapp.rb
rbcurse-1.4.1.pre2 examples/testapp.rb
rbcurse-1.4.0 examples/testapp.rb