1. Tracy Lamb
  2. PowerBuilder
  3. Wednesday, 07 March 2018

I have a lot of graphic files in my application.  From time to time I change the directory names on the app (ie, when migrating, updating or developing next ugrade/release).  Is there a way to do this without having to change the code and point to the new directory for the same graphic in every single object that uses a picture control?  I have 2 pbd that are compiled with pbr files.  It works perfectly when the full directory path is in both the code and pbr.  I changed the code to just use the graphic file name with no directory path, but left the pbr file with the full directory.   Didn't work.  So I tried also removing the directory path from the pbr, no luck there either.  Surely there's a simple way to change directory names for graphics without changing the code for the new directory names... any advice to simplify this would be greatly appreciated.

TYIA, ~~~Tracy

Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Tracy;

   What I do is keep all my images in a sub-folder to the main working App folder when developing, testing & running under the PB IDE. I use "relative" path addressing for every image. So for example a picture, icon, etc could be:  ".\Images\tracy.png".

   In my "Images" sub-folder, I store a PBL and PBR that I use to compile all the images into that PBL => PBD / DLL. The PBR has no path references in it for any image. So at the end of the compile, I can copy the App EXE & its PBD/DLL's to a deployment folder then, copy the lone PBD/DLL in the "images" sub-folder also to the deployment folder.

   The PowerScript code in my image controls and DWO's checks to see if the App is running under the PB IDE. If not, it parses out the ".\images\" part of the image path. So from the above example that would be: ".\Images\tracy.png" =>  "tracy.png". Now the App EXE at run-time gets all of its images from the PBD/DLL that contains them. This is all done via my framework - so this coding approach is always ready to implement with no extra coding at the PB App side. Just follow the ".\Images\xxxxx.xxx" approach.

Food for thought.

Regards ... Chris

Comment
There are no comments made yet.
  1. Friday, 20 July 2018
  2. PowerBuilder
  3. # 1
Govinda Lopez Accepted Answer Pending Moderation
0
Votes
Undo

Hi Tracy,

 

Out of curiosity, what version of PowerBuilder are you doing this with?

 

Regards,

Comment
I just migrated again... started years ago with PB 3, then 5, then 12 and now PB 17/R2
  1. Tracy Lamb
  2. Friday, 20 July 2018
There are no comments made yet.
  1. Friday, 9 March 2018
  2. PowerBuilder
  3. # 2
Brad Mettee Accepted Answer Pending Moderation
0
Votes
Undo

Expanding on Roland's answer: After adding the path to the PB170.EXE registry entry, make sure all of your references in the application have no path, and the PBR has no paths in it either.

During runtime, PB will find the images because of the path, and during compile they'll be found and included in the EXE.

 

Comment
There are no comments made yet.
  1. Thursday, 8 March 2018
  2. PowerBuilder
  3. # 3
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

Add the folder where the graphic files are located to the App Path in the registry for the IDE. For 2017 the registry key folder is:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\App Paths\pb170.exe

 

Comment
There are no comments made yet.
  1. Thursday, 8 March 2018
  2. PowerBuilder
  3. # 4
René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

You can use relative paths in your code. Use this relative paths also in the PBR.

Comment
There are no comments made yet.
  1. Thursday, 8 March 2018
  2. PowerBuilder
  3. # 5
Olan Knight Accepted Answer Pending Moderation
0
Votes
Undo

Are the files listed in a PBR that accompanies the application?

If not, try creating a PBR file and listing all of your graphic files in the PBR. 

In the worst case, you can then simply EDIT the PBR and CHANGE ALL on the directory name.

 

Olan

Comment
There are no comments made yet.
  1. Thursday, 8 March 2018
  2. PowerBuilder
  3. # 6
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.