Maybe your problem is that you are unlocking your "rec" handle before you're
done using the unpacked ham. Since the ham struct consists of a few
pointers pointing to different places in your record handle, the handle
needs to remain locked to keep your pointers from becoming invalid. Call
MemHandleUnlock(rec) after displaying the alert and setting the fields'
text.
----- Original Message -----
From: Jeremy Cowgar <[EMAIL PROTECTED]>
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Wednesday, March 15, 2000 11:52 AM
Subject: Basic Database Example
>
> static void UnpackHam(Ham * ham, const PackedHam * packedHam)
> {
> const char *s = packedHam->name;
>
> ham->hamID = packedHam->hamID;
> s += StrLen(s) + 1;
> ham->name = s;
> s += StrLen(s) + 1;
> ham->callSign = s;
> s += StrLen(s) + 1;
> ham->notes = s;
> s += StrLen(s) + 1;
> }
>
> static void EditFormDisplayFirstRecord()
> {
> VoidHand rec;
> Ham ham;
>
> rec = DmGetRecord(HamCallsDB, 0);
> UnpackHam(&ham, MemHandleLock(rec));
> MemHandleUnlock(rec);
>
> FrmCustomAlert(HamInfo, ham.name, ham.callSign, ham.notes);
> // SetFieldTextFromStr(EditForm_Name, (CharPtr)ham.name);
> // SetFieldTextFromStr(EditForm_CallSign, (CharPtr)ham.callSign);
> // SetFieldTextFromStr(EditForm_Notes, (CharPtr)ham.notes);
> }
>
> After everything is up and running, EditFormDisplayFirstRecord() is
executed
> by pressing a button on my screen, and it fills my fields in with garbage.
> The FrmCustomAlert shows nothing.
>
> Can anyone help or point me towards a simple data example?
>
> Thanks!
>
> Jeremy Cowgar - [EMAIL PROTECTED]
> Christian Brotherhood Newsletter
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html