You do not need to do anything at all.
If the column data is binary data and also image data, it displays the data as image by itself.
Test:
- Code: Select all Expand view
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oBrw
USE "C:\FWH\SAMPLES\WWONDERS" NEW VIA "DBFCDX"
DEFINE DIALOG oDlg SIZE 800,600 PIXEL TRUEPIXEL
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "WWONDERS" ;
COLUMNS "NAME", "IMAGE", "DETAILS" ; // Can use AUTOCOLS too
LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 100 // pixels
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
Field "IMAGE" is a memo field containing image data. XBrowse detects that the data is image data and displays it as image.
Field "DETAILS" also is a memo field but containing text data. XBrowse knows that this data is to be displayed as multi-line text.
![Image](https://imagizer.imageshack.com/v2/xq90/923/cEAE3S.png)
So, whether the data source is DBF, ADO or any other, if the column value is image-data, xbrowse detects it and displays it as image. We do not need to do anything and please do not add any unnecessary program code.
Another situation:
Sometimes, we may store image file name in a field. Or it can be a file name containing text, image.
By default, XBrowse displays the contents of the field, i.e., the file name as text.
By setting the datatype of the column to "F" ( oCol:cDataType := "F" ), we tell the xbrowse to treat the data as file name, read the contents of the file and display the contents of the file appropriately.
Test:
- Code: Select all Expand view
#include "fivewin.ch"
function Main()
local oDlg, oBrw
local aData := { { "OLGA1", "c:\fwh\bitmaps\olga1.jpg" }, ;
{ "SEA", "c:\fwh\bitmaps\sea.bmp" } }
DEFINE DIALOG oDlg SIZE 360,500 PIXEL TRUEPIXEL
@ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE aData ;
COLUMNS 1, 2 ; // Can use AUTOCOLS too
HEADERS "NAME", "IMAGE" ;
LINES NOBORDER
WITH OBJECT oBrw
:aCols[ 2 ]:cDataType := "F"
:nRowHeight := 200 // pixels
:CreateFromCode()
END
ACTIVATE DIALOG oDlg CENTERED
return nil
![Image](https://imagizer.imageshack.com/v2/xq90/923/MjN400.png)