Page 1 of 1
JPG images in an xBrowse
Posted: Tue Jul 30, 2013 3:57 pm
by PeterHarmes
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
Re: JPG images in an xBrowse
Posted: Tue Jul 30, 2013 6:07 pm
by Rick Lipkin
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
Re: JPG images in an xBrowse
Posted: Wed Jul 31, 2013 11:21 am
by ukoenig
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
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 8:09 am
by PeterHarmes
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
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 8:15 am
by ukoenig
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
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 8:56 am
by PeterHarmes
Uwe,
Looking forward to the update
Pete
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 8:57 am
by nageswaragunupudi
Mr Peter
This is EXTREMELY SIMPLE.
Just follow Mr Rick's suggestion.
You need to add just One Line of code
where n is the column number of the browse showing the field containing the filename
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 9:23 am
by PeterHarmes
Setting the cDatatype works well
Thanks once again
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 10:35 am
by PeterHarmes
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?
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 12:47 pm
by nageswaragunupudi
Work on all.
Please make sure two things
value should be a valid path
and that column's cDataType should be set to "F"
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 2:01 pm
by nageswaragunupudi
Please try this example program:
Code: Select all
#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:
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 2:25 pm
by PeterHarmes
Thanks for the example and it pointed out my glaringly obvious mistake.
Best regards,
Pete
Re: JPG images in an xBrowse
Posted: Mon Aug 05, 2013 6:26 pm
by ukoenig
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