wxSizerItem show() method

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 methodshow’ 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

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 S.

On Dec 28, 2007 12:06 AM, Mario S. [email protected] 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?

*wxSizerItemhttp://www.wxwidgets.org/manuals/stable/wx_wxsizeritem.html#wxsizeritem
** Add(*int *width, *int *height, *int *proportion = 0, *int
*flag
= 0
, *int *border = 0,
wxObjecthttp://www.wxwidgets.org/manuals/stable/wx_wxobject.html#wxobject
*userData = NULL);

Thanks,
Bob

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

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.