Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: guidata returns empty array on CreateFcn callback?
Date: Fri, 9 May 2008 15:43:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 28
Message-ID: <g01re7$5t4$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 1210347783 6052 172.30.248.37 (9 May 2008 15:43:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 9 May 2008 15:43:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1215962
Xref: news.mathworks.com comp.soft-sys.matlab:467611



Hello all!

I have a listbox which I'm trying to populate with some
information I'd like to save. The listbox should populate as
soon as the figure shows, so I've added the code within the
CreateFcn callback. The GUIDE skeleton for the function
(MATLAB R12.1) is:

function varargout = listbox_CreateFcn(h, eventdata,
handles, varargin)

The 'handles' variable is empty. When I try to call
guidata(h), it also returns an empty array. guihandles
returns all of the handles in the figure, but when I try to
call guidata to save to any of the handles returned by
guihandles, they don't seem to save so they're accessible by
other callbacks later on. I'm very confused about what
approach to use for GUIs:

1) guidata -- seems you can both save and retrieve, so only
one function is required
2) setappdata/getappdata -- use one or the other to save and
retrieve. Why would this be used above guidata?
3) global variables -- this is another way to store
application data
4) guihandles -- what's the difference between this and
calling guidata with a single argument?