I think I'm having trouble with the syntax for how an object refers to itself, specifically when used in Tk callbacks. Sample code:
class MyDialog
def initialize
@self = self
end
def makeButton
TkButton.new(myFrame) do
text "Do Cool Stuf"
command @self.buttonCallback
pack('side'=>'top')
end
end
def buttonCallback
// stuff
end
end
This seems just fine, but when I click on the button, I get an error saying
NoMethodError: undefined method `buttonCallback' for nil:NilClass
How do I make the button press call into the instance of MyDialog that created it?