PA_GetTextParameter

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

version 2003


PA_GetTextParameter (params; index; text) long

ParameterTypeDescription
paramsPA_PluginParametersParameters received in PluginMain
indexshortIndex of the parameter in params
textchar *Value (text buffer) of the index parameter (a TEXT)
Function resultlongText buffer size

Description

The routine PA_GetTextParameter fills text with the value (of type text) of the index parameter in params and returns its size.

Depending on previous calls to PA_UseMacCharacters or PA_UseAnsiCharacters, text may contain Macintosh or ANSI characters.

To retrieve the size of the text, first call the routine setting text to 0L. Then allocate a buffer of the correct size and call the routine again.

See Create a new plugin for a description of parameter accessors.

NOTE:

The first parameter starts at index 1.

Example

Duplicate the text parameter.

   void PluginMain( long selector, PA_PluginParameters params )
   {
      switch ( selector )
      {
         . . .kInitPlugin, kDeinitPlugin ...

         case kMyRoutine : // declared as DoWithText(&T) in the STR# resource
         {
            char   *text;
            long   textSize;

            text = 0L;
            textSize = PA_GetTextParameter(params, 1, 0L);
            text = malloc(textSize);
            textSize = PA_GetTextParameter(params, 1, text);
         // Let's work with the text
            DoSomethingWithThisText(text);
         }
            break;

      }
   }

See Also

About strings and characters, Create a new plugin.

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