Having read your comments and then read through the text, I can also see problems.

Of course. For one thing, all of the FrmAlert() commands return an "undefined identifier" error, so I assume there is a missing include file someplace. The Palm Reference manual claims it is "forms.h" but I have that included, and it still complains. Since I didn't care about this, I just commented them all out.

The code is designed to be illustrative, not something you could directly use. Those identifiers in the FrmAlert calls are alerts that are part of your program's resources, and the #defines for them would usually be provided by a header file created by the tool you use to make your resources.


Second, I found it confusing to have the open database and close database in the same paragraph and code sample without any records stored in between the open and close. Maybe it's just me, but am I supposed to create and close a database, then create records, then attach records, or create a database, create and insert records, and then close the database? Apparently either way should work, but I haven't gotten either way to work yet.

They actually are different paragraphs -- the open code is designed to go into your AppStart function, which gets run at the start of your program. The close code goes into the AppStop function. All the code to add or delete records is driven by the UI of the program, and all of that happens based on the event loop, which is running between the calls to AppStart and AppStop.


Third, in the create a record part, the recipe locks a memory HANDLE, but unlocks a memory POINTER. That may be right, but it looks weird, and is way counter intuitive, at least to some of us. An explanation would make look less like carelessness.

Agreed. That can be a confusing technique.

My overall impression is that someone who knows what they are doing wouldn't have too much trouble with it; but, let's face it: the experts aren't the target audience for anything called a "recipe".

The recipes aren't designed to be the first thing you read; they are more a quick guide through all the parts of a topic, but they can be improved a lot.


> Did you read that chapter on databases in the "Palm OS Companion" >book that's part of the Palm OS SDK?

Yes, but it wasn't that instructive. It explains each operation in isolation, as though nothing else existed.

The Data Manager chapter of the companion is written from a data structures point of view -- here is what we mean by a Palm OS database, and here are the operations you can do on it. It doesn't try to get into the "whys".


I also spent several days pawing around in the Datebook application. That isn't the best approach, because the Datebook does about a billion things that have nothing to do with databasing.

The PIM apps are very complex, but the original Palm OS itself was written alongside the PIM apps, collecting the common operations into a single API that was inspired by the original Mac OS API. That's one reason why there are so many quirks in it -- you can't understand tables without looking at how they are used by the To Do list and Date Book apps.


I am working on a test program that just allows the user to creates a database, type some data into fields, and close the database. Something like that would be a lot more instructive than anything I have seen so far. If I ever get it working, would you like to see it?

At the bottom of the recipe page, there are links to a "DataMgr_Edit_Record.zip" project. This is the code, in complete program form, that the recipe was based upon.


-- Ben Combee, DTS technical lead, PalmSource, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Palm OS Dev Fourm Archives: http://news.palmos.com/read/all_forums/



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to