Path: news.mathworks.com!not-for-mail
From: "Thomas Benson" <t.benson@hrwallingford.co.uk>
Newsgroups: comp.soft-sys.matlab
Subject: Re: uisetcolor + activeX ->figure without focus, if compiled
Date: Wed, 4 Nov 2009 09:53:01 +0000 (UTC)
Organization: HR Wallingford
Lines: 34
Message-ID: <hcritt$113$1@fred.mathworks.com>
References: <gpdqsp$29p$1@fred.mathworks.com> <gtphhd$ggg$1@fred.mathworks.com> <h61v4h$hgj$1@fred.mathworks.com> <h6gbut$mco$1@fred.mathworks.com> <h6gck2$59g$1@fred.mathworks.com> <h6h023$lj$1@fred.mathworks.com> <h6h4co$leh$1@fred.mathworks.com>
Reply-To: "Thomas Benson" <t.benson@hrwallingford.co.uk>
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 1257328381 1059 172.30.248.37 (4 Nov 2009 09:53:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 4 Nov 2009 09:53:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 578854
Xref: news.mathworks.com comp.soft-sys.matlab:582307


"matt dash" <n.a@mail.com> wrote in message <h6h4co$leh$1@fred.mathworks.com>...
> "Corbin Holland" <cholland.nospam@opticalsciences.com> wrote in message <h6h023$lj$1@fred.mathworks.com>...
> > "Andreas Greuer" <greuer@remove-this-gmx.de> wrote in message <h6gck2$59g$1@fred.mathworks.com>...
> > > Just compiled the application with the old compiler version 4.6 (R2007a). And there it works fine. 
> > > -> So it seems to be a problem of the new compiler version 4.10 (R2009a)
> > 
> > I ran into the same problem a few months back.  I solved it by adding a tiny pause after the uisetcolor call.  I just wrapped the uisetcolor call and added a slight delay like this:
> > 
> > function newcolor = colorChooser( varargin )
> > 
> > % This is just a wrapper for the uisetcolor function.  I made it so I could add the pause to account
> > % for a bug in the compiled version for 2009a.  
> > 
> > newcolor = uisetcolor(varargin{:});
> > 
> > if (isdeployed)
> >    pause(.1); % necessary for compiled version 2009a or the dialog disappears but prog thinks modal is active
> >               % and you can no longer click on anything at all
> > end
> > 
> > 
> > let me know if any of you come up with a better solution.
> > 
> > - Corbin
> 
> 
> Not sure if it will make a difference, but you could try using a JColorChooser instead of uisetcolor. See the demo file in my file "rgb2name" on the file exchange for an example of how it works. 

Matt,

Thanks for this excellent suggestion. It looks like it solves a similar problem I am having with uisetcolor freezing the main figure in a compiled program (compiled using compiler V79 that is shipped with R2008b). Do you know how to get the JColorChooser to initialise with a colour other than white? (i.e. I want it to start with the colour that is already assigned to a uicontrol).

Thanks in advance
Thomas