如何使控件不可见?

时间:2010-12-30 15:19:52

标签: ruby wxwidgets invisible wxruby

我已经制作了几个TextCtrls和Button,但目前我的应用程序的用户不希望看到它们。所以我必须暂时隐藏它们(当前版本) 他们在这里:

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

我在docs中没有看到任何相关内容,Google今天也不是我的朋友。

1 个答案:

答案 0 :(得分:1)

由于他们使用的是sizer,因此您可以使用Sizer#show

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

这适用于BoxSizer和FlexGridSizer。

相关问题