更改 Rebol 按钮的颜色

发布于 2024-10-10 19:58:24 字数 229 浏览 0 评论 0原文

我想在 Rebol 中问多项选择题。可能的答案将在按钮上。我想在单击按钮时将其变为红色这是错误的答案。当按下正确的按钮时,我想继续下一个问题。

我可以更改盒子的颜色(mybox/color: red show mybox)。我可以设置具有两种颜色的切换(但我无法根据任意测试的结果更改它(答案正确吗?)。

似乎可能有一种简单的方法来更改按钮的颜色,无需创建我自己的类似按钮的面部对象,不是吗?

I want to ask multiple choice questions in Rebol. Possible answers will be on buttons. I want to turn a button red when it is clicked and it is the wrong answer. When the correct button is pressed, I want to proceed to the next question.

I can change the color of a box (mybox/color: red show mybox). I can set up a toggle with two colors (but I can't change it based on the result of an arbitrary test (is the answer correct?).

It seems like there is probably a simple way to change the color of a button, without having to create my own button-like face objects. Isn't there?

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

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

发布评论

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

评论(1

時窥 2024-10-17 19:58:24

这是你想要的吗?该按钮开始呈红色。左键单击将其变为蓝色,右键单击将其变为绿色:

unview/all
view layout [
   my-btn: button 200x50 "left click or right click to change color" red effect []
       [my-btn/color: blue  show my-btn]  ;; effect of left click
       [my-btn/color: green show my-btn]  ;; effect of right click
  ]

您可以在 STYLE 中定义它,以便任何其他按钮都可以继承该行为。

Does this do what you want? The button starts RED. Left click turns it BLUE, right click turns it GREEN:

unview/all
view layout [
   my-btn: button 200x50 "left click or right click to change color" red effect []
       [my-btn/color: blue  show my-btn]  ;; effect of left click
       [my-btn/color: green show my-btn]  ;; effect of right click
  ]

You can define that in a STYLE so any other button can inherit the behavior.

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