matlab - 使 MATLAB 编辑器或命令窗口以编程方式获取焦点

标签 matlab window focus alert

Matlab正在处理包含plot()命令的代码时,Matlab将窃取窗口焦点,当plot() 已处理。虽然许多人似乎觉得这种行为很烦人,但我发现它作为一个警报很有用,告诉我绘图何时被处理,并且我可以在 Matlab 运行时做其他事情。

但是,我希望在计算完成时让 Matlab 窃取窗口焦点(Matlab 空闲),而不仅仅是当我包含 plot()figure() 命令。

我发现了一篇关于禁用 plot()figure() 窗口窃取行为的帖子( Inhibit Matlab Window Focus Stealing ),但不能在计算完成时添加窗口窃取行为。能做到吗?

最佳答案

要使Matlab命令窗口获得焦点,可以在计算后添加commandwindow。来自 documentation ,

commandwindow opens the MATLAB® Command Window when it is closed, and selects the Command Window when it is open.

要使现有图窗获得焦点,您可以添加 figure(h),其中 h 是图窗句柄。来自 documentation ,

figure(h) does one of the following [...]

If h is the handle or the Number property value of an existing figure, then figure(h) makes that existing figure the current figure, makes it visible, and moves it on top of all other figures on the screen. The current figure is the target for graphics output.

关于matlab - 使 MATLAB 编辑器或命令窗口以编程方式获取焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32331260/

相关文章:

MATLAB:如何返回向量中的条目?

matlab - 在 Matlab 中取具有 NaN 的矩阵的平均值

arrays - 向量化子数组的加法

MATLAB 排序 2D 和 3D 矩阵并通过索引访问

java - JFrame 始终专注

android - 如何检测任何 subview 何时收到点击

python - 如何获得 pygtk 窗口的大小?

javascript - 在同一屏幕上打开窗口并居中

c++ - 如何在作为控制台启动的应用程序中创建窗口?

css - 选择:焦点{宽度:自动;}