App settings revert to preference if app hidden/unhidden

if I “Hide” my ASS app, when I re-activate it all the settings go back to what was stored in the preferences (also the window position) how do I stop this?

I tried making a “will hide” and “will show” handler (I don’t remeber the exact names now) to set and read variables for the settings, but it didn’t work… would I have to set it to actually write to the user defaults and then read it agian afterwards?
and what is the best “on” handler to use in this situation??

I tried searching for “hiding” and didn’t get what I was looking for.

also, I opened Activity viewr while my app was running and it seems to use a hell of a lot of CPU tmie (50-70% of my dual 1 gig) is this normal? this is when the apps is running it’ss main script which has a couple of repeat routines on 1 second loops and a progress indicator.


I would guess that you are using an event related to a window ‘opening’ rather than to it’s awakening or launching. From what I can tell, hiding has the same effect on your window that closing it does, so when you ‘un-hide’ it, it really is re-creating it from scratch. You should try using a handler like on awake from nib or on launch, either attached to your window, or better yet to your file’s owner, that way you won’t have to worry about it reloading every time the window ‘opens’. I tried this with awake from nib on both window and file owner, and it worked correctly.

Can’t say much about the CPU load. Could be your loops, could be faulty code, you’d have to remove things one at a time to find out what part of the code is the culprit.


Sorted! I got it to work, thanks :slight_smile: