This code looks fine to me -- a bit inefficient (no need to put the
description and note on the heap, they could be left on the stack), a bit
risky (whenever you use MemPtrNew or MemHandleNew or their brethern, you
should check that the allocation didn't fail) but fine.

The problem probably is in your ApptNewRecord.  Are you correctly placing
the record in the correct sorted order?  Datebook's display relies on the
records being sorted by date.

An alternative possible problem might be in your packing routine not setting
flags correctly.  Have you checked that the packed records are correct?

The only required field is the date/time field.

-bob mckenzie

-----Original Message-----
From: wptsoi7 [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 05, 2001 5:32 AM
To: Palm Developer Forum
Subject: Datebook Problem


I try to write a small application that will create datebook records.
After execute the application, some of the records can be shown on the POSE.
However, most of the records cannot be found.

I check the Info of POSE, and I find that all of the records have been added
to datebook. But they cannot be shown. The date and time of the records are
correct. Is there any fields(the exception???) I need to set to make these
record show on screen?

Here is part of my code:

      ApptDBRecordType dbRecord;
      MemSet (&dbRecord, sizeof (dbRecord), 0);
      UInt16 index = 0;

      ApptDateTimeType when;

      when.startTime.hours = 0;
      when.startTime.minutes = 0;

      when.endTime.hours = 17;
      when.endTime.minutes = 00;

      when.date.year = 97;
      when.date.month = 1;
      when.date.day = 2;

      dbRecord.when = &when;

      char description[] = "DESCRIPTION";
      char note[] = "NOTE";
      dbRecord.description = (char *)MemPtrNew(StrLen(description)+1);
      MemSet(dbRecord.description, StrLen(description)+1, 0);
      StrCopy(dbRecord.description, description);

      dbRecord.note = (char *)MemPtrNew(StrLen(note)+1);
      MemSet(dbRecord.note, StrLen(note)+1, 0);
      StrCopy(dbRecord.note, note);

      ApptNewRecord(&dbRecord, &index);

      MemPtrFree(dbRecord.description);
      MemPtrFree(dbRecord.note);



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

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

Reply via email to