如何获取 Rebol 中的单选按钮值?
我尝试了这个,但颜色未知(我在互联网上进行了搜索,令人惊讶的是没有一个人记录它!):
V: view layout [
across
label "Colours:"
r: radio of 'colours l: label "Red"
radio of 'colours label "Green"
radio of 'colours label "Blue"
return
label "Fruits:"
radio of 'fruits label "Apples"
radio of 'fruits label "Oranges"
button "close" [unview]
]
probe colors
I tried this but colors is unknown (I searched all over internet amazingly not one single person has documented it !):
V: view layout [
across
label "Colours:"
r: radio of 'colours l: label "Red"
radio of 'colours label "Green"
radio of 'colours label "Blue"
return
label "Fruits:"
radio of 'fruits label "Apples"
radio of 'fruits label "Oranges"
button "close" [unview]
]
probe colors
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信单选按钮的设计是您命名并检查每个按钮:
要从“颜色”一词中获得答案,您必须遍历面孔以查找具有该关系的面孔。 是一个快速而肮脏的迭代器(walk-vid):
这 ,迭代人脸,查找关系,找到选定的人脸。让我们为此创建一个函数:
因此总结一下:
为了让生活更轻松,您可以向单选按钮添加面部/文本值(标签不绑定到按钮):
I believe radio buttons were designed that you named and checked each button:
To get the answer from the word 'colours, you will have to iterate through faces to find faces with that relationship. Here's a quick and dirty iterator (walk-vid):
So, iterate through faces, find relationship, find the selected face. Let's make a function for that:
Thus to wrap up:
To make life easier, you can add a face/text value to the radio button (labels are not bound to the button):
VID 方言不提供开箱即用的此类功能,但很容易添加。
假设您想更改所有单选按钮样式,否则您需要删除 /master 细化。
VID dialect does not provide such feature out of the box, but it is easy to add.
Supposing you want to alter all radio button styles, else you would need to remove /master refinement.
在 R3GUI 中,单选按钮按邻近程度进行分组,您可以通过命名每个按钮来获取它们的值。
In R3GUI radio buttons are grouped by proximity, and you can get their values by naming each button.