Subject: Setting fields values
From: Udi Kobi <[EMAIL PROTECTED]>
Date: Mon, 06 Jun 2005 15:08:51 +0200
I use this code to set a field's value:
field = (FieldType *)GetObjectPtr(MonthField);
StrCopy(str, "July");
FldInsert(field, str, StrLen(str));
And this code to read:
field = (FieldType *)GetObjectPtr(YearField);
str = FldGetTextPtr(field);
val = StrAToI(str);
1) Inserting the string is always at the end of the current field. (is
there an insertion point?)
Yes, and API's exist to set and get it.
2) The reading not always brings the value in the given field.
I believe FldInsert will truncate the field if it is too long.
I know there is a way to lock/unlock memory when reading/writing to it
strings. How do I do it and why is the neccessary to lock/unlock?
Are you really meaning to use FldInsert() ??
If you are trying to replace the field then you use a different process,
and in that process you use lock and unlock, and also can expand and shrink
the memory used to store the field.
The proper code is quite lengthy, but should be in the sample programs.
Search on FldGetTextHandle and FldSetTextHandle
Roger Stringer
Marietta Systems, Inc. (www.rf-tp.com)
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/