|
![]() |
![]() |
version 2003
PA_SetPictureField (tNum; fNum; newPicture; len; info)
Parameter | Type | Description | |
tNum | short | → | Table number of the field to access |
fNum | short | → | Field number of the field to access |
newPicture | void* | → | Pointer to the new picture data |
len | long | → | Size of the picture in bytes |
info | PA_PictureInfo | → | Picture 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
).