如何强制刷新用户输入? [英] How to force flush a user's input?

查看:166
本文介绍了如何强制刷新用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能从脚本中强制刷新用户输入.

I was wondering if it is possible to force flush of a user input from a script.

上下文如下:我有一张工作表,人们应该在其中输入数据,还有一个按钮,当他们完成操作后单击该按钮,即可处理数据.

The context is the following : I have a sheet in which people are supposed to input data, and a button where they click when they are done, which will process the data.

碰巧,有时候人们双击一个单元格,写下他们想要的内容,但是随后他们在点击回车键之前单击了按钮.因此,脚本认为该单元格仍为空.

It happens that sometimes people double click a cell, write what they want, but then they click the button before hitting return. Thus the script sees the cell as still empty.

是否可以用一种方法强制将其当前键入的内容冲洗掉,或者检测到当前正在编辑一个单元格?

Would there be a way to either force flush with what they have currently typed, or detect that a cell is currently being edited ?

推荐答案

在按Enter键或选择另一个单元格之前,永远不会编辑"该单元格.因此,您可以指示他们单击另一个单元格,或者在单击按钮之前按Enter键.我了解这不是最佳解决方案.但是没有办法检测用户将要输入到单元格中的内容.

The cell is never "edited" until they press enter, or select another cell. So you could instruct them click another cell, or press enter before clicking the button. I understand that this is not the best solution. But there is no way to detect what the user is about to enter in the cell.

您可以将其单击为菜单选项.单击菜单项(请参阅 addMenu ),将文本写入电子表格,以便当他们使用菜单功能时,您将能够阅读它.同样,这可能不是最佳解决方案,但是仍然是一个解决方案.

You could make it a menu option that they click. Clicking on a menu item (see addMenu) writes the text to the spreadsheet so that you will be able to read it when they use their menu function. Again, this may not be the best solution, but it is a solution, nonetheless.

这篇关于如何强制刷新用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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