One of the best places to look for example code are the app examples
that come with the SDK.
But here, this may be something that can help u. It changes the text in
field textFieldID to something that is contained in a string, myNewStr.
A copy of myNewStr is then pasted onto the top left corner of the
screen.
FieldPtr fldP;
MemHandle textH;
Char *text;
fldP = GetObjectPtr(textFieldID); // look inside the standard PalmOS
stationary of CW for def of GetObjectPtr
textH = FldGetTextHandle(fldP);
if (textH) // check if a handle has already been created for the field
by FieldMgr
{
FldSetTextHandle(fldP, NULL); // remove that handle from the field
MemHandleFree(textH); // dealloc
}
textH = MemHandleNew(sizeof(Char) * (StrLen(myNewStr)+1)); // create a
new handle
StrCopy(MemHandleLock(textH), myNewStr); // copy my str to the handle
MemHandleUnlock(textH);
FldSetTextHandle(fldP, textH); // set the unlocked handle to the field
WinDrawChars(FldGetTextPtr(fldP), FldGetTextLength(fldP), 0,0);
Jim Duffy wrote:
>
> Hi everyone,
>
> As a relatively novice programmer, I am at the point in my app where I want
> to start coding the database functionality.
>
> I want to start out by simply having some text (and numeric) fields in some
> forms saved into the global prefs struct so they can be retrieved when the
> app is reopened.
>
> The docs say not to use FldGetTextPtr and FldSetTextPtr with an editable
> field, but I don't quite understand how to get the Get and Set TextHandle
> functions to work.
>
> Could any help with some example code or point me to some reference
> material, other than the docs.
>
> Thanks so much for the help.
>
> Jim
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/