From: Håkon Hobæk on
I have a property 'list' in a class 'menu'. In the constructor of menu I have several uicontrols with a callback function. How can I let these callbacks change the property list so that lists stays changed? If I send the menu object 'this' with the callback, it's able to change it, but it only stays changed in the callback function. The next time a callback is made, everything is reset. I kind of want the same effect as 'global', but only in this small environment.

Thanks
From: Steven_Lord on


"Håkon Hobæk" <hakonmh(a)hotmail.com> wrote in message
news:i2c2kf$h1j$1(a)fred.mathworks.com...
> I have a property 'list' in a class 'menu'. In the constructor of menu I
> have several uicontrols with a callback function. How can I let these
> callbacks change the property list so that lists stays changed? If I send
> the menu object 'this' with the callback, it's able to change it, but it
> only stays changed in the callback function. The next time a callback is
> made, everything is reset. I kind of want the same effect as 'global', but
> only in this small environment.

From the description of the behavior, your menu class is a value class.
Consider whether it should be a handle class instead.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brfylwk-1.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

From: Håkon Hobæk on
"Steven_Lord" <slord(a)mathworks.com> wrote in message <i2c4et$dtr$1(a)fred.mathworks.com>...
>
>
> "Hkon Hobk" <hakonmh(a)hotmail.com> wrote in message
> news:i2c2kf$h1j$1(a)fred.mathworks.com...
> > I have a property 'list' in a class 'menu'. In the constructor of menu I
> > have several uicontrols with a callback function. How can I let these
> > callbacks change the property list so that lists stays changed? If I send
> > the menu object 'this' with the callback, it's able to change it, but it
> > only stays changed in the callback function. The next time a callback is
> > made, everything is reset. I kind of want the same effect as 'global', but
> > only in this small environment.
>
> From the description of the behavior, your menu class is a value class.
> Consider whether it should be a handle class instead.
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_oop/brfylwk-1.html
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Thanks