1. Robert Sawyer
  2. PowerBuilder
  3. Thursday, 6 June 2024 12:29 PM UTC

I want to have a datawindow that contains a different image for each row. I created a picture object and put it in the detail band. I also added a regular string column 'pic_object' (external datawindow).

What I want is something like this:

Row 1 dog.png

Row 2 cat.png

row 3 mouse.png

If I do this: dw_1.Object.p_1.Filename = 'C:\dog.png' it works but sets the picture image for all rows.

I then tried adding a compute column that has this as the expression bitmap( pic_object ). So I insert row one and set pic_object to 'C:\dog.png' thinking pic_object might display my picture but it doesn't work. 

 

Any help is appreciated.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 June 2024 16:00 PM UTC
  2. PowerBuilder
  3. # 1

Hi Robert;

  I just did a quick test using an external DWO and the "Display as Picture" property. Here is my test result ...

As you can see - no issues.

Regards ... Chris

Comment
  1. Robert Sawyer
  2. Thursday, 6 June 2024 16:17 PM UTC
I am a doofus:

s_pic = "C:home_hover.png'" (see the extra quote mark?) That's why it didn't work - works now. BTW - thanks to everyone here that takes the time and effort to help me out in all my questions. I really appreciate it and it save so much time and headache.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 6 June 2024 16:23 PM UTC
That is excellent news ... may I suggest more coffee! ;-)
  1. Helpful
  1. Brad Mettee
  2. Thursday, 6 June 2024 22:41 PM UTC
Just a heads up

- avoid hard coding paths to objects like images

- make sure you use a pbr to make sure they are included in you release
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 6 June 2024 15:04 PM UTC
  2. PowerBuilder
  3. # 2

Hi Robert;

  What I do for this implementation in my DWO's is ...

  1. Add a regular column to the DWO that will contain the image name at runtime for each associated picture. That means that every row would have a different value (as you stated for example: Row 1 dog.png; Row 2 cat.png; row 3 mouse.png; ...)
  2. Set the DWO's column property "Display as Picture" to ON

HTH

Regards .. Chris

Comment
  1. Robert Sawyer
  2. Thursday, 6 June 2024 15:23 PM UTC
string ls_pic

ls_pic = "C:\home_nohover.png'"

dw_1.insertrow(0)

dw_1.SetItem(1, 'pic_object',ls_pic)

ls_pic = "C:home_hover.png'"

dw_1.insertrow(0)

dw_1.SetItem(2, 'pic_object',ls_pic)

This is my code but what am I doing wrong? Doesn't display an image in pic_object column. I set pic_object to display as picture - pic_object is string 50.







  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 6 June 2024 12:39 PM UTC
  2. PowerBuilder
  3. # 3

I create a compute field on the datawindow and use this expression:

bitmap(gf_bitmap(objtype))

objtype is a column name and gf_bitmap is a function object. It returns a string with the name of the bitmap file.

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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.