>I am starting a new thread because I got the program working so that a form can add a BMP image to a general field and display it on the form and in a report and I think I know the questions to ask.
>
>I now want to enhance the program so that it can do the same with JPEG and TIFF images (which are smaller and which they user can get when he scans objects). If possible I want to either save the images in the table or to point to the image file. While the second option might use less space the first one might be easier to implement.
>
>I am willing to change the field where images are stored to another field type. The current form has buttons to move the pointer in the table top, next, prev, and bot. It also has buttons to add new data and edit existing data. In both cases it has a tab to add or change an image. Clicking on the Add/Change Image displays a GETPICT dialog. There is also a Remove Image Button on the Picture tab. The Picture tab also has a place to display the picture.
>
>My questions are:
>
>1. What should I change the table field to?
>2. What properties should the buttons move the pointer?
>3. What should the click methods of the buttons that move the pointer have?
>4. What properties should the buttons add ore edit the picture be.
>5. What should the click methods of the the buttons that add or edit be?
>6. What assignments to I need in add/change button do I need to display the graphics file?
That's a whole lot of questions <g>
>1. What should I change the table field to?
cPictureFile C(100) (assuming you only want to store picture name with extension and not a path (you use the same Image directory)). If you want to store with the path, you may need memo field.
Actually, 100 may not be enough according to
http://www.berezniker.com/display/VFP/Windows+limitations+on+file+and+path+name>2. What properties should the buttons move the pointer?
This question is unclear.
>3. What should the click methods of the buttons that move the pointer have?
Something like (NEXT button) thisform.Next(), where Next method could be
LOCAL lnRecNo, ;
lnRetVal
IF EMPTY(thisform.cMainAlias)
RETURN
ENDIF
SELECT (thisform.cMainAlias)
IF !EOF()
IF !thisform.WriteBuffer()
RETURN FILE_CANCEL
ENDIF
IF thisform.IsNewAndEmpty()
thisform.Restore()
ELSE
IF thisform.DataChanged() AND thisform.AskToSave() = IDCANCEL
RETURN FILE_CANCEL
ENDIF
ENDIF
lnRecNo = RECNO()
SELECT (thisform.cMainAlias)
SKIP
IF EOF()
SKIP -1
RETURN FILE_EOF
ENDIF
IF lnRecNo = RECNO()
RETURN FILE_CANCEL
ENDIF
thisform.RefreshForm()
RETURN FILE_OK
ELSE
RETURN FILE_EOF
ENDIF
>4. What properties should the buttons add ore edit the picture be.
?
>5. What should the click methods of the the buttons that add or edit be?
>6. What assignments to I need in add/change button do I need to display the graphics file?
thisform.myImage.picture = (IMAGE_DIR + MyTable.cPictureFile)
>7. How to I display the picture in a report?
>
Select file and specify (IMAGE_DIR + MyTable.cPictureFile)
>A concrete example would be very helpful and highly appreciated.
If it's not broken, fix it until it is.
My Blog