> I hate to ask this since so much has already been posted about fields,
> but....
>
> I can't seem to be able to get the text from a field and copy it into a
> string. Setting the text to the field is no problem.
>
> the code is
>
> static void GetFieldText(UInt32 FieldID, char *Text)
> {
> FieldPtr FieldP;
> Handle FieldHand;
> CharPtr TextP;
>
> FieldP = (FieldPtr)GetObjectPtr(FieldID);
> FieldHand = FldGetTextHandle(FieldP);
> TextP = MemHandleLock(FieldHand);
> StrCopy(Text,TextP);
> }
>
> I also tried
>
> {
> TextP = FldGetTextPtr(FieldP);
> StrCopy(Text,TextP);
> }
>
>
> This function is called when hitting a "Save" button in which I want to
save
> the field text in the preferencetype struct.
>
> When run in the emulator, I get a "bus error" and on the actual device I
get
> a fatal exception.
>
>
> Am I missing something here?
>
yes. FldGetTextHandle and FldGetTextPtr can return NULL (if the field is
blank).
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/