GUI Keyboard Commands HELP

1 次查看(过去 30 天)
Hi,
I have a complex GUI, but I have what I think is a fairly simple problem.
I have keyboard commands set to various commands including button presses (This is because eventually the GUI needs to operate as keyboard only). The problem I have is that I have to manually click the figure window before it allows the GUI to recognise that I'm pressing keyboard buttons.
Is there a way to set the current figure to be the focus so that I don't need to use the mouse?
Thanks in advance!
JD

采纳的回答

Sean de Wolski
Sean de Wolski 2012-12-11
Yes!
You need to steal focu back to the figure from whatever uicontrol/uipanel/axes/etc. has stolen it.
To do this, at the end of a callback function for one of these widgets:
set(H, 'Enable', 'off');
drawnow;
set(H, 'Enable', 'on');
Where H is the handle to that widget.
  4 个评论
Jan
Jan 2012-12-12
@John: In Sean's example, H is the handle of the uicontrol or axes object, not the handle of the figure.
John
John 2013-2-19
Thanks Saun and Jan. Much appreciated. I've been working on other stuff until now so sorry for the delay in my thanks!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by