rubywxwidgetsinvisiblewxruby

How to make a control invisible?


I've made several TextCtrls and Button, but currently users of my application don't want to see them. So I have to hide them temporary (for current build).
Here they are:

class MainFrame < Wx::Frame
    def initialize (parent = nil)
        super nil,:title=>"sometitle",:size=>[600,600]
        set_sizer Wx::BoxSizer.new Wx::VERTICAL

        @tag1 = Wx::TextCtrl.new self
        sizer.add_item @tag1,:flag=>Wx::RIGHT|Wx::EXPAND
        @tag1.set_value 'property'

        @tag1title = Wx::TextCtrl.new self
        sizer.add_item @tag1title,:flag=>Wx::RIGHT|Wx::EXPAND
        @tag1title.set_value 'title'

        @tag2 = Wx::TextCtrl.new self
        sizer.add_item @tag2,:flag=>Wx::RIGHT|Wx::EXPAND
        @tag2.set_value 'description'

        @tag2title = Wx::TextCtrl.new self
        sizer.add_item @tag2title,:flag=>Wx::RIGHT|Wx::EXPAND
        @tag2title.set_value ''

        @button_parse = Wx::Button.new self
        sizer.add_item @button_parse
        @button_parse.label = "Parse XML"
        evt_button @button_parse, :click_parse

        # ......
    end
    # ......
end

I see nothing about it in docs and Google is also not a friend for me today.


Solution

  • Since they are in a sizer, then you'll be able to use Sizer#show.

    Boolean show(Sizer sizer,  
             Boolean show = false, 
             Boolean recursive = false)
    

    This works for BoxSizer and FlexGridSizer.