Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How do I give focus to a figure?
Date: Mon, 29 Oct 2007 07:45:26 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <fg432m$h3a$1@fred.mathworks.com>
References: <fg3s2p$jgd$1@fred.mathworks.com> <fg3sb4$9aa$1@canopus.cc.umanitoba.ca> <fg3t05$85b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1193643926 17514 172.30.248.37 (29 Oct 2007 07:45:26 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 29 Oct 2007 07:45:26 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:435014



"Jochen Smolka" <ja511@gmx.de> wrote in message
<fg3t05$85b$1@fred.mathworks.com>...
> Thanks for your fast reply, 
> 
> both the buttons and the axis are in the same figure.
> Therefore, unfortunately,  neither 
> > set(0,'CurrentFigure',figurenumber)
> nor
> > figure(figurenumber)
> work, because afterwards the focus (and 'CurrentObject') are
> still on the recently pressed button.
> 
> I'd be grateful for any other ideas, 
> 
> Jochen
> 


May be this will help you:

figure('keypressfcn','disp(''Key press evaluated in
figure'')') ;
h = uicontrol('style','pushbutton',...
 'string','press me', ...
 'callback','disp(''callback of button'')') ;

% (ugly) work around

set(h,'keypressfcn','eval(get(gcbf,''keypressfcn''))')


hth
Jos