用红色语言打印出所有GUI元素的文本 [英] Printing out text of all GUI elements in Red language

查看:111
本文介绍了用红色语言打印出所有GUI元素的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下代码从所有GUI元素中打印出文本:

I am trying to print out text from all GUI elements in following code:

  sentlist: ["A" "B" "C"]

  main: function [slist] [
      view collect [
          repeat i length? slist [
              keep compose [
                  text (slist/:i)
                  field "" 
                  return ]]
          keep [button "Printall" [
              repeat i (2 * length? slist)[
                  print face/parent/pane/(i)/text  ]]]]]

 (main sentlist) 

它可以正常运行,没有任何错误,并且正确打印了text元素的文本,但是对于fields,每个字段仅打印出最后一个字段的条目.问题出在哪里,如何解决?感谢您的帮助.

It runs all right without any error and text elements' text are properly printed out, but for fields, only last field's entry is printed out for each field. Where is the problem and how can it be corrected? Thanks for your help.

推荐答案

在您的规范中,field ""对每个字段重复使用相同的字符串.更改一个字段会更改每个字段的文本(可能出于效率原因,这不会反映在GUI中).您可以将行更改为field (copy "")以提供唯一的字符串.

In your spec field "" reuses the same string to each of the fields. Changing one field changes the text for each (likely for efficiency reasons, this is not reflected in the GUI). You could change the line to field (copy "") to provide a unique string.

这篇关于用红色语言打印出所有GUI元素的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆