--- Johnathan Smith wrote:
> I looked at all the books and I still cant get it
> working!  I have to demo a product that I am coming
> out with tomorrow.

Since you have a job and I don't, I'm very tempted to
say, "Send me your project and I'll rewrite it for you
for my usual hourly rate."  But that might be
considered rude.

Here is the code Memo Pad uses to sort it's database:
        
sortOrder = MemoGetSortOrder (dbP);
if (sortOrder == soAlphabetic)
  DmInsertionSort (dbP, (DmComparF *)
&MemoCompareRecords, (Int16) sortOrder);

Assuming you want to sort alphabetically, you can just
use:

  DmInsertionSort (dbP, (DmComparF *)
&MemoCompareRecords, soAlphabetic);

To make this work, of course, you have to define the
function MemoCompareRecords (use your own name).  They
do it like so:

static Int16 MemoCompareRecords (MemoDBRecordPtr r1, 
MemoDBRecordPtr r2, Int16 sortOrder, SortRecordInfoPtr
/* info1 */, 
SortRecordInfoPtr /* info2 */, MemHandle /* appInfoH
*/)
{
  Int16 result;

  // Alphabetize;
  if (sortOrder == soAlphabetic)
  {
    result = StrCompare (&r1->note, &r2->note);
  }
  else
    result = 0;
  return result;
}

And, of course, you will have to substitute your own
record types.

Also, you don't need to check the sort order if you
don't want to.


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

-- 
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