Pictures

ldonners
ldonners used Ask the Experts™
on
If I use Foxpro interactively I can use the browse window, a general field and I can cut and paste in pictures - .gif, .bmp etc.
When I write/compile and application, cut & paste  is no longer available.  The pictures often change and I have to distribute them on CD.  Any suggestions?

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Cut&paste is available if you define a menu with cut,copy,paste options.

define popup _medit
DEFINE BAR _med_slcta OF _medit PROMPT '' KEY CTRL+A
DEFINE BAR _med_paste OF _medit PROMPT '' KEY CTRL+V
DEFINE BAR _med_copy OF _medit PROMPT '' KEY CTRL+C
DEFINE BAR _med_cut OF _medit PROMPT '' KEY CTRL+X
DEFINE BAR _med_redo OF _medit PROMPT '' KEY CTRL+R
DEFINE BAR _med_undo OF _medit PROMPT '' KEY CTRL+Z

Having this code is enough to get cut,copy,paste functionality. You don't need to activate nor show a menu.
Commented:
BTW this wouldn't apply to files on CD. They're readonly.
Commented:
I suggest not to keep pictures themselves as general field on a table. Instead keep path&filenames and show with an image control or web browsr control.
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

What you're doing in interactivate mode in your development copy of VFP is the manual way.

As far as the runtime version, you can just treat those general fields in any specific tables as you would any other data by using a REPLACE, a SQL INSERT, or a SQL UPDATE to add or change the contents of any general field you wish.

The following MS KB article gives more detail on this (read for concept, not for the exact task they're performing):

Transferring Data Between General Fields Programmatically
http://support.microsoft.com/default.aspx?scid=kb;en-us;131306

Further reading:

How To Programmatically Embed and Link Part of a File
http://support.microsoft.com/default.aspx?scid=kb;en-us;100444
While you may have the pictures working fine for now in general fields, it's better for performance reasons and fpt file bloat issues to keep the images external to the database and its associated tables.  For a good answer on this area, read the older posted message by Christof Lange on this at:

http://www.experts-exchange.com/Databases/FoxPro/Q_10477639.html#2990352

Author

Commented:
Curiously Microsoft Support came up rapidly with an elegant solution.  This was to set up procedures (I used .prgs) and On Key commands.

After 20 years of trying I've never had any response for anything from Microsoft before despite myriad requests, so this was a welcome change.  

As a result I can now cut and paste pictures into a general field and my users can now create interactive catalogs from their own digital artwork.  Microsoft did assure me that there is NO plan to extend the facility into the standard Foxpro product.  Cut and paste works fine in the standard interpreted version but will not work in a compiled application - so this is a good workaround.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial