1. Kari Paukku
  2. PowerBuilder
  3. Friday, 12 March 2021 16:40 PM UTC

Hi,

as an example (screenshots in the attachment) I have in a code table company-status. There are three status codes and these are retrieved from the database. The database table contains also a column RGB, to hold the RGB value for the code. This then makes up the dddw-list

In the main data window (dw) the dddw is attached to the actual company-status column.

When I retrieve the dddw in PB, it works fine and as expected, each code has the correct background

However, when I attach the dddw to the column in the dw, I had hoped that the color of the DDDW would flow to the actual dw, but no.

In the attached PDF is an example of the above.

Can someone help me to find how to get the background of the DDDW to flow to the actual DW ?

Thanks,
Kari

 

Attachments (1)
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 12 March 2021 19:14 PM UTC
  2. PowerBuilder
  3. # 1

Hi Kari;

  Yes, you can use the same trick as what I use for DWO's that are displayed as HTML Web Pages and you need alternating colours in each row, as follows:

  1. Create your DW
  2. Add a TEXT object (no text) & size it to the Detail band.
  3. Place the Text object in the background.
  4. Make sure that all your columns in the foreground.
  5. Set all your columns to "Transparent" background colour
  6. Use an Expression on the Text Object to set the colours as appropriate.

That should work.  ;-)

Regards ... Chris

Comment
There are no comments made yet.
Kari Paukku Accepted Answer Pending Moderation
  1. Saturday, 13 March 2021 04:06 AM UTC
  2. PowerBuilder
  3. # 2

Chris,

thanks, I understand the idea and reading your reply I thought that it would work., but no.

I did several tests but nothing worked. After trying all kind ways how to do this I made a simple test:

1) did place the text box, as you said, to the dddw and assigned the text box a fixed background color (pink)

2) My thinking was that now whatever the code is it will have a background color from the dddw, but no. 

The dropdown shows the colors (dddw.png) but when the cursor leaves the field (dw.png), the code doesn't have a background.

I guess I can do this using PowerScript, but that means having to program this feature to all the places where the dddw is used. It would be so must neater to have the implementation in only one place, the dddw.

Thanks,

Kari

 

 

 

 

 

Attachments (2)
Comment
  1. John Fauss
  2. Saturday, 13 March 2021 04:50 AM UTC
It looks and sounds like you did not implement step 6 that Chris outlined. The DDDW is self-contained and it is not going to produce a change in the data object in which it resides... unless you make it happen. Chris suggested that you create an expression for the background color in the newly-added Static Text DWObject that occupies the detail band to determine the color. One way would be to use a "Case( columnname When y1 Then RGB(r1,g1,b1) When y2 Then RGB(r2,g2,b2) ... Else RGB(rn,gn,bn) )" DW expression function (substitute the name of the column, the data values and R,G,B values as appropriate) to translate the data value of the column having the DDDW edit style to the same colors which are used in the DDDW.
  1. Helpful
There are no comments made yet.
Kari Paukku Accepted Answer Pending Moderation
  1. Sunday, 14 March 2021 17:44 PM UTC
  2. PowerBuilder
  3. # 3

John,

I think I did do also step 6 - the picture dddw.png has a default color (pink) for the text-box if no RGB value is defined for the status.

In the end, I went for a function-based solution. The idea is that I retrieve all RGB's for the status codes into a global variable when the application starts.  

In the DW's I then have the background to come from that function.

Perhaps not the most elegant solution, but works.

Thanks,
Kari

Comment
  1. John Fauss
  2. Sunday, 14 March 2021 17:59 PM UTC
I'm glad you found a solution that works for you - Congratulations!
  1. Helpful
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.