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

Unknown Member

Status
Not open for further replies.

metron9

Programmer
Mar 5, 2002
94
US

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!
 
metron9

You need to check that you have the correct ActiveX control

In the properties sheet, click on the 'Other' tab and go to 'OleClass'.

It should read 'Imaging.EditCtrl.1'

Then click on the 'All' tab and scroll down until you see a property called 'DataField' which should be empty.

Assuming that to be correct, it sounds as your code is incorrect.

PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED WITH lcFilename

You need to assign a value to lcFilename, such as lcFilename = [C:\my pictures\test.jpg], before calling the form, otherwise lcFilename will have a value of .F.
HTH

Chris [pc2]
 
metron9

I also assumed you have renamed your control to be .oleImageEdit, and not left it as the default name? HTH

Chris [pc2]
 
I gave up on the ole one and just used the IMAGE control.
I thought you could only use .BMP files in it but it works for jpg too and thats what I need.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top