Displaying text & jpgs.

Displaying text & jpgs.

Postby HunterEC » Wed Apr 08, 2009 8:27 am

Can I have a browse object (TXBrowse) that display the record contents, as usual, and in one column include a small jpg ? I'm supposed to display the record data and the customer's signature ? Thank you.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am

Re: Displaying text & jpgs.

Postby Antonio Linares » Sun Apr 12, 2009 11:09 pm

Yes, it is supported since FWH 9.03:

viewtopic.php?f=3&t=15018&start=0
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Displaying text & jpgs.

Postby Antonio Linares » Sun Apr 12, 2009 11:11 pm

Code: Select all  Expand view

#include "FiveWin.ch"
#include "xbrowse.ch"

REQUEST DBFCDX

static hLib

function main()

local oDlg
local oBrw
local nI
local cAlias
local hBitMap

hLib := LoadLibrary( "freeimage.dll" )

cAlias = "customer"

hBitmap = FILoadImg( AllTrim( "dibujo.jpg" ) )

use customer alias (cAlias) new via "dbfcdx"


   DEFINE DIALOG oDlg title "TEST" size 600,400

   @ 0,0 XBROWSE oBrw OF oDlg ;
      COLUMNS "First", "Salary", "state", "age" ;
      HEADERS nil, nil, "State", "AGE" ;
      JUSTIFY .F., nil, .F., .T. ;
      ALIAS cAlias AUTOSORT LINES CELL

    oBrw:nMarqueeStyle := 0
    oBrw:nRowDividerStyle:= 0
    oBrw:nColDividerStyle:=0
    oBrw:nRowHeight := nBmpHeight( hBitmap ) + 5
   

        oBrw:aCols[ 1 ]:AddBmpHandle( hBitmap )
        oBrw:aCols[ 1 ]:bBmpData := {|| 1 }
       
   oDlg:oClient := oBrw
   
   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED ON INIT oDlg:Resize()

FreeLibrary( hLib )

return nil

#define CBM_INIT       4
#define DIB_RGB_COLORS 0

static function FILOADIMG( cFile )

   local nFormat, hDib, hInfoH, hInfo, hBits, hWnd, hDC, hBmp

   if Upper( cFileExt( cFile ) ) = "BMP"
      return ReadBitmap( 0, cFile )
   endif

   nFormat = FIGETFILETYPE( cFile, 0 )
   hDib    = FILOAD( nFormat, cFile, 0 )
   hInfoH  = FIGETINFOHEADER( hDib )
   hInfo   = FIGETINFO( hDib )
   hBits   = FIGETBITS( hDib )
   hWnd    = GETDESKTOPWINDOW()

   hDC = GETDC( hWnd )

   hBmp = CreateDiBitmap( hDC, hInfoH, CBM_INIT, hBits, hInfo, DIB_RGB_COLORS )

   ReleaseDC( hWnd, hDC )

   FIUNLOAD( hDib )


return hBmp


DLL32 FUNCTION FIGETFILETYPE( cFileName AS LPSTR, nSize AS LONG ) AS LONG ;
      PASCAL FROM "_FreeImage_GetFileType@8" LIB hLib

DLL32 FUNCTION FILOAD( nFormat AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS LONG ;
      PASCAL FROM "_FreeImage_Load@12" LIB hLib

DLL32 FUNCTION FIGETINFOHEADER( hDib AS LONG ) AS LONG ;
      PASCAL FROM "_FreeImage_GetInfoHeader@4" LIB hLib

DLL32 FUNCTION CREATEDIBITMAP( hDC AS LONG, hInfoH AS LONG, nFlags AS LONG, hBits AS LONG, hInfo AS LONG, nUsage AS LONG ) AS LONG ;
      PASCAL FROM "CreateDIBitmap" LIB "gdi32.dll"

DLL32 FUNCTION FIGETINFO( hDib AS LONG ) AS LONG ;
      PASCAL FROM "_FreeImage_GetInfo@4" LIB hLib

DLL32 FUNCTION FIGETBITS( hDib AS LONG ) AS LONG ;
      PASCAL FROM "_FreeImage_GetBits@4" LIB hLib
     
DLL32 FUNCTION FIUNLOAD( hDib AS LONG ) AS VOID ;
      PASCAL FROM "_FreeImage_Unload@4" LIB hLib
 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Displaying text & jpgs.

Postby HunterEC » Tue Apr 14, 2009 6:09 am

Antonio:

Thank you very much for your help ! Now can I display a different JPG (in this case a customer signature) for each row ? More or less this way:

Name Last Name Age JPG
Record 1 JPG 1
Record 2 JPG 2
. .
. .
. .
Record 3 JPG 3

Thank you.
HunterEC
 
Posts: 723
Joined: Tue Sep 04, 2007 8:45 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 67 guests