I am trying to follow the instructions in the following FAQ
My oleImageEdit control does not have .Datafield however it has "image" so I replaced the datafield ref to image, but the line .oleImageEdit.image = filename has the error.
I tried thisform.oleImageEdit.image = filename with same error.
It must be the syntax, new oop programmer first time
<<<Full copy of FAQ below>>>
How can I create a viewer using the Kodak Image Edit ActiveX control
faq184-2401
The VFP control .Image has a limited functionality in terms of image file types supported and the ability to view an image file at different resolutions.
The ActiveX control, Kodak Image Edit, is one of a suite of ActiveX controls that comprise the MS Imaging application, which comes with all versions of Windows with exception of XP. (It will run in XP)
This FAQ outlines the methodology required to create a simple bare bones but powerful image viewer that will resolve the previously mentioned deficiencies of the VFP Image control.
You require a :-
Top-level form
The Image Edit ActiveX control
A toolbar class
A menu
Create a top-level form and drop onto it the Image Edit ActiveX control, renaming it 'oleImageEdit'
In the .Init() event of the form put :-
LPARAMETERS filename
WITH THIS
.Resize()
.oleImageEdit.DataField = filename
.oleImageEdit.Zoom = 100
ENDW
In the .Resize() event of the form put :-
WITH THIS.oleImageEdit
.Height = THISFORM.Height
.Left = 0
.Top = 0
.Width = THISFORM.Width
ENDW
In the .Unload() event of the form put :-
RELEASE oViewer
To call the form :-
PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED WITH lcFilename
where lcFileName is the path\filename.ext of the graphics file to be viewed.
The menu/toolbar combination extends the functionality by providing the means to navigate the pages of a multipaged .tiff file and select different zoom levels.
The options required for .tiff navigation are :-
First Page
Previous Page
Next Page
Last Page
The .oleImageEdit.ActivePage value determines the page to be viewed, and .oleImageEdit.PageCount returns the number of pages in a .tiff.
The .oleImageEdit.FitTo() method takes a parameter of :-
0 - Best Fit
1 - Fit to width
2 - Fit to height
3 - Inch to Inch (Actual size)
which determines the view.
Additional preset zoom levels can be added and a spinner should be added to the toolbar, the .InterActive() change event changing the zoom factor.
The image file types that the viewer supports are :-
TIFF
AWD
BMP
PCX
DCX
JPG
XIF
GIF
WIFF
The viewer's fuctionality can be extended by the addition of OLE Drag and Drop on the toolbar - it's not possible on the form.
This would allow a user to drag and drop graphics files from Windows Explorer, etc, for viewing.
.oleImageEdit supports VFP drag and drop so filenames could be dragged and dropped from a VFP application.
A menu option/graphical checkbox could call a form method called .mGetFile() which would use the GETFILE() function to return a filename for viewing.
By installing a suitable Postscript Printer driver and Ghostscript, VFP reports can be printed to a .ps file and there to a .tiff for previewing.
Additionally, by printing from Word, FI, through the Postscript Printer driver, multiple paged word docs can be viewed as a .tiff.
Have fun!