I'm trying to use FldSetText to set a handle to a field. My handle is
actually a pointer to a record in my database. I want to set portions of the
handle that correspond to database fields to different form fields. Thus I
don't want to use FldSetTextHandle. While FldSetText is supposed to allow
you to set the number of bytes you wish to set, it doesn't appear to be
working right. Has anyone had any experience using FldSetText to set subset
of a handle that's NOT a null terminated string (my database does not use
null terminated strings for each field)? When I try it, I get a debug error
saying "Text Block Size smaller than Text", and the field is populated with
more data than I request (eac field hsows data up to the NULL termination,
regardless of the size I send).

Also, does FldSetText allow you to edit the field or not? I've read
conflicting statements on this, but the latest Palm OS Reference says
FldSetText and FldSetTextHandle allow you to edit fields in place.

Below are the relevant sections of my code:
// totalOffset holds the number of bytes at the ebginning of each record
used to store field offset sizes.

   record = cursor;
   maxColumns = numColumns;
   dataRecord = DmQueryRecord (dataDB, record);
   precord = (Char*) MemHandleLock (dataRecord);
   FrmDrawForm (form);
   details = MemHandleNew (MemHandleSize (dataRecord) - totalOffset);
   stringT = (Char*) MemHandleLock (details);
   StrCopy (stringT, precord + totalOffset);
   MemHandleUnlock (dataRecord);
   MemHandleUnlock (details);
   for (loopIndex = 0; loopIndex < numColumns; loopIndex++)
   {
    if (loopIndex == 0)
    {
    offset = 0;
    fieldSize = 4;
    }
    else if (loopIndex == 1)
    {
     offset = 4;
    fieldSize = 9;
    }
    else
    {
    offset = 12;
    fieldSize = 9;
    }
    fieldIndex = FrmGetObjectIndex (form, fieldID);
    fieldPtr = (FieldType*) FrmGetObjectPtr (form, fieldIndex);
    FldSetText (fieldPtr, details, offset, fieldSize);
    FldSetUsable (fieldPtr, true);
    FldDrawField (fieldPtr);
    fieldID++;
   }

--
George R




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to