【发布时间】:2017-09-18 08:33:16
【问题描述】:
我正在使用以下代码查找 2 系列数字的产品,然后找到这些产品的总和:
make-row: func [][
compose [
t1: text "N1:"
f1: field
t2: text "N2: "
f2: field
t3: text "Product: "
t4: text ""
b: button "Get product" [
x: face/extra/2/text
y: face/extra/4/text
z: (to-integer x) * (to-integer y)
face/extra/6/text: rejoin [z]]
do [b/extra: reduce [t1 f1 t2 f2 t3 t4]] ] ]
view compose [
(make-row) return
(make-row) return
b: button "Calculate" [t2/text: "..to be given"]
t1: text "Sum of products:"
t2: text "" ; NEED TO GET SUM OF ALL PRODUCTS IN ABOVE ROWS.
]
第一部分工作正常 - 产品计算正确。但是我怎样才能访问这些单独的产品来找到产品的总和呢?我找不到任何方法,因为这些行并不是我可以访问的公共变量或方法/函数的真正对象。如何解决?感谢您的帮助。
【问题讨论】:
-
在
b/extra: reduce [t1 f1 t2 f2 t3 t4],为什么你以后只使用了3个人脸参考,你却保存了6个?