How to deploy bitmaps when running in application server
Estimated Reading Time: 1 MinutesConsider the following situation; a customer develops a graphical program, either using the Screen Painter of the IDE or coding everything by hand. The program contains an Screen with several bitmaps on the push-buttons that are entered as relative paths, they work ok if the program is running standalone however running on a client/server environment (Thin Client or WebClient for instance) there are more things to take into account. What are the options to make these bitmaps available to the program no matter where it's run?
The options for making your bitmaps available to W$BITMAP load at run time are:
- Use a relative path and start iscserver from the same folder as the bitmaps
- Put the path to the bitmaps in the CLASSPATH (in isserver.vmoptions in case of Windows service)
- Use a configuration variable for the root directory, reference the variable, and build the full path to pass to W$BITMAP (iscobol.mybmppath=c:mainroot - Accept bit-root from environment mybmppath)
The #3 is the best practice, especially for ISVs that will be installing on different systems.
Also, there is a way to load a bitmap from the client machine, approach that has two considerations: it can be faster because the request doesn't go to the server, however there is a caveat, this option needs to have the bitmaps in all the client machines.
Following some code snippets to illustrate the above suggestions:
Using relative path
CALL "W$BITMAP" USING WBITMAP-LOAD "resources ool.png" GIVING h-toolUsing only the bitmap name:
CALL "W$BITMAP" USING WBITMAP-LOAD "tool.png" GIVING h-toolLoading the bitmap from the client:
CALL "W$BITMAP" USING WBITMAP-LOAD-FROM-CLIENT "my-logo.png" GIVING h-logo