Nick Morton wrote:
typedef struct { // record with variable length fields
char idname[1];
} PackedNoteInfo;
I�m using DmFindSortPosition with a simple compareThe DmFindSortPosition is looking for where to add the record, so just pack your record exactly like you will add it to the database then pass the record to the function. Your new packed record will end up getting passed to your compare function exactly like the other records that are already in the database.
function that looks like this;
UInt16 CompareNote(void *r1, void *r2, Int16
UnusedInt16, SortRecordInfoPtr unused1,
SortRecordInfoPtr unused2, MemHandle appInfoH)
{
#pragma unused(unusedInt16, unused1, unused2,
appInfoH)
PackedNoteInfo *rec1 = (PackedNoteInfo *) r1;
PackedNoteInfo *rec2 = (PackedNoteInfo *) r2;
Int16 Result;
const char *s1 = rec1->idname;
const char *s2 = rec2->idname;
Result = StrCompare(s1, s2);
return Result;
}
your call to DmFindSortPosition() looks right, you just need to take out that .key stuff and pass the regular record.
hope this helps,
Matt
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
