From: "Jan Simon" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How do I give focus to a figure?
Date: Tue, 1 Sep 2009 19:25:20 +0000 (UTC)
Organization: Universit&#228;t Heidelberg
Lines: 18
Message-ID: <h7jsf0$k7p$>
References: <fg3s2p$jgd$>
Reply-To: "Jan Simon" <>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1251833120 20729 (1 Sep 2009 19:25:20 GMT)
NNTP-Posting-Date: Tue, 1 Sep 2009 19:25:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869888
Xref: comp.soft-sys.matlab:567672

Dear Jochen Smolka!

> in my application I have a large number of buttons and an
> axis object in a figure. After each button press I would
> like to return focus to the figure, so that key presses are
> evaluated by the figure's KeyPressFcn. Is there a way to do
> this programmatically?

See thread:

There I explained, that the following piece of code can be inserted in the callbacks of the buttons:
  set(hObject, 'Enable', 'off');
  set(hObject, 'Enable', 'on');
[hObject] is the handle of the current button. Then the focus has moved to the figure again. Actually this should be performed by "figure(FigureHandle)" also, but this does not work for unknown reasons.
Unfortunately the above trick does not work for Matlab 2008a.

Good luck, Jan