Hi,

I am having some problems getting text from editable text fields and I think
the error is in the function below. I can get data from the text field fine
the first time around. But, if you edit the text field and then try to get
the data from the edited field, I get an error that states "Field Object
Improperly Locked". Here is an example of how I call this function:

stringP = GetLockedPtr (whateverField);
if (stringP)
    {
        database.stringP = stringP;
        MemPtrUnlock (stringP);
    }
else
    {
        database.stringP = NULL;
    }

// returns (locked) text in a field object
static Char* GetLockedPtr(UInt16 objectID)
{
    FormPtr    frm = FrmGetActiveForm();
    FieldPtr fld;
    MemHandle    textH;
    Char* textP;

    fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, objectID));

    textH = FldGetTextHandle (fld);
    if (!textH)
        {
            textP = NULL;
        }
    else
        {
            textP = MemHandleLock (textH);
            if (textP[0] == '\0')
                {
                    textP = NULL;
                }
        }
    
    return textP;
}

Any suggestions for fixing/improving this code is greatly appreciated.

TIA,

Andy
-- 
Andy Black
[EMAIL PROTECTED]                   http://www.SpazTheCat.com

Unix is user friendly. It is just picky about who its friends are.


-- 
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