From: Igor Pirnovar Date: 2009-04-22T09:09:23+09:00 Subject: Re: gtk container add/remove malfunction Kevin Redon wrote: > i'm trying to remove and add a widget to a container when an event > occur. removing and adding works outside the event, but only removing > works within It looks that your {{ @options_list }} variable is defined in different scope(s). I should also point out that block scope is handled differently in ruby 1.8 and 1.9, which may complicate your case even further. From how you presented your program snippet and particularly your {{ @options_list }} variable it is not clear whether it is an {{ instance variable }} or a {{ class instance variable }}. Instance variables can only be used from within instance methods. To test my claim that you have a scope problem change your "instance" variable from {{ @options_list }} to global {{ $options_list }}. The program should then work fine; i.e.: here is no "gtk container add/remove malfunction"! To correctly fix your program, and at the same time avoid any differences between ruby 1.8 and 1.9, implement attribute accessor methods and access your instance variables only through their respective objects using the accessor methods (hint: attr_accessor). Good luck, Igor -- Posted via http://www.ruby-forum.com/.