Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alternative to OLE linking (causing huge memo files)?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00305133
Message ID:
00305357
Views:
22
David,

You have multiple problems to overcome here. I can give you some ideas but I can't create the stuff for you. Here goes.

  • 1st problem, storing the images associated with a product

    Use a character field named ProdImage to store the path and file name for an image that resides on disk separately from the dbf. Insure that products that do not have an image have this field as blank.

  • 2nd problem, displaying the images in a form while editing or viewing products.

    Add an Image control to the form and set its name property to imgProduct.

    In Image control's refresh method put this code;
    This.Picture = TableAlias.ProdImage
  • 3rd Problem, adding an image to a product's record.

    Provide a button for Add\Change the image. Have the click of this button call the VFP GetPict() function (see help file for details) and store the selected file's name in the field ProdImage. Then refresh the form.

  • 4th Problem, printing the image in a report.

    The report requires that the bmp be in a general field in order for the OLEControl in the report to print it. However, you cand rive the report with a temporary cursor that meets this requirement and only exists for printing the report.

    In the form Load fo the form that drives the report create a cursor;

    CREATE CURSOR MYCatalog ... (see help file for details)

    Be sure the cursor has all the fields your report needs including one general field for the image.

    In the method of the fomr that will run the report, before you REPORT FORM, process the data from the original table into teh cursor to prepare for the report. If you name the fields in the report (except for the general field) with the same names as the table then you can:
    LOCAL lcFile
    SELECT TheTable
    SCAN FOR TheReportCondition
       SCATTER MEMO MEMVAR
       SELECT MyCatalog
       APPEND BLANK
       GATHER MEMVAR
       IF NOT EMPTY(TheTable.ProdImage)
          lcFile = ALLTRIM(TheTable.ProdImage)
          APPEND GENERAL TheGeneralFieldName FROM &lcFile
       ENDIF
    ENDSCAN
    
    REPORT FORM Whatever TO PRINT NOCONSOLE
    Hope this gives you the right nudge to get you going.
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform