My First Document-type App. Some (simple?) Questions.
My First Document-type App. Some (simple?) Questions.
- Subject: My First Document-type App. Some (simple?) Questions.
- From: Michael Urban <email@hidden>
- Date: Thu, 20 Dec 2001 10:33:34 -0500
I am, in my occasional spare time, tinkering on a Cocoa app for managing
cards in a collectible card game. I have a few specific questions/problems,
and hope they will not be too basic.
1. The card manager program is a document-based thing whose controller
displays four views: a table view containing information on all
the cards in the database with a "# owned" column; a text field
containing the name of the currently selected card; a stepper
controlling the number of cards owned in the currently selected
card; and a text field displaying the stepper value. First problem:
when the app launches, it puts up an "Untitled" document which
looks almost right, except that the scroll bar in the table is not
enabled and has no bubble in it. There is no way to scroll past
the first N lines of the table. However, if the "New" menu item
is selected, an Untitled-N document is opened, and its scroll bar
is just fine. What is going on? Or _not_ going on?
2. When the stepper is clicked, my code properly updates the text
field, and the data source for the table. However, even though a
"reloadData" message is sent to the table view, the "owned" column
does not update unless I do something like scrolling that row off
screen and back onscreen. Do I need to do a "display" or something?
Why?
3. I do not know how to make printing happen. Where should I be
reading?
4. I want to add an action that will create a summary of the
collection ("I own XX of YY-type cards. I do not own xx, yy, zz."
sorts of things). This would involve putting up a separate NSWindow
with the information in a big, uneditable text field, I suppose?
How should this window interact with the "Save" and "Print" menu
items, if at all? Again, where should I be reading?
5. A wholly different document controller would be used to handle
individual decks constructed for the game (this controller would
have some rudimentary database query functionality, for example).
While it would be easy enough to make this a separate app, it would
be better to have "New" and "Open" be able to handle these two
different document types and load the proper controller nib and
class so that a single app could perform both functions. I suppose
that arranging for "Open" to do the right thing is fairly
straightforward, though I do not yet know the details. But the
"New" menu will need to have a submenu with entries for each of
the two types. How do I write the actions for these "New" items?
Equivalently, what, _exactly_, does the default "New" menu action
do?
Thanks.
Mike