PA_SetTextField


version 2003


PA_SetTextField (tNum; fNum; text; len)

Parameter Type Description
tNum short Table number of the field to access
fNum short Field number of the field to access
text char* Pointer to the text buffer
len long Length of the text

Description

The routine PA_SetTextField fills the text field number fNum of the current record of the table number tNum with the text pointed to by the buffer text , of length len .

If the field is not a text field, the routine does nothing and sets an error in PA_GetLastError ().

Depending on default settings or on previous calls to PA_UseMacCharacters or PA_UseANSICharacters , newText should contain Macintosh or ANSI characters.

Example

Fill the field content with the content of a text variable (no error checking here).

   void TextVariableToTextField( PA_Variable v, short tNum, short fNum )
   {
      char   *text;
      long   size;
 
      if(PA_GetVariableKind(v) == eVK_Text)
      {
   // First get the size of the buffer, then allocate it and recall the routine
         size = PA_GetTextVariable( v, 0 );
         text = malloc( size );
         size = PA_GetTextVariable( v, text );
 
   // text is filled -> transfert it to the field
         PA_SetTextField( tNum, fNum, text, size );
 
   // cleanup
         free(text);
      }
   }
   

See Also

PA_GetTextField , PA_UseAnsiCharacters , PA_UseMacCharacters .

Error Handling

Use PA_GetLastError to see if an error occurred