> Hi,
>
[quoted text clipped - 13 lines]
> the numbers change slightly between the two handles (i.e. checkbox3 goes
> from 320.0040 to 320.0039). Could this be causing the problem?
I don't believe we state anywhere in the documentation that when a Handle
Graphics object is saved to a FIG-file and reloaded its handle will remain
the same. Therefore I don't think you should make that assumption.
Instead, I'd key off the Tag property of the objects -- save the appropriate
data in a struct, then store those structs as fields of a main struct, with
the Tag of the object being the fieldname in the main struct.
For instance, if the main struct is saveddata, then saveddata.Pushbutton1
would be a struct containing the saved data for the object whose Tag is
Pushbutton1.
To restore the state, take advantage of the fact that this two-input form of
SET works:
SET(H,a) where a is a structure whose field names are object
property names, sets the properties named in each field name
with the values contained in the structure.
set(handles.Pushbutton1, saveddata.Pushbutton1)

Signature
Steve Lord
slord@mathworks.com
William - 07 Oct 2008 04:32 GMT
Hi Steve,
Thanks for the quick reply! Am I correct in thinking that the way to save the entire handles structure of a pop-up menu is with:
myStruct.popupmenu1 = get(handles.popupmenu1);
I have now saved each handles structure for all of the components of my GUI. The problem I am seeing now, is that when I use the command:
set(handles.popupmenu1,myStruct.popupmenu1);
I get the following error:
Error using ==> set
Attempt to modify read-only uicontrol property: 'BeingDeleted'.
Is there something I need to disable to be able to copy the entire handles structure for each GUI component?
I also want to add that during the opening function of my main GUI, I copy the entire handles structure into a new structure called hFig_main (hFig_main = handles;). I have two other GUIs which work along this one and they use the handles structures hFig_plot and hFig_output. In my main GUI, the code above is actually:
myStruct.popupmenu1 = get(hFig_main.popupmenu1); and
set(hFig_main.popupmenu1,myStruct.popupmenu1);
Will this cause additional issues with copying the handles from each component. My initial assumption is that it shouldn't cause issues. I have been wrong many times before, however!
Thanks again for your help!!
Respectfully,
Bill King