Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: guidata returns empty array on CreateFcn callback?
Date: Fri, 9 May 2008 16:15:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 37
Message-ID: <g01ta9$3bh$1@fred.mathworks.com>
References: <g01re7$5t4$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210349705 3441 172.30.248.35 (9 May 2008 16:15:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 May 2008 16:15:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 939004
Xref: news.mathworks.com comp.soft-sys.matlab:467616



For all the gui's i've made, I've never used the createfcn's
(since the "runs during object creation" is a little too
ambiguous for my tastes).... But it sounds like you can
instead modify the the gui opening function to do exactly
what you need.

As for the whole guidata business... I've made some really
complicated gui's and I've never needed any command besides
guidata. A few things to remember:

If you are calling a function (for example, a callback) that
uses "handles" within another function call guidata before
(to save) and after (to reload): 

function outerfunction(hObject,evetdata,handles)
...
guidata(gcf,handles)
myfunction(handles)
handles=guidata(gcf)
...
%more lines
%resave at end of function:
guidata(gcf,handles)



Always remember to save handles at the end of your functions:

guidata(gcf,handles)


In general I also get better results by ONLY using guidata
to save/load handles, as opposed to ever having handles as
an input or output of a function (like guide does).