Use these two...I got them from one of my Codewarrior Companion Reference
books.
Here's an example of a call:
SetFieldTextFromStr( MyFieldID, MyStrP );
-Rus
static FieldPtr SetFieldTextFromHandle( Word fieldID, Handle txtH )
{
Handle oldTxtH;
FormPtr frm = FrmGetActiveForm( );
FieldPtr fldP;
// Get field and field's current text handle
fldP = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fieldID ) );
ErrNonFatalDisplayIf( !fldP, "missing field" );
oldTxtH = FldGetTextHandle( fldP );
FldSetTextHandle( fldP, txtH );
FldDrawField(fldP);
if ( oldTxtH )
MemHandleFree( oldTxtH );
return fldP;
}
static FieldPtr SetFieldTextFromStr( Word fieldID, CharPtr strP )
{
Handle txtH; // Sets up a string handle from str and calls
txtH = MemHandleNew( StrLen( strP ) + 1 ); // SetFieldTextFromHandle
if ( !txtH )
return NULL;
StrCopy( MemHandleLock( txtH ), strP );
MemHandleUnlock( txtH );
return SetFieldTextFromHandle( fieldID, txtH );
}
>-----Original Message-----
>From: Prasanna Kannan [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, June 20, 2000 9:04 AM
>To: Palm Developer Forum
>Subject: Setting Field's Text
>
>
>Hi All
>
>I have a string(tempString-- i am getting this from an
>EchoServer using NetLib), how can i set a text field
>to display this string.. the text field is presently
>blank.. the following code gives an error that "Net
>Library" has directly read from Memory manager data
>structures
>
>
>fldP = FrmGetObjectPtr(frm,FrmGetObjectIndex
>
>(frm,MainEchoedTextField));
>FldSetTextPtr(fldP,tempString);
>
>In case I have to use a TextHandle.. could someone
>please send me the code snippet. Thanks a lot
>
>--Prasanna
>
>__________________________________________________
>Do You Yahoo!?
>Send instant messages with Yahoo! Messenger.
>http://im.yahoo.com/
>
>--
>For information on using the Palm Developer Forums, or to
>unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/