Hey there - I am having trouble figuring out the best way to access
attributes among multiple windows. What I want is a main Shoes.app window
that spawns windows which can exchange data with the main Shoes.app window.
What I would *like* to do, is somehow keep track of all of the Shoes::APP
objects which belong to the main app and be able to access ad modify their
attributes. I thought that I had a clever idea when I did this

Shoes.app do
  self.class.class_eval do
    attr_accessor :tribute, :stack1
  end


  @tribute = "main app"
  button "new window" do
    @win = window :title => "new window" do
      @stack1 = stack {para "this is a paragraph"}
    end

  end
  button "clear" do
    debug @win.stack1.class
    @win.stack1.append "yet another"
  end
end

When I hit the "clear" button on the main window the first time, I get

debug => Shoes::Stack
Error => undefined method `call' for nil:NilClass

The next time I hit it, I get this

debug => Shoes::Stack
Error => this slot is already being modified by an append, clear, etc.

So the funny thing is, both times I have managed to get shoes to agree with
me that @win.stack1 should be a Shoes::Stack object, but in both cases I get
weird errors, and of course, the expected behavior does not occur.

Is there some kind of fundamental limitation which is preventing me from
doing this, or does something need to be massaged in just the right way?

Any help is greatly appreciated.

Chris

Reply via email to