Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GRID AS PHOTO ALBUM 1

Status
Not open for further replies.

Gotheallblacks

Programmer
Oct 16, 2003
60
NZ
Currently I have a treeview as a menu which is used to display photo/picture from Graphic File(s) of stock/products when node clicked. I am wanting to change this to an Album of say 6 pics across with scrolling and filtering by category via treectrl. I thought about using a grid but I am limited (I think) to loading multiple Blob fields(or filenames) in a table the number of columns of pictures I want across the form/grid (like dockable image viewer solution sample VFP9) but multi column and able to be filtered by category. Is there a better way to do this that doesn't require creating a seperate table with categorised multi blob columns/fields ?
 
I am limited (I think) to loading multiple Blob fields(or filenames) in a table the number of columns of pictures I want across the form/grid

You need a table to get multiple rows in the grid but the number of columns is under your control and you can put any content in any of the cells - they don't have to be bound to a field.

Geoff Franklin
 

Gotheallblacks,

Not sure I understand this correctly. Do you have a fixed number of images per category? If not, you'll have no way of knowing in advance how many columns to show in the grid.

Or, are you saying you want to only show one category at a time, so the grid will have one column, with one row per image? If so, a grid should be fine. Or, you could use a container, and programmatically add and remove image controls as the user navigates the categories.

Either approach might be quite slow, but that's difficult to avoid when dealing with images.

If I have misunderstand your requirements, my apologies.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Gotheallblacks

One alternative would be to use a single column grid containing thumbnails of the images and an image control which would display the selected full size image in the grid, Kodak Imaging style.

You would find the best performance would be derived by creating a thumbnail image for each full size image and storing the path\filename.ext in a table which would be the .RecordSource for the grid.

To minimize the time taken to render the thumbnails, use the .DynamicCurrentControl property of the column to call a UDF or object method which would set the .Picture property of the .Image control in the grid.

The .DynamicCurrentControl property only 'reacts' to visible controls on screen and is not affected by the total number of records in the .RecordSource of the grid.

So if you have a 1000 thumbnails in the .RecordSource and only 5 are visible in the grid, only the visible thumbnails are rendered.

In the .AfterRowColChange() event, the value of the main .Picture property is determined to be the thumbnails' original full size image.

You can still filter with your treeview control by using SELECT SQL... to create cursors for the .RecordSource of the grid.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Sorry I didn't explain myself properly.

I have a parent table "range" and a child table "product" I wish to display the pictures of "product" which belong to the selected "range" (up to 150 pics per range) say 5-6 pictures across with scrolling. ie similar to iexplorer with folders/thumbnail view on.
Mike similar to your "Simplelist" but with pictures/photos not imagelist/icons.
My pictures (several hundred) are small 3-24k so the speed isn't too much of a problem.
My first thoughts were to create an intermediate file with say 1 range field 6 blob fields and 6 reference fields and
load it in range order and create a six column grid to display the 6 pictures across.

My question was is there a better way or better control as this seems cludgy ?

 

Gotheallblacks.


Mike similar to your "Simplelist" but with pictures/photos not imagelist/icons.

SimpleList can in fact display any kind of images, not just icons. The constraint is that they are only displayed at the two fixed sizes, of which the larger is 48 x 48. Would that work for you?

Alternatively, how about creating the intermediate file as you suggested, but with only one field, and as many records as there are images in the currently selected range (every time the user moves to a different range, you would regenerate the intermediate file).

Then use the intermediate file as the RecordSource for a one-column grid. Place an Image control in the grid, and bind it to the single field in the intermediate file.

That would give the advantage of not being limited to six images at a time, and would be relatively simple to implement.

I know you said you wanted horizontal srolling, whereas the grid would give you vertical scrolling. Can you live with that?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike
Mike said:
Place an Image control in the grid, and bind it to the single field in the intermediate file.
With respect, that will give you an unnecessary performance hit the magnitude of which will depend on the number and also the size of the images referenced in the table.


See the earlier post in this thread which outlines how to use the .DynamicCurrentControl property of the column to overcome the problem.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 

Chris,

I missed your earlier point about DynamicCurrentControl only reacting to the visible controls. I hadn't realised that. It would certainly give much better performance, assuming the number of images visible at one time is small compared to the total number of images in the intermediate cursor.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
I detailed a similar approach that uses the backstyle_access method of the visible contols in my blog entry:

Visual FoxPro Grid - A Tip and a Calendar Class

There's a simple example in the download that will ask for a directory containing images and then display all of the images from that directory in a grid using a single image control in a container.

Anyways, nice tip on using the DynamicCurrentControl Chris. Star for you.

boyd.gif

SweetPotato Software Website
My Blog
 
Thanks Chris

Have I understood this ?
When I read your solution I thought it only gave me one column whereas I wanted more like 6 columns and 4 rows of pictures with vertical scrolling to show more pictures.
I understood the .DynamicCurrentControl property.
Are you saying use SELECT creating a cursor with 6 fields/columns of filenames ie an interim file ?

I was wanting to use the new Blob field as I distribute the App to my retailers and it offers some protection for the pictures.
 
Gotheallblacks

MikeLewis and I were both suggesting a single column grid as an alternative to your six column grid.

Without thinking through the implications, a six column version may work.

Personally I would stay with referencing the images in a field rather than have them in fields in a table.

Perhaps you could distribute the images in .zip format and programatically unzip the images to the relevant folder(s).

Should any 'go missing' or be modified, the unzip routine could be run again.

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Craig

Thanks for the star.

I'm a great fan of the DynamicCurrentControl - it can used as a gateway to allows further processing applicable to any visible column/cell in a grid.

The now ancient FAQ

How can I color code cells in a grid? faq184-624

is another example of its versatility.

Keep on with your BLOG! [smile]

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.net
PDFcommandertm.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top