1. Mark Jones
  2. PowerBuilder
  3. Wednesday, 4 May 2022 17:08 PM UTC

This is not a question but a technique I want to share so it is searchable for others in the future....

We had the need to add bitmaps to show status to a grid datawindow.   We used a dummy column and then set its visible expression to 0 (this means the grid column displays at run time but the actual column object does not show).   We then added multiple bitmaps that hide and show based on the row status.   We found that resizing the column containing these bitmaps caused the bitmaps to scale up and looked very ugly.    I fooled around for a while with this and have come up with a solution to stop the bitmaps from scaling when you widen the column.

 

1) Force the bitmap width using the width expression.

Width of RMA bitmap is forced to 142

 

2) If you have multiple bitmaps make sure they do not overlap - again you can do this by putting the bitmaps below each other and then forcing their y coordinate using the y expression.    

The envelope y expression is set to 8 so it is in the correct position.   Note that the detail band is expanded to show these additional bitmaps.

 

Initial Grid datawindow:

Grid datwindow first column is resized if my technique is not used:

 

Grid datawindow first column is resized if datawindow is setup using my technique:

If you have any questions about the technique feel free to ask on this thread...

 

Mark Jones

John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 18:03 PM UTC
  2. PowerBuilder
  3. # 1

That's pretty cool, Mark! I'm going to have to look into this. Thank you for sharing this with the Community!

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 18:12 PM UTC
  2. PowerBuilder
  3. # 2

Very cool. What method did you use for the row background color being different?

Comment
There are no comments made yet.
Mark Jones Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 18:23 PM UTC
  2. PowerBuilder
  3. # 3

We use a detail band color expression as follows:

if(getrow()=currentrow(), gf_color('CLINDEX_LIST_SELECTED_ROW'),
if(mod (Getrow(), 2) = 0, gf_color('CLINDEX_LIST_EVEN_ROW'), gf_color('CLINDEX_LIST_ODD_ROW')))

We have a global function called gf_color(<color name>) which has standard colors (e.g. ORANGE) but also has custom color names for our application so that we have standardized colors for old/even rows and selected rows. 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 20:49 PM UTC
  2. PowerBuilder
  3. # 4

I tried it in PB10.5. When I make the bitmap column smaller, the header over the neighboring column on the right gets smaller. After several resizes the column is gone entirely.

Comment
There are no comments made yet.
Mark Jones Accepted Answer Pending Moderation
  1. Wednesday, 4 May 2022 21:02 PM UTC
  2. PowerBuilder
  3. # 5

Roland,  are you talking about development resizing of the grid or runtime resizing of the grid?    At runtime, if you make the column containing the bitmaps narrower they will spill over on to the next column (i.e. they are in a fixed position).  However if you make the column wider again everything ends up in the correct place.  I am not seeing the next door column getting narrower.   We are in the latest build of PB 2021

 

Before Resizing:

After resizing the first column very narrow:

After Resizing back again:

 

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 5 May 2022 12:57 PM UTC
  2. PowerBuilder
  3. # 6

I converted the app to PB 2021 Build 1509 and it is still a problem.

Running the app from the IDE, I widen the image column and then make it smaller. A blank area appears on the right. 

 

I couldn't figure out how to paste in an image so I attached it. I also attached the app. It runs against 'PB Demo DB V2021' database.

 

 

Attachments (2)
Comment
  1. Mark Jones
  2. Thursday, 5 May 2022 13:39 PM UTC
I see what is different about your scenario is that 1) you have the icons set to the full width of the column. Once you set it to this size it this way the only way to resize the width is to edit the source code. 2) If you place a text object in the header PB will always force it to full width. In my examples I do not have a header object above the bitmaps to avoid this situation 3) I have my bitmaps in the first column - this seems to be more reliable...
  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.