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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing JPG stored in a general field using an oleboundcontrol

Status
Not open for further replies.

weedz

Programmer
Dec 5, 2000
718
NL
Is it possible to show stored JPG files (in a general field) via an oleboundcontrol ??
Currently it automatically shows ICONS and BMP files but shows an icon indicating that it is a JPG file.

Thanks,

Weedz.
 
weedz

An simpler way to view .jpg files is to use an .image control on a form and in your SET PATH statement, (if you have one), include a folder containing the .jpg files.

A field in a table can then contain the relevant .jpg filenames.

In code the syntax is:-

THISFORM.image1.Picture = ALLT(TABLE.fieldname)

Hope this helps

Chris
 
Thanks Chris,

Your option is the one I started with, but in my app I wish to show the images also in a grid, giving the users the ability to see an overview of the images. When using an olebound control and bmp's I can show them in a grid using a container with text boxes for info and an oleboundcontrol to show the images (just by setting the controlsource to the general field). This works fine when using bmp's.
But when using an image control in a grid and setting the path to the image (the path would then be stored in a table), this does not give a list with images but only the current image chosen.
In essence I would get a list that shows different data but the same picture in all rows.

Can I maybe use other VFP native controls to get this effect ??

Thanks for reading,

Weedz.
 
You can use image controls in grid by way you started to use. However, you need to find a way to refresh image for each row of grid while grid draws it rows. You can do this by following way:
In dynamiccurrent* (any of them) property of column specify function call. In this UDF use column.Image.Picture = ... After calculating of all dynamiccurrent* expressions VFP paints row. Image will be already with another image, so will be painted correctly. This UDF will be called for each row displayed/refreshed.




Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Vlad Grynchyshyn,

I'll give it a try. Maybe I can use one of the dynamic properties. I'll give it a try and let you know if I succeeded.

Thanks,

Weedz.
 
weedz

Following Vlad's comments


Add a new form method called cFileName
(For simplicity full control names are used)


In THISFORM.Grid1.Column1.Init event put :-

THISFORM.Grid1.Column1.Image1.Picture = ALLT(TABLE.fieldname)

In THISFORM.Grid1.Column1.DynamicCurrentControl put:-

THISFORM.cFileName()

In THISFORM.cFileName put :-

THISFORM.Grid1.Column1.Image1.Picture = ALLT(TABLE.fieldname)

Set the .Sparse property of THISFORM.Grid1.Column1 to .F.



You will find the Refresh rate relatively slow.

Chris

 
Chris,

Thanks for your comment. I experienced the refresh rate slowness as well in my earlier attempts with the image control. But I will give it a try and try to sort out the refresh problems.

Thanks again,

Weedz
veld4663@exact.nl
 
I doubt you will get better refresh rate with OLEBound control. Its no matter who and when refresh image - anyway it displayed for each row, that cause delay in any case, just to display it. I agree that call of custom function in Dynamic* expression slows down grid refreshing a bit. However, probably you do not display a lof of rows for such grid, so above probably will not be a significant slow down.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
weedz

If you want give your user a scaleable view of the thumbnails, try the following in a form with .BorderStyle = 3 and .Grid1.Left = 0 and .Grid1.Top = 0

Grid1.Column1 should contain the .Image control and Grid1.Column2 should contain TABLE.fieldname

In the .Init and .Resize events of the form put:-

WITH THISFORM
[tab].LockScreen = .T.
[tab].Grid1.Width = THIS.Width
[tab].Grid1.Height = THIS.Height
[tab].Grid1.Column1.Width = THIS.Width - 175
[tab].Grid1.RowHeight = THIS.Height / 3
[tab].LockScreen = .F.
ENDWITH


As the user resizes the form so the grid scales itself, with Grid1.Column2.Width remaining constant.

You will need to adjust the values to suit your own application.

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top