Re: Disabled controls don't update their visual appearance
Re: Disabled controls don't update their visual appearance
- Subject: Re: Disabled controls don't update their visual appearance
- From: Christopher Campbell Jensen <email@hidden>
- Date: Sat, 15 Aug 2009 18:43:44 +0200
No, it's a just a regular application. It's functionality is very
similar to MetaX (an mp4 tagging tool), in that it has a file viewer
where you can have a bunch of files open, when you select one it
updates all the fields in the rest of the UI to reflect the
information contained and selected previously for that file. This
context switch has caused me a lot of headaches, and I am sure I have
gone about it all wrong, but it works now, all except the updating of
those fields.
Your question concerning if I was using an nsdocument based app made
me question if perhaps that would have been a better idea, but it
seems that each window in an nsdocument based core data app keeps it's
own database, while I would want all of them to share one database + I
really want just one window, and the selection of a new file in the
"file viewer"/nstableview to update the context. I am certain there is
a perfect design pattern that I should have used, instead of my ramble
of code.
The "model" is kept in both the core data repository, and then the
current selected stuff is kept in an object that contains both the
file path and the meta data related to that file.
If anyone dares/wishes to look at the code, it is available here:
http://www.mediafire.com/file/arjmmgdzwyz/MP4BatchTagger.tgz
I warn you though, this is the first app from a nice objective-c/cocoa
programmer, and it is not as neat as I wish it could have been. I have
had a few uphill battles, and it will be evident in the code.
Oh, and not everything is implemented, and there is some debug stuff
still in there. If you do a search, then click the cancel button, some
mock entries will be added to the core data db to play around with.
Chris
On 15 Aug 2009, at 06:45, Uli Kusterer wrote:
On Aug 11, 2009, at 5:45 PM, Christopher Campbell Jensen wrote:
To check when/if any of them were nil, I set a breakpoint and
stepped through the code pausing it each time
"refreshButtonsEnabledState" was called and it made me realise that
the buttons fail to update their state the first time the method
gets called and movieFile is nil. When I, at the end of the movie,
again click on the second tab item, "refreshButtonsEnabledState"
gets called and at this point movieFile is still nil. How come it
works the second time around, and not the first?
Is this an NSDocument-based app? You may want to re-read the
relevant chapter in Hillegass' book: You generally get the "load
document" message before the NIB has been loaded at startup (though
you may also get it afterwards, e.g. when the user chooses the
"revert" menu item). Your code should only load its model into
ivars, and try to update the GUI (if it is there) in *both* the load
method (for the case where it's a revert) and the
windowControllerDidLoadNib method (for the regular "open" case.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden