#include "fivewin.ch"
REQUEST DBFCDX
static aBmp := { "c:\fwh\bitmaps\32x32\browse.bmp","c:\fwh\bitmaps\32x32\calc.bmp","c:\fwh\bitmaps\32x32\copy.bmp" }
function Main()
local oDlg, oFont, nRow, nCol
CreateDBF()
USE XBRBMP NEW VIA "DBFCDX"
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 760,540 PIXEL TRUEPIXEL FONT oFont
nRow := nCol := 20
Normal( oDlg, nRow, nCol )
Method1( oDlg, nRow, nCol += 240 )
Method2( oDlg, nRow, nCol += 240 )
Method3( oDlg, nRow += 250, nCol := 20 )
Method4( oDlg, nRow, nCol += 240 )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
function Normal( oDlg, nRow, nCol )
local oBrw
@ nRow,nCol SAY "NO BITMAP" SIZE 100,20 PIXEL OF oDlg
nRow += 30
@ nRow,nCol XBROWSE oBrw SIZE 220,200 PIXEL OF oDlg ;
DATASOURCE "XBRBMP" COLUMNS "UNITS","TENS","ESTADO" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 32
:nStretchCol := 2
:lHScroll := :lVScroll := .f.
:CreateFromCode()
END
return nil
function Method1( oDlg, nRow, nCol )
local oBrw
@ nRow,nCol SAY "BmpData" SIZE 100,20 PIXEL OF oDlg
nRow += 30
@ nRow,nCol XBROWSE oBrw SIZE 220,200 PIXEL OF oDlg ;
DATASOURCE "XBRBMP" COLUMNS "UNITS","TENS","" ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 32
:nStretchCol := 2
WITH OBJECT oBrw:aCols[ 3 ]
:cHeader := "EST"
:AddBitmap( aBmp )
:bBmpData := { || ( oBrw:cAlias )->ESTADO }
END
:lHScroll := :lVScroll := .f.
:CreateFromCode()
END
return nil
function Method2( oDlg, nRow, nCol )
local oBrw
@ nRow,nCol SAY "BmpFile" SIZE 100,20 PIXEL OF oDlg
nRow += 30
@ nRow,nCol XBROWSE oBrw SIZE 220,200 PIXEL OF oDlg ;
DATASOURCE "XBRBMP" COLUMNS "UNITS","TENS",{ || aBmp[ ( oBrw:cAlias )->ESTADO ] } ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 32
:nStretchCol := 2
WITH OBJECT oBrw:aCols[ 3 ]
:cHeader := "EST"
:cDataType := "F"
:lBmpTransparent := .t.
END
:lHScroll := :lVScroll := .f.
:CreateFromCode()
END
return nil
function Method3( oDlg, nRow, nCol )
local oBrw
local aBmpH[ 3 ]
AEval( aBmp, { |c,i| aBmpH[ i ] := ReadBitmap( 0, c ) } )
@ nRow,nCol SAY "Bitmap Handle" SIZE 100,20 PIXEL OF oDlg
nRow += 30
@ nRow,nCol XBROWSE oBrw SIZE 220,200 PIXEL OF oDlg ;
DATASOURCE "XBRBMP" COLUMNS "UNITS","TENS",{ || aBmpH[ ( oBrw:cAlias )->ESTADO ] } ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 32
:nStretchCol := 2
WITH OBJECT oBrw:aCols[ 3 ]
:cHeader := "EST"
:cDataType := "P"
:lBmpTransparent := .t.
END
:lHScroll := :lVScroll := .f.
:CreateFromCode()
END
return nil
function Method4( oDlg, nRow, nCol )
local oBrw
local aBuf[ 3 ]
AEval( aBmp, { |c,i| aBuf[ i ] := MEMOREAD( c ) } )
@ nRow,nCol SAY "File Buffer" SIZE 100,20 PIXEL OF oDlg
nRow += 30
@ nRow,nCol XBROWSE oBrw SIZE 220,200 PIXEL OF oDlg ;
DATASOURCE "XBRBMP" COLUMNS "UNITS","TENS",{ || aBuf[ ( oBrw:cAlias )->ESTADO ] } ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nRowHeight := 32
:nStretchCol := 2
WITH OBJECT oBrw:aCols[ 3 ]
:cHeader := "EST"
:cDataType := "P"
:lBmpTransparent := .t.
END
:lHScroll := :lVScroll := .f.
:CreateFromCode()
END
return nil
function CreateDbf()
local aData := { { "one", "ten", 1 }, { "two", "twenty", 2 }, { "three", "thrity", 3 }, { "four", "forty", 2 } }
DBCREATE( "XBRBMP", {{ "UNITS", "C", 5, 0 },{ "TENS", "C", 5, 0 },{ "ESTADO", "N", 1, 0 }}, ;
"DBFCDX", .T., "XBMP" )
FW_ArrayToDBF( aData )
CLOSE DATA
return nil