1. Kari Paukku
  2. PowerBuilder
  3. Thursday, 13 April 2023 05:21 AM UTC


I have a drop-down-down-data-window (d_dddw_status) which has in addition of the code also R,G,B values for column background color.

What I would like to do is to have the  the color of the d_dddw_status to flow to the actual data window column that uses the dddw.

An example is in the attached pictures - in the dddw the code 10 has a red backgroud - how can I get that to flow to dw and column that has the code/dddw? (pic2) .

An ideal solution would be if I could refer to the dddw from the actual dw and extract the color values (r,g,b) from the dddw and set the background of the column in question.






Attachments (2)
Kari Paukku Accepted Answer Pending Moderation
  1. Thursday, 13 April 2023 10:01 AM UTC
  2. PowerBuilder
  3. # 1

Thansk for your comments. The issue is that I have a lot of these kind of "status" columns. I also would like the implementation be such that it can be incorporated to the DW, s a function to decide the background color.

The current implementation is based on that - the columns vackgroud color call function f_getbackgroundcolour(status code) and the function then has hardcode values for diffenet codes . the function return RGB(r,g,b).

What i'm looking for is more dynamic solution where the r,g and b do come from the drop-down-list.
I could retrieve the values from the database but that adds quite a lot of overhead and as the drop-down-list already has the values I was hoping to use those.

  1. Markus Eckert
  2. Thursday, 13 April 2023 11:25 AM UTC
Unfortunately I'm not aware of any way to achieve this purely within the datawindow designer without external code. The main DW only gets access to the data and the display value of the DDDW.

In theory you could set the status code to be the rgb value of the desired color. That way the main datawindow has access to the desired color. But that would only really make sense if you never displayed the numerical status value. And that doesn't seem to be the case in your example. (And even then it would be the "mad scientist" approach ;-) )
  1. Helpful 1
  1. Kari Paukku
  2. Thursday, 13 April 2023 11:44 AM UTC
Thanks, I think you are right. If I only could write something similar to the "LookupDisplayValue" that I could use with Evaluate. But it would need to be able to access the RGB value assigned to the code. A function "LookupUpAnyValueFromDDDW" list would be great to have.
  1. Helpful 1
There are no comments made yet.
Markus Eckert Accepted Answer Pending Moderation
  1. Thursday, 13 April 2023 09:13 AM UTC
  2. PowerBuilder
  3. # 2

Hi Kari

 Does the main datawindow only ever have one row?

If yes, you could use the itemchanged and the retrieveend events to look up the rgb values in the dddw for the currently selected value. Then you can modify the main datawindow to change the background color of the affected control.

// Sample code for the itemchanged event

datawindowchild ldw_child
long ll_row_child, ll_rgb

IF <Status Column was changed> THEN
    main_dw.GetChild('<DDDW column in main DW>', ldw_child)

    ll_row_child = ldw_child.find( '<status column in DDDW> = ' + data , 1, ldw_child.rowcount( ) )

    ll_rgb = ldw_child.getitemnumber( ll_row_child, '<rgb column in DDDW>' )

    // Now modify the main DW to display the color

If the main datawindow has more than one row, you'd have to add another column "backgroundcolor" to the main datawindow and set the backgroundcolor of the control to that value. In that case you'd write the rgb value from the dddw to that column in the itemchanged event instead of modifying the main dw.

Hope that helps you get started.


  1. Andreas Mykonios
  2. Thursday, 13 April 2023 09:45 AM UTC
In case he adds a backgroundcolor column, an expression can be used.

  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.