使用TAB在红色语言的字段之间移动

编程入门 行业动态 更新时间:2024-10-26 22:30:07
本文介绍了使用TAB在红色语言的字段之间移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下简单代码:

Red [] view [ text "Value of x:" f1: field "" return text "Value of y:" f2: field "" return text "Read Sum:" tt: text "" return button "Calculate" [ tt/text: to-string ((to-integer f1/text) + (to-integer f2/text)) ] button "Quit" [quit] ]

如何添加代码,以便可以使用TAB键在不同字段之间移动?显然,这适用于Rebol( www.rebol/how-to/fields.html ),但在这里不起作用.

How can I add code so that one can move between different fields using TAB key? Apparently, this works in Rebol ( www.rebol/how-to/fields.html ) but is not working here.

推荐答案

根据 gitter存档

handle-key: function [e prev-fld next-fld][ k: e/key if k = tab [ either e/shift? [win/selected: prev-fld][win/selected: next-fld] ] ] view [ text "Value of x:" f1: field "" on-key [handle-key event tt f2] return text "Value of y:" f2: field "" on-key [handle-key event f1 tt] return text "Read Sum:" tt: text "" on-key [handle-key event f2 f1] return button "Calculate" [ tt/text: to-string ((to-integer f1/text) + (to-integer f2/text)) ] button "Quit" [quit] do [win: self win/selected: f1] ]

更多推荐

使用TAB在红色语言的字段之间移动

本文发布于:2023-07-16 23:09:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1126889.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   红色   语言   TAB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!