Newbie here, I'm having dificulty using string resources.
I would like to load the text in a string resource into a field. Below is
the code I'm using. When I run the code in the emulator, no text is
displayed in the field, and when I click on the field I get a message saying
that the program has atempted to read from memory location "NULL". The field
is useable, non-editable, and its max character limit is well above the
number of characters in the tStr object. Here is my code, that is called
upon the frmOpenEvent for the form that holds the field:
static void AboutFormInit(FormPtr frmP)
{
FieldPtr fldPtr;
CharPtr AboutString;
// iTDAboutITDAboutField is the field in which I want the text
fldPtr = FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
iTDAboutITDAboutField));
// AboutiTDString is the string resource that holds the text
AboutString = MemHandleLock (DmGetResource (strRsc, AboutiTDString));
// AboutString and fldPtr have never been NULL, but just in case
if (AboutString == NULL || fldPtr == NULL)
{
FrmGotoForm(MainForm);
}
MemPtrUnlock (AboutString );
// I think this should set the text in the field
FldSetTextPtr(fldPtr, AboutString);
// And this should cause the text to be displayed
FldDrawField(fldPtr);
}
Thanks.
Erik Shreve
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/