Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Darkroom

Guest
Original poster
Dec 15, 2006
2,445
0
Montréal, Canada
i've read one book on Objective-C, am currently reading a book on Cocoa Programming, and i've just ordered 2 more books on C and Objective C... after reading those i plan on reading the Cocoa Programming book again... learning is a process that's different for everyone... i learn a lot from example.

and it's still not working... it tells me that windowColor may not respond to fillColor...?

i will be continuing to learn cocoa programming after i manage to have this problem solved, and over time it will become easier... but for now, it's not easy... and i'm not sure how correct it is that some people feel they have to walk on egg shells for asking questions in a developer forum.

[EDIT] ok so at first i didn't really get what you were talking about (classes communicating thru accessors), and i sort of still don't, but i *think* i do now...

so to the view class i added:

Code:
.h file-------------------------------
- (NSColor *)fillColor;

.m file------------------------------
- (NSColor *)fillColor
{
return fillColor;
}

and the controller class i added as you suggested:
Code:
.m file------------------------------
- (BOOL)validateMenuItem:(NSMenuItem *)item 
	{
	int itemTag = [item tag];
	if ((itemTag == 5 || itemTag == 6) && ([[NSColorPanel sharedColorPanel] isKeyWindow]))
		return NO;
	if ((itemTag == 7 || itemTag == 8) && ([myWhiteSelection fillColor] == [NSColor whiteColor]))
		return NO;
	return YES;
	}

i do not receive any compile errors, but ultimately it doesn't work. when the view is white, the menu item is still enabled.

[EDIT AGAIN] nevermind, it totally works now... i forgot to change the tags in interface builder :eek:

thanks to everyone for replying
 

lucasgladding

macrumors 6502
Feb 16, 2007
319
1
Waterloo, Ontario
i've read one book on Objective-C, am currently reading a book on Cocoa Programming, and i've just ordered 2 more books on C and Objective C... after reading those i plan on reading the Cocoa Programming book again... learning is a process that's different for everyone... i learn a lot from example.

and it's still not working... it tells me that windowColor may not respond to fillColor...?

i will be continuing to learn cocoa programming after i manage to have this problem solved, and over time it will become easier... but for now, it's not easy... and i'm not sure how correct it is that some people feel they have to walk on egg shells for asking questions in a developer forum.

It's great that you're reading, but you should be pretty comfortable with what you have read before you move onto your own projects. Take the time to write and build the examples/tutorials provided in the books. Some of the issues you have had suggest that you should go back to re-read anything about class methods vs instance methods and getter and setter methods. I'm not trying to insult you, it's just that many of your questions should have been answered by examples in the books. Many of these issues are the kinds of things that I suspect are skimmed over by new programmers because they seem obvious.

I'm guessing that you haven't declared the getter/setter methods in your view's header file.

There is a very, very, very big difference between walking on egg shells and checking your code before coming to other programmers for help. It wasn't long ago that I began programming and I'm trying to help where I can on these forums. If you read your thread, you will see that many have corrected you about class methods vs instance methods and your last post still contained:

Code:
...[color whiteColor]...

Again, I'm sorry if I'm coming across as harsh, but you have missed some concepts that have been pointed out multiple times in this thread.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.