1. Lukas Kluge
  2. PowerBuilder
  3. Tuesday, 08 October 2019

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
1
Votes
Undo

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

Cheers

David

Comment
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.
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. Lukas Kluge
  2. Tuesday, 8 October 2019
You are welcome.
There are no comments made yet.
  1. Tuesday, 8 October 2019
  2. PowerBuilder
  3. # Permalink
Olan Knight Accepted Answer Pending Moderation
0
Votes
Undo

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.
  1. Tuesday, 8 October 2019
  2. PowerBuilder
  3. # 1
Michael Kramer Accepted Answer Pending Moderation
1
Votes
Undo

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.
  1. Tuesday, 8 October 2019
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.