1. Lukas Kluge
  2. PowerBuilder
  3. Tuesday, 8 October 2019 09:03 AM UTC

Hello,

I have a group datawindow and I want to change the background color of the header of a group if any row inside that group is selected. I only want to change the header for that specific group, not all headers.

In the detail band are multiple rows with information, these rows background colors alternate between white and gray. When a row is selected the background color is changed to a light blue. This is done via expression and works. But I also want that the header of the group the selected row is in turns blue too.

Is there any way to achieve this?

Thank you very much.

Accepted Answer
David Peace (Powersoft) Accepted Answer Pending Moderation
  1. Tuesday, 8 October 2019 09:11 AM UTC
  2. PowerBuilder
  3. # Permalink

You could have 2 rectangles with the different colour and make these visible/invisible based on the data.

Cheers

David

Comment
  1. David Peace (Powersoft)
  2. Tuesday, 8 October 2019 09:30 AM UTC
When the row is selected, get the group values form the row. then loop through all the rows in the DW and set the dummy column to1 if they match the group values or 0 if not.
  1. Helpful
  1. Lukas Kluge
  2. Tuesday, 8 October 2019 11:18 AM UTC
it worked, I put it in the expression though and didn't use rectangles. I should have gotten this idea myself haha. Thank you!
  1. Helpful
  1. David Peace (Powersoft)
  2. Tuesday, 8 October 2019 11:33 AM UTC
You are welcome.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Tuesday, 8 October 2019 12:25 PM UTC
  2. PowerBuilder
  3. # 1

I would add a rectangle having desired blue color, filling complete group header, sent to back to display below all other items.

THEN, add below expression for rectangle's VISIBLE property.

IF( First( GetRow( ) FOR GROUP 1) <= CurrentRow( ) 
AND CurrentRow( ) <= Last( GetRow( ) FOR GROUP 1)
, 1, 0)

Formatting (line break, indent) I leave to you.

Enjoy, /Michael

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 8 October 2019 22:38 PM UTC
  2. PowerBuilder
  3. # 2

Create a computed FIELD called "data_selected", not a computed column.

In the ItemChanged event, when an appropriate columns is selected, set the DATA_SELECTED column to 1, else set it to zero.

For every column, detail, header, whatever, set an expression in the COLOR field on the BACKGROUND tabpage of the DW Painter.

If (data_selected = 1, , )


Olan

 

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.