2

I am about to compile my PBL to a working PBD. My problem is how can I call the image folder properly. e.g. Toolbars, icons, pictures of some command buttons properly and dynamically. For example I installed mine at C:\MyProgram\ but when my users they will put it in C:\Program Files\HisProgram .. do i have to state that the images should be in the same place as I do. C:\images\ because now I am having missing toolbar icons when i tried it on my test machine. i tried the resource pbr but it also must define the proper location of the image. Any techniques you could refer me to?

i tried the GetCurrentDirectory() but i was looking for a much more suitable way

GetCurrentDirectory Link i found http://www.pbsql.info/2011/01/relative-path-to-images-problem-in.html

Hugh Brackett
  • 2,706
  • 14
  • 21
Sid
  • 765
  • 5
  • 29
  • 57

1 Answers1

2

No need to wonder about the current directory, you can just use a relative path in the pbr file.

For example, put all your pictures into the resource folder and in the pbr, you can refer to resource\image.jpg and so on, without need to refer to c:\project\resource\image.jpg.

Seki
  • 11,135
  • 7
  • 46
  • 70
  • what if I change the image thru code? IF .. THEN pic = "pic1.jpg" ELSE "nopic.jpg" how do I direct it? – Sid Mar 13 '12 at 02:50
  • @Sid: if you change dynamically the pics, you need to mention all of them in the pbr file. When you will change the name of the resource in the code, PB will first look for it in the resource that were linked through the pbr file. In your post you asked about resources in different places, that is not a problem for the pbr file, if you have all of them available at the compile time. But maybe that I did not understand correctly: can your users use their own resources that you do not know at compile time? – Seki Mar 13 '12 at 14:52
  • 1
    Two additions: 1. When you define them in the PBR, they have to be defined *exactly* as they are in code or in object attributes (e.g. "resource\image.jpg" in an attribute won't match "c:\project\resource\image.jpg" in the PBR) 2. Just to be clear, when you declare them in the PBR, they are compiled into the PBD and the image files don't need to be deployed individually – Terry Mar 13 '12 at 17:19