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

Moving the project

Status
Not open for further replies.

JaPoChi

Technical User
Feb 19, 2011
11
RO
I have this field which retains an address (where is stocked a picture). My problem is that I have to move the entire project to an another computer and when I run the program the picture won't appear. A friend said that if I write %/folder/picturename.extension the project will search the picture itself. I'm not allowed to modify the project after I moved it, so if there is a trick that allows me to move the project and also to find the picture, please tell me.
 
Your question is quite unclear.

It makes no sense whatsoever not to be able to modify a project. Your project is your source code. If you are unable to modify it, then you will never be able to fix anything. But I suspect you may be using the word project to mean something other than the Foxpro meaning for project.

From your description, I fear you may be talking about a general field containing images. The images wouldn't display on a computer that wasn't used to create them unless that computer had the same OLE imaging application installed as the original computer.

If that isn't the case, then when you move the "project" then you must also move all of the associated images.

Can you clarify your question?
 
I second dan,

also your friend isn't foxpro or windows user, am I right?
1. in windows paths have backslashes
2. in LIKE you can use %, but relative paths rather begin with . or backslash.

There are several ways of getting a picture to show on a form, as long as I don't know what is used in the form I could only give you a very verbose answer on how to add pictures in the several ways. You don't want that. More important I don't want to spend that much time ;)

You say you have an adress field. What kind of adress is in there, now?

In most cases the image control accepts either a full absolute or a relative path, in case of a relative path you copy the pic to the same relative location, in case of an absolute path you retain the picture where it is and it will be taken from there. I don't see a case, where you would have a problem, other than the general field case dan explains.

Bye, Olaf.
 
i just need a relative path, but with backslash doesn't work. In my address field I have the full path now, but I also tried with backslash.
 
My address field now retains : e:\folder1\folder2\picture.jpg and all I need is to retain something like this: \folder1\folder2\picture.jpg , without the local disc and to recognize the picture on another computer.
 
JaPoChi,

So, what you are saying is that you need to make the address of the picture file relative to a drive, rather than storing it as an absolute address.

To do that, you simply need to store the drive letter in a variable. For example:

Code:
lcDrive = "e:\"

Then, when you're ready to use the filename, concatenate it with that variable:

Code:
lcFullAddressOfFile = ;
  lcDrive + MyTable.AddressField

An alternative approach is to add the directory containing the file to the search path:

Code:
SET PATH TO e:\folder1\folder2 ADDITIVE

Then just store the base filename in the address field. That way, the only thing you need to change when you move the project is the SET PATH command.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
I had a sneaky feeling this didn't have anything to do with projects. :)

i just need a relative path, but with backslash doesn't work. In my address field I have the full path now, but I also tried with backslash.

You misunderstand the phrase "relative path", it seems. Relative to what? Beginning with \ just makes the path relative to the root of the current drive. In fact, *any* relative path will refer to the current drive.

My address field now retains : e:\folder1\folder2\picture.jpg and all I need is to retain something like this: \folder1\folder2\picture.jpg , without the local disc and to recognize the picture on another computer.

You face a two-step process here, neither step having anything at all to do with Foxpro:

1) Create a share on the PC hosting the pictures
2) On the new PC, map a drive letter to that shared resource on the network

Once you've mapped a drive letter, you can then refer to images on that "drive" in your application.

Once you've done that, the REPLACE command can be used to alter the path currently stored.
 
Ok, I was thining about one of these three situations:

1. Pictures are on a network share you also have mapped as the same drive letter on your machine.
- or -
2. Pictures are in a project subfolder
- or -
3. You move the project to a new place, but on the same computer

Now that you've specified the full problem: Why don't you simply copy the picture to the place they are expected? If that doesn't hav a drive e: you can map a folder as e:

Also, what is displayed as picture path and what is stored in the class or form file.

For example, opening Home()+"tools\xsource\vfpsource\wizards\wzform\wizbtns.vcx" as a table, looking into picformbtns, which is record 44, in the propoerties memo picture properties are for example wizbmps\wzlocate.bmp

So foxpro displays full paths but stores relative paths. You never enter relative paths in fact, you simply point to a picture and let foxpro decide. If a pic is from a different drive than the project file is located, foxpro stores a full absolute path.

So, if picture are in project subfolder, don't be afraid to move the project, it will work from a new location, even if that is not drive e:

If the project is located on drive c: and the pic on e: the path will be the full path and you need to copy pics to the same location or change picture path.

Because foxpro does what it does it's good to have all project files including pics into a the same folder the pjx is or subfolders. Any other location should be fixed for all other developers, eg a shared drive mapped the same in your whole company.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top