|
![]() |
![]() |
version 2003
PA_GetPictureField (tNum; fNum; picture; info) → long
Parameter | Type | Description | |
tNum | short | → | Table number of the field to access |
fNum | short | → | Field number of the field to access |
picture | void* | ← | Pointer to picture data |
info | PA_PictureInfo* | ← | Pointer to picture info |
Function result | long | ← | Picture size in bytes |
Description
The routine
PA_GetPictureField
puts the content of the picture field number
fNum
of the current record of the table number
tNum
, in the data pointed to by
picture
, and returns its size in bytes. In addition, it returns the picture info in
info
(used when the picture is displayed as a background picture).
If the field is not a picture field, the routine leaves
picture
and
info
unchanged, returns 0 and an error code in
PA_GetLastError
.
If the picture size is unknown, call the function a first time with
picture
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.
4th Dimension uses Macintosh pictures internally. You can get a handle to the picture by calling
PA_GetPictureHandleField
.
Examples
Get a picture field.
char *thePict;
PA_PictureInfo theInfo;
long pictSize;
// First call the routine with a nil pointer to get the BLOB size
pictSize = PA_GetPictureField(tNum, fNum, 0, 0 );
// Then allocate the buffer
thePict = malloc( pictSize );
// If it is ok, get a copy of picture data
if ( thePict )
{
pictSize = PA_GetPictureField( tNum, fNum, thePict, &theInfo );
// Work with it
/* . . . */
// Cleanup
free( thePict );
}
See Also
PA_GetPictureHandleField , PA_SetPictureField , PA_SetPictureHandleField .
Error Handling
Use
PA_GetLastError
to see if an error occurred (
eER_InvalidFileNumber
,
eER_InvalidFieldNumber
).