如何让控件不可见?
我已经制作了几个 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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于它们位于 sizer 中,因此您将能够使用 Sizer#show。
这适用于 BoxSizer 和 FlexGridSizer。
Since they are in a sizer, then you'll be able to use Sizer#show.
This works for BoxSizer and FlexGridSizer.