FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour JPG images in an xBrowse
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
JPG images in an xBrowse
Posted: Tue Jul 30, 2013 03:57 PM

Hi,

I have a table containing a column that is populated with the path & filename of a JPG file. Is it possible to have an xBrowse that shows a thumbnail of this image in one column along with additional columns from the table?

I think I can remember Uwe creating a tool that could do this, is this correct?

Best regards,

Pete

Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: JPG images in an xBrowse
Posted: Tue Jul 30, 2013 06:07 PM
Peter

Try this .. aCols[7] represents the column you wish to view the picture .. add this line after you define the browse .. "F" defines the column as "file".

Rick Lipkin

Code (fw): Select all Collapse
oLbx:aCols[ 7 ]:cDataType := "F"
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: JPG images in an xBrowse
Posted: Wed Jul 31, 2013 11:21 AM
Pete,

there will be a new tool in a short time, to show
a image / text - combination.
Is that the solution, You are looking for ?





Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 08:09 AM

Hi Rick/Uwe,

Rick - thanks, I will have a look and see if I can get the browse to work with your suggestion.

Uwe - Yes that is what I want - the first column could be the thumbnail/image, the following columns would be columns from the same row in the table.

Thanks

Pete

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 08:15 AM

Pete,
the new tool is nearly finished and shows the needed results.
I still want to add some extras, before adding a new post for download.

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 08:56 AM

Uwe,

Looking forward to the update :)

Pete

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 08:57 AM
Mr Peter

This is EXTREMELY SIMPLE.
Just follow Mr Rick's suggestion.

You need to add just One Line of code
Code (fw): Select all Collapse
oBrw:aCols[ n ]:cDataype := "F"

where n is the column number of the browse showing the field containing the filename
Regards



G. N. Rao.

Hyderabad, India
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 09:23 AM

Setting the cDatatype works well

Thanks once again

Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 10:35 AM

This seems to work when i'm browsing a table, but if I create an array of filenames and browse the array, I just get an empty column - does it work on arrays?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 12:47 PM

Work on all.
Please make sure two things
value should be a valid path
and that column's cDataType should be set to "F"

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 02:01 PM
Please try this example program:
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oDlg, oBrw, aData := {}

   AEval( DIRECTORY( "c:\fwh\bitmaps\pngs\*.png" ), { |a| ;
      AAdd( aData, { a[ 1 ], "c:\fwh\bitmaps\pngs\" + a[ 1 ] } ) } )

   DEFINE DIALOG oDlg SIZE 500,400 PIXEL
   @ 10,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE aData COLUMNS 2, 1 ;
      HEADERS "Image", "Name" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrw
      :aCols[ 1 ]:cDataType      := "F"
      :aCols[ 1 ]:nDataBmpAlign  := AL_CENTER
      :nStretchCol   := 2
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil


Result:
Regards



G. N. Rao.

Hyderabad, India
Posts: 363
Joined: Wed Feb 15, 2006 02:06 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 02:25 PM

Thanks for the example and it pointed out my glaringly obvious mistake.

Best regards,

Pete

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 06:26 PM
Pete,
the 2. style, using ARRAYS
1. full path displayed in a tooltip
2. three info-fields
3. filename displayed vertical
4. change image on right mouseclick



Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion