Does is make a difference if database.stringP is declared const Char*??

Thanks,

Andy

in article 27664@palm-dev-forum, Chris Tutty at
[EMAIL PROTECTED] wrote on 10/21/00 11:23 AM:

> 
> "Andy Black" <[EMAIL PROTECTED]> wrote
>> 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);
>> }
> This suggests that you're storing the pointer for later reference, but if
> the field editing increases the amount of buffer space required then
> PalmOS will resize the chunk, possibly (probably) relocating the chunk
> at the same time.  This will invalidate your pointer.
> 
> In general I think it's advised that you store handles rather than pointers
> in database records and even these are questionable since they might be
> referred to after a restart when that handle might no longer be allocated
> (although since I've never tried to do this I can't state that it's not
> valid).
> 
> Chris Tutty
> 
> 
> 
> 

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