From: Steven Lord on

"Jonas " <i_wear_pants(a)hotmail.com> wrote in message
news:hqsgfh$glh$1(a)fred.mathworks.com...
> Alright, sounds good. A few questions though: How do I give the handles
> to an object, and do I need to do anything to ensure that they are up to
> date at the time the datagramreceivedfcn requests them from the object?

Rather than passing the handles structure, pass an individual field of the
handles structure corresponding to something inside the GUI (I suggested the
GUI figure, as other pieces of the GUI could be deleted without the GUI
itself ceasing to function, but if you don't have a GUI figure you don't
have a GUI) and then retrieve the handles with GUIDATA once you get into the
function.

In this scenario, as long as that object corresponding to that individual
handle still exists when you call GUIDATA on it, you will receive the
handles structure for the figure that contains it. If you've closed the GUI
figure between when you created the cell array and when you invoke that
function, obviously the handles structure for that figure will no longer
exist and so GUIDATA will error.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Jonas on
It works!

Thanks a bunch.
From: Jonas on
Unfortunately, I now have a follow-up question/problem, which you might call the reverse of the first one:

I can't get the handles that are used in the datagramreceivedfcn to be passed back to the GUI. If I'm changing the string property of text in the GUI within this function, nothing happens on the GUI, even if I follow it with guidata(figure,handles) ('figure' being the name of the GUI's figure object that was previously passed to datagramreceivedfcn). How can I get this to happen?

I suppose it might help me to understand why this callback seems to be treated differently than, for example, pushbutton callbacks.