如何让控件不可见?

发布于 2024-10-09 10:35:08 字数 1277 浏览 0 评论 0原文

我已经制作了几个 TextCtrl 和 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

我在 docsGoogle 今天对我来说也不是朋友了。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼角的笑意。 2024-10-16 10:35:08

由于它们位于 sizer 中,因此您将能够使用 Sizer#show

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

这适用于 BoxSizer 和 FlexGridSizer。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文