本文介绍了您可以限制可以在MATLAB GUI编辑框中键入哪些字符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MATLAB GUI中创建一个编辑框,该编辑框将只允许输入数字或只允许输入字母.这可能吗?

I want to make an editbox in a MATLAB GUI which will only allow numbers or only allow letters to be typed into it. Is this possible?

推荐答案

没有这样的功能,至少没有记载的功能.您可以分配一个回调来检查输入,但是会在用户输入非法字符后 发生.尽管我不知道该怎么做,但我猜想您可以使用Java GUI.
另一个有趣的选择是添加一个可以完成这项工作的ActiveX.

There is no such feature, at least not a documented one.You could assign a callback that will check the input, but that will happen after the user entered illegal character. Though I don't know how exactly to do it, my guess is that you can use Java GUI.
Another interesting option is to add an ActiveX that will do the job.

修改:我找到了可以完成工作的ActiveX .下载它,通过调用

I have found an ActiveX that does the job. Downdload it, register by calling

Regsvr32 NumberBox.ocx

然后在Matlab指南中添加ActiveX.名称将为 NumberBox.NbrTextBox .您可以通过单击指南中的ActiveX按钮来完成此操作:

And thein add an ActiveX in Matlab Guide. The name will be NumberBox.NbrTextBox.You can do it by cliking the ActiveX button in Guide:

这篇关于您可以限制可以在MATLAB GUI编辑框中键入哪些字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 21:36