Beginner Questions
Beginner Questions
- Subject: Beginner Questions
- From: James Spencer <email@hidden>
- Date: Sat, 23 Mar 2002 19:05:43 -0600
I'm hoping some kind soul will bear with a new Cocoa programmer working
through the Learning Cocoa examples and who came up with a couple of
questions that repeated treks through the documentation haven't answered.
1) In the To Do example, the intent of the ADC author(s) was that when a
the calendar was set to the current month, "today's" date would be
highlighted along with the selected date. The sample code in the book
had two problems: (a) it didn't work when the window first opened (the
first day of the month was selected and hightlighted but "today's" date
was not) and (b) both the selected date and "today's" date were
highlighted the same way so you couldn't distinguish them.
I fixed the first problem on my own (I just reversed the order of the
last two lines of CalendarMatrix' awakeFromNib method:
[self choseDay:self];
[self refreshCalendar:self];
I would like to fix the second problem by either putting the text of
today's date in bold or outline style or changing its color which leads
to my question: is there anyway to change the text attributes of an
NSButtonCell? My read of the documentation is that I can change the
basic underlying font but I don't see anyway to change the text's
attributes.
2) If I click in one of the fields for ToDo items and type some text but
then, rather than hitting a tab or clicking in a another field, or some
such, I change the month (by clicking one of the arrow buttons), the
text that I typed is lost rather than being saved in a ToDoItem. After
prowling through the code with the debugger, what I've discovered is
that in controlTextDidEndEditing, newName (which is returned by
[[itemList selectedCell] stringValue];) is empty.
This tells me I don't understand how the text editing and the
controlTextDidEndEditing works (apparently I'm not alone; the way the
application works as written the book doesn't make sense but the authors
left it that way. Whatever, I'm trying to figure out how I can force
the new text to be placed in the itemList. Can anyone give me a clue?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.