PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Why the Viewer may not be able to locate image for display  (Read 753 times)

PxPlus

  • Administrator
  • Diamond Member
  • *****
  • Posts: 1066
    • View Profile
It is possible when using a PREFIX to have a situation where printing an image to *winprt* will work whereas just changing the output to *viewer* will not.

When you open/print to *winprt* the printing is done in your current process whereas when you use the viewer the printing is done from a spawned session. This can cause a problem when the spawned session does not have the same PREFIX due to some logic in your START_UP or elsewhere in your application.

For example if you had a file "C:\MyApp\junk.bmp" which had an image in it and you issued:

    PREFIX "c:\MyApp\"

You could then open "*winprt*" and issue

    PRINT (ch) 'PICTURE'(100,100,400,400,"junk.bmp")

This will work fine, however if you open *viewer* the PRINT won't work because the Viewer is in spawned task. Only if the PREFIX is set in your START_UP program would the viewer be able to find the image.

To avoid this problem use the full pathname in the 'PICTURE' mnemonic or if using PxPlus use the PTH("image") function to return the full pathname as in:

    PRINT (ch) 'PICTURE'(100,100,400,400,PTH("junk.bmp"))   
« Last Edit: June 15, 2018, 06:30:45 PM by PxPlus »