检测前端令牌是否可用于执行
如何检测前端令牌是否可以执行?或者,如何检测前端令牌是否执行失败?
示例:编辑->如果未选择任何内容,则复制命令不可用。在这种情况下,FrontEndTokenExecute["Copy"]
只会发出蜂鸣声,但它没有给我任何(编程)指示它已失败。
How can I detect if a front end token is available to execute? Alternately, how can I detect if a front end token failed to execute?
Example: the Edit -> Copy command is not available if nothing is selected. FrontEndTokenExecute["Copy"]
will simply beep in this case, but it gives me no (programmatic) indication that it has failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一种方法来处理你的第二个问题,但它并不优雅:
Preferences > 中接口>消息和警告操作
将次要用户界面警告设置为蜂鸣声并打印到控制台Notebooks[]
左右)NotebookGet[NotebookObject[FrontEndObject[LinkObject["55d_shm", 1, 1]], 1]]/。笔记本[{___,单元格[a___]},___]:> Cell[a]
(当然,您的句柄看起来会有所不同)Cell["您试图编辑不可编辑的单元格。您可以将 \
通过在“单元格属性”中选择“可编辑单元格”来编辑单元格
子菜单。", "消息", "消息", "MSG", 页宽 -> 窗口宽度,
显示单元格标签 ->确实,CellChangeTimes -> {3.534442831*10^9},
单元标签 -> "cantEditLockedCell"]
I found a method to deal with your second question, but it's not elegant:
Preferences > Interface > Message and Warning actions
set Minor user interface warnings to Beep and Print to ConsoleNotebooks[]
or so)NotebookGet[NotebookObject[FrontEndObject[LinkObject["55d_shm", 1, 1]], 1]]/. Notebook[{___, Cell[a___]}, ___] :> Cell[a]
(your handle will look differently, of course)Cell["You tried to edit a cell that is not editable. You can make the \
cell editable by choosing Cell Editable in the Cell Properties \
submenu.", "Message", "Message", "MSG", PageWidth -> WindowWidth,
ShowCellLabel -> True, CellChangeTimes -> {3.534442831*10^9},
CellTags -> "cantEditLockedCell"]