PA_GetTextVariable

4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next

version 2003


PA_GetTextVariable (aVariable; theText) long

ParameterTypeDescription
aVariablePA_VariableVariable to access
theTextchar *Content of the text
Function resultlongLength of theText. 0 if the variable is not text kind

Description

The routine PA_GetTextVariable puts the content of the variable aVariable in the data pointed to by theText and returns its length (max 32000).

If aVariable has not the kind eVK_Text, the routine returns 0 and theText is returned unchanged.

If text size is unknown, call the function a first time with theText equal to zero. The returned value will be the size of the needed buffer. Allocate the buffer and call the function again with the correct buffer.

NOTE:

Depending of default settings or of previous calls to PA_UseMacCharacters or PA_UseANSICharacters, theText will contain Macintosh or ANSI characters.

Example

Get a text variable.

   char   *theText;
   long   textSize;

   // First call the routine with a nil pointer to get the text size
      textSize = PA_GetTextVariable(aVariable, 0L);
   // Then allocate the buffer
      theText = malloc(textSize);
   // If it is ok, get the text value
      textSize = PA_GetTextVariable(aVariable, theText);
   // Work with the text
      /* . . . */
   // Cleanup
      free(theText);

Error Handling

PA_GetLastError keeps the last error that occurred before calling the routine.


4D - Documentation   Français   English   German   4D Plugin API, Command Theme List   4D Plugin API, Command Alphabetical List   Back   Previous   Next