PA_SetPictureField

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

version 2003


PA_SetPictureField (tNum; fNum; newPicture; len; info)

ParameterTypeDescription
tNumshortTable number of the field to access
fNumshortField number of the field to access
newPicturevoid*Pointer to the new picture data
lenlongSize of the picture in bytes
infoPA_PictureInfoPicture info

Description

The routine PA_SetPictureField fills the picture field number fNum of the current record of the table number tNum with the data pointed to by newPicture, of size size. It then adds to the field the PictureInfo info.

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

Note that PA_SetPictureField duplicates newPicture, which still belongs to the plug-in after the call. To give the data without duplicating it, use PA_SetPictureHandleField.

Example

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

   void BlobVariableToBlobField (PA_Variable v, short tNum, short fNum)
   {
      PA_Handle   pictureH;
      char      *ptr;

      if(PA_GetVariableKind(v) == eVK_Picture)
      {
   // Since we do not touch to the picture data, we do not have to duplicate it,
   // put it in the field, then dispose of it. We simply use the variable BLOB handle
         pictureH = PA_GetPictureHandleVariable(v);

   // Lock and transfer the data
         ptr = PA_LockHandle(pictureH);
         PA_SetPictureField(tNum, fNum, ptr, PA_GetHandleSize(pictureH));
         PA_UnlockHandle(pictureH);
      }
   }

See Also

PA_GetPictureField, PA_GetPictureHandleField, PA_SetPictureHandleField.

Error Handling

Use PA_GetLastError to see if an error occurred (eER_InvalidFileNumber, eER_InvalidFieldNumber).


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