It appears from the wx 2.8.7 documentation that a wxSizerItem has a show() method. But when I try to invoke it through wxruby, I get: tasks.rb:56:in `do_btn3'': undefined method `show'' for #<SWIG::TYPE_p_wxSizerItem:0xb5eedf44> (NoMethodError) Is this just something that hasn''t been added because people don''t manipulate wxSizerItems much, or is it something deeper than that? Or am I doing something stupid? The reason this comes up is that I am trying to use spacers in a dynamic way, "collapsing" them with show(false) when needed. Thanks, Bob _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
Hello Robert, Actually, the best thing to do, is for you to use the Root Sizer, EG: BoxSizer, FlexGridSizer, Etc, etc, to utilize the #layout() method, to update the controls being displayed, and utilize the Window#show() method on the actual control, instead of the sizer item. An example would be: def on_click_hide() @my_control.show(false) self.sizer.layout() end This will cause the control to be hidden, and to call layout() to re-size all of the children controls that have been added to the Sizer. L8ers, Mario Steele On 12/28/07, Robert Anderson <rwa000 at gmail.com> wrote:> > > It appears from the wx 2.8.7 documentation that a wxSizerItem has a show() > method. But when I try to invoke it through wxruby, I get: > > tasks.rb:56:in `do_btn3'': undefined method `show'' for > #<SWIG::TYPE_p_wxSizerItem:0xb5eedf44> (NoMethodError) > > Is this just something that hasn''t been added because people don''t > manipulate wxSizerItems much, or is it something deeper than that? Or am I > doing something stupid? > > The reason this comes up is that I am trying to use spacers in a dynamic > way, "collapsing" them with show(false) when needed. > > Thanks, > Bob > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071228/2fb9468f/attachment.html
On Dec 28, 2007 12:06 AM, Mario Steele <mario at ruby-im.net> wrote:> Hello Robert, > > Actually, the best thing to do, is for you to use the Root Sizer, EG: > BoxSizer, FlexGridSizer, Etc, etc, to utilize the #layout() method, to > update the controls being displayed, and utilize the Window#show() method on > the actual control, instead of the sizer item. >Mario, If I am using the add() method on the sizer which adds a spacer, is there a control at all? *wxSizerItem<http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritem> ** *Add*(*int **width*, *int **height*, *int **proportion = 0*, *int **flag = 0*, *int **border = 0*, *wxObject<http://www.wxwidgets.org/manuals/stable/wx_wxobject.html#wxobject>* **userData = NULL*); Thanks, Bob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071228/9aa0edaf/attachment.html
Robert, I don''t believe there is an actual control returned from #add() method that is utitlized to add a spacer. It is more then nothing an internal data structure in which to show that something occupies that space, but nothing is actually drawn for that space itself. If you need to dynamically add/remove spacers, I would suggest utilizing #remove() to remove it. wxSizerItem is not employed within wxRuby, as it''s of more use internally, then externally. On 12/28/07, Robert Anderson <rwa000 at gmail.com> wrote:> > > On Dec 28, 2007 12:06 AM, Mario Steele <mario at ruby-im.net> wrote: > > > Hello Robert, > > > > Actually, the best thing to do, is for you to use the Root Sizer, EG: > > BoxSizer, FlexGridSizer, Etc, etc, to utilize the #layout() method, to > > update the controls being displayed, and utilize the Window#show() method on > > the actual control, instead of the sizer item. > > > > Mario, > > If I am using the add() method on the sizer which adds a spacer, is there > a control at all? > > * wxSizerItem<http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritem> > ** *Add*(*int **width*, *int **height*, *int **proportion = 0*, *int **flag > = 0*, *int **border = 0*, * wxObject<http://www.wxwidgets.org/manuals/stable/wx_wxobject.html#wxobject>* > **userData = NULL*); > > Thanks, > Bob > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071228/bd9b668e/attachment-0001.html
Mario, Thanks for your suggestions. I worked around this issue by using wxPanel as a "dummy" item in the sizer. Then I have something concrete to hide/show. Thanks, Bob On Dec 28, 2007 2:25 AM, Mario Steele <mario at ruby-im.net> wrote:> Robert, > > I don''t believe there is an actual control returned from #add() method > that is utitlized to add a spacer. It is more then nothing an internal data > structure in which to show that something occupies that space, but nothing > is actually drawn for that space itself. If you need to dynamically > add/remove spacers, I would suggest utilizing #remove() to remove it. > wxSizerItem is not employed within wxRuby, as it''s of more use internally, > then externally. > > On 12/28/07, Robert Anderson <rwa000 at gmail.com> wrote: > > > > > On Dec 28, 2007 12:06 AM, Mario Steele <mario at ruby-im.net> wrote: > > > > > Hello Robert, > > > > > > Actually, the best thing to do, is for you to use the Root Sizer, EG: > > > BoxSizer, FlexGridSizer, Etc, etc, to utilize the #layout() method, to > > > update the controls being displayed, and utilize the Window#show() method on > > > the actual control, instead of the sizer item. > > > > > > > Mario, > > > > If I am using the add() method on the sizer which adds a spacer, is > > there a control at all? > > > > * wxSizerItem<http://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritem> > > ** *Add*(*int **width*, *int **height*, *int **proportion = 0*, *int **flag > > = 0*, *int **border = 0*, * wxObject<http://www.wxwidgets.org/manuals/stable/wx_wxobject.html#wxobject>* > > **userData = NULL*); > > > > Thanks, > > Bob > > > > > > > > _______________________________________________ > > wxruby-users mailing list > > wxruby-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/wxruby-users > > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20071228/2b0d6a94/attachment.html