1. Amit Sharma
  2. PowerBuilder
  3. Tuesday, 4 June 2024 15:41 PM UTC

Hi,

I really can use quick help. I am Powerbuilder user for so many years but never used Resource file (.pbr). First time I run into issue of using it and not finding luck. Here is the scenario.

I have files on network

\\domain.com\images\xyz.gif

 

My resource file (myapp.pbr) has entry

\\domain.com\images\xyz.gif

 

I am including it during build and also copying it to deployment folder but Datawindow not showing any image. I have removed the path in datawindow for image and just left the name xyz.gif.

 

What am I doing wrong?

 

Another question, How do I convert/deploy any of these resource files as pbd or dll?

 

Appreciate any help.

John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 5 June 2024 01:20 AM UTC
  2. PowerBuilder
  3. # 1

Hi, Amil -

I suggest you read the information about .pbr files here:

    https://docs.appeon.com/pb2022r3/pbug/Distributing_resources.html

I would never reference a resource file (such as a graphics image) on a network drive. I suggest they be copied into the same folder as your pbl's, or in a sub-folder (named "resources" or "graphics", for example) under the folder that contains the pbl's.

In your application, reference the graphic only by the name.ext, or by a relative path. Example: ..\graphics\xyz.gif

In the pbr file, list the graphics resources in the same manner as you do in the code.

When deploying (compiling) the app, specify the pbr file in the project painter. If everything is done correctly, the resource(s) will be included into the application exe, thus being available to the app when it executes without having the individual resource file(s) be distributed with the app.

Also in the Libraries tab of the Project Painter, in the list of pbl's you can optionally associate a pbr file with a pbl. When compiled, the resource(s) listed in such a "pbl-level" pbr file will be included in the PBD/DLL that is produced.

Using an empty pbl (no objects in it), if you build resources into the pbl, the PBD/DLL produced by the compiler will contain ONLY the graphics listed in the pbr file. I've seen this technique used to include one or more versions of a customer's company logo on invoices or other documents, for example, so that the DataWindow(s) needed to produce the invoice, etc. are generic, but are branded for each client/customer by simply distributing the appropriate "logo" PBD/DLL with the application.

Others in the Community will likely have additional ideas/suggestions, so I invite them to chime in.

HTH, Best regards, John

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 6 June 2024 14:37 PM UTC
Hi Andrew;

FYI: Have a look at my STD Framework's OrderEntry Demo App. It's been coded for decades now so that not one absolute path is being used to any external resources. Especially in the PBR / Images area. https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry

HTH ;-)

Regards .. Chris
  1. Helpful
  1. Andrew Barnes
  2. Friday, 7 June 2024 21:26 PM UTC
It doesn't open for me, no doubt due to me running an older version of PB. I did poke around a bit through the structure, and found your Images subfolder containing OES_Images.pbl, OrderEntry.pbr, etc.



If I am understanding the way is works correctly, it seems conceptually similar to what I was doing with my OldIocons build, but with you having the .PBL. .PBR, and image files all in the same folder instead of having the bitmaps in an external folder. As such, it makes sense that you do not need any absolute paths in the .PBR for the PB build process to properly package the graphic files into the compiled PBD.



The part though that I am curious about, is how do you reference the images in your code without an absolute path? The Select Image dialog always puts in the absolute path when you pick an image, and if I delete the path aside from the actual image file name, the only way the PB can find said image in the IDE is if the image is in the same folder as the PBL containing the object for which I am selecting the image file.



Looking at what you did, I see how I could reconfigure my OldIcons project to remove the image paths in its PBR, but I cannot see how I can avoid including the full image paths in the many applications that reference those images.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Saturday, 8 June 2024 00:03 AM UTC
The key is how I setup all images to be in the OES_Images.pbl via the OrderEntry.pbr.

You could do the same & thus no paths required. Food for thought.
  1. Helpful
There are no comments made yet.
Amit Sharma Accepted Answer Pending Moderation
  1. Wednesday, 5 June 2024 13:32 PM UTC
  2. PowerBuilder
  3. # 2

Thanks John. I think I tried these steps but going to give another clean try. 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Saturday, 8 June 2024 01:52 AM UTC
  2. PowerBuilder
  3. # 3

The image files in the .pbr and in code should be filename only, xyz.gif for example. Then you can put all the image files in one folder and add it to your system path or the App Path of the program that builds the exe, the IDE for example.

Comment
There are no comments made yet.
  • Page :
  • 1


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