OK, even though I'm only 3 weeks "old" in PalmOS programming, I'll try....

Load large string into Field...
Here is some code I use:

[snip]

void SetEditText(UInt16 ownerForm, UInt16 fieldName,Char *text)
{
        FieldPtr THIS = GetObjectPtr(ownerForm, fieldName);
    MemHandle h,old;
    Char *dest;
    if( text == NULL )
                 text = "";
    h = MemHandleNew( StrLen( text ) + 1 );
    dest = MemHandleLock( h );
    StrCopy( dest, text );
    MemHandleUnlock( h );
    old = FldGetTextHandle( THIS );
    FldSetTextHandle( THIS, h );
    if( old != NULL )
                MemHandleFree( old );
        FldDrawField(THIS);
}

Char* GetEditText(FieldPtr THIS)
{
        Char *text;
        text=FldGetTextPtr(THIS);
        if (!text)
                text="";
        return text;
}

[snap]

The first for setting text, the second for getting the text (dooooh! ;o)

It might be the only thing your missing is the:
        FldDrawField(THIS);

This redrws the field, showing the new entry...

Naturally fields are often used, so I have the above functions in all my apps ;o)

Hope it helped, otherwise keep asking ;o)

/morten

Salli wrote:
I have a little test database which consists of 3 records each containing 2
strings, the first string is just 2 characters long and I can load this up
into a field on a form without any problems.

The second column is a string that is quite a bit larger....longer than 255
characters.....it doesn't need to be edited, just displayed on the
screen...I thought that an uneditable field would be best with a scrollbar
at the side....am I barking up the wrong tree?

If this is the best way to go, how do I load my string into the field?  When
I try I don't seem to get anything loaded at all...I think I'm missing
something!!!

Thanks in advance for all your help,

Salli




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

Reply via email to