1. Mark Jones
  2. PowerBuilder
  3. Wednesday, 23 February 2022 19:51 PM UTC

We have a script that dynamically generates a datawindow that has an array of icons showing the state of various data (see image below).  There are up to about 20 different images that could be displayed per icon depending on the data. We are constantly trying to optimize this datawindow since we could potentially have as many as 400 different icons in a given row and we might display 20 rows at a time.   

We have tried 2 different routes in terms of performance:

1) Using a computed field object with a bitmap() function to render the correct bitmap.  In this case our script creates one computed field per bitmap.

2) Create 20 bitmap objects per icon and then set the visibility expressions of each one to show the correct bitmap.  This means that if we build a datawindow with 400 icons we end up with 8000 bitmap objects per row.

With 1) the datawindow is created much more quickly however its performance scrolling is very slow as it appears all the computed fields end up being re-evaluated.    Does anyone know a trick to suppress computed fields from recalculating in this instance?

With 2) the performance initially building the datawindow in script is slower however the performance is very good.

This is just background to the actual issue since right now we are using option 2).    The real question is in terms of the look of the datawindow, we use different color detail background colors for odd/even rows,  white and slighly grey.    If we use .BMP files we end up with a white edge on the bmp file that looks pretty rough.   If we use .PNG files with transparent edges then the datawindow looks great but again the performance degrades significantly. Note that if we use the trick where we set the transparency of the bitmaps to 1% then the edge goes away but performance degrades to about the same level as the PNG.  Basically it seems that once we have any transparency going on the performance is hurt.

Please be aware that we have tried different bitmaps for odd and even rows where the even row bitmap has a white edge and the odd row has a grey edge however this then doubles the number of bitmaps being created we slows performance.

Does anyone know any tricks for dealing with this?

Brad Mettee Accepted Answer Pending Moderation
  1. Thursday, 24 February 2022 17:21 PM UTC
  2. PowerBuilder
  3. # 1

If you're already computing white vs. gray backgrounds, can you use PNG on the gray rows and BMP on the white rows? You'll split the difference in performance to be somewhere in the middle of the two, but still be visually appealing.

Comment
  1. Mark Jones
  2. Thursday, 24 February 2022 17:28 PM UTC
That is a good idea however that ends up doubling the number of bitmap that I create which in turns slows down the creation of the datawindow significantly.

I think my approach is going to be see how many icons I need to create, if it is over 100 then I will use a bitmaps and if under 100 then pngs. Most of our customers are less than 100 so only the customers with longer lists of forms will see the rougher graphics.



THanks Mark
  1. Helpful
  1. Brad Mettee
  2. Thursday, 24 February 2022 17:55 PM UTC
Re: computes taking a long time to recalc when scrolling

Have you considered using dummy columns to hold the filename and using a control with "display as picture" checked? This would offload most of the work when scrolling back to PB itself (instead of having to recalc all the computed objects). You would need to map the created controls to the proper column ID, but that shouldn't be a problem if you're already dynamically creating computes.

  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 24 February 2022 07:06 AM UTC
  2. PowerBuilder
  3. # 2

Hi Mark,

If BMP would have a better performance: How about using picture objects with BMPs? You can make a color of the picture displayed transparent by setting the "Transparent Color" property. The easiest way to do it is to use the right mouse button menu "Make Color Transparent" - click on the color of the picture you want to make transparent.

Yes: Scrolling the datawindow recalculates computed fields. I don't know a way to suppress it.

BTW: If you have performance issues with your datawindow it is good to know about the datawindow property "timer interval". It's value is the number of milliseconds for the datawindow timer. After timer finished the datawindow refreshes the computed fields. The default value is 0 - this means the timer interval is 60 seconds.

I also use symbols of fonts like Wingdings instead of picture if possible.

HTH,

René

 

 

 

Comment
  1. Mark Jones
  2. Thursday, 24 February 2022 14:19 PM UTC
Thanks for your answer Rene and the suggestions, however as soon as I fool around with transparency whether by defining a transparent color on a BMP file or using a PNG file then Powerbuilder is slower rendering the screen. Clearly more work has to be done to handle the transparent layers. I am going to try going down the font route and see if I can make that work. Thanks again
  1. Helpful
  1. John Fauss
  2. Thursday, 24 February 2022 14:42 PM UTC
Mark, what dimensions are the BMP and PNG images? The reason I ask is if you are displaying them in the DW as say, 12x12 pixels and the image are actually 512.512, then the process of "shrinking" them dynamically to fit the display dimensions may incur significant overhead. Better to use images that have the same dimensions as what is going to be displayed. Just a thought.
  1. Helpful
  1. Roland Smith
  2. Thursday, 24 February 2022 16:35 PM UTC
You can compress the files here: https://compresspng.com/
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 24 February 2022 03:40 AM UTC
  2. PowerBuilder
  3. # 3

Can you redo it in HTML displayed in a webbrowser control?

Comment
  1. Mark Jones
  2. Thursday, 24 February 2022 14:22 PM UTC
Roland that is a great suggestion and if I had a lot of time to make these changes I would definitely try that path however this is a complex datawindow and recreating in HTML might be challenging! We can have as many as 10000 rows and as many as 400 icons across. Powerbuilder does a great job rendering and I am not unhappy with the performance but I am just trying to squeeze the best performance I can. I am actually thinking about a hybrid model where if I when I create the datawindow I see that there will be fewer icons across I use PNGs otherwise BMPs
  1. Helpful
There are no comments made yet.
Mark Jones Accepted Answer Pending Moderation
  1. Wednesday, 23 February 2022 22:40 PM UTC
  2. PowerBuilder
  3. # 4

Some of our icons needs to be multi-color - I just tried using a multi-color font "Gilbert Color Bold Preview 5" in a datawindow and unfortunately the colors are ignored by PB and it just uses its own colors.   One thought might be to use multiple text objects that overlay each other (each set to a different color) to simulate a multicolor font.   I will have a crack at that...

 

 

Comment
  1. Ronnie Po
  2. Thursday, 24 February 2022 06:17 AM UTC
Cool. I'm curious to see how that works out.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 23 February 2022 22:21 PM UTC
  2. PowerBuilder
  3. # 5

Although Windows supports color fonts, I'd be extremely surprised to learn that PowerBuilder does, as the API drawing methods and calls are somewhat different.

https://docs.microsoft.com/en-us/windows/win32/directwrite/color-fonts

Perhaps Chris Pollach could ask Engineering if any form of color fonts supported by Windows is also supported by PowerBuilder, in particular, by the DW rendering engine since DW content does not get rendered by Windows. If not, it would be a nice enhancement request.

Comment
  1. Chris Pollach @Appeon
  2. Thursday, 24 February 2022 15:00 PM UTC
Hi John;

Yes, what the DW Control does is display the DWO as an internally rendered "image". However, I do not think that this is Mark's performance problem. The performance degradation is (my guess) probably elated to using "computed columns" and then compounded by also using the BitMap() command - VS - using the "Display as Picture" + "Map 3D colors" property approach with expressions to control their visibility.

I would also try creating a "custom" PB.ini using the following ...

[Data Window]

Accessibility=0

Regards ... Chris

  1. Helpful
There are no comments made yet.
Mark Jones Accepted Answer Pending Moderation
  1. Wednesday, 23 February 2022 21:55 PM UTC
  2. PowerBuilder
  3. # 6

Thanks for your response.  That is a very interesting idea.  Is it possible to have multi color fonts so I can basically create something that is the same as a bitmap?

Mark

Comment
There are no comments made yet.
Ronnie Po Accepted Answer Pending Moderation
  1. Wednesday, 23 February 2022 21:46 PM UTC
  2. PowerBuilder
  3. # 7

You might consider creating a custom font. To test whether it would speed things up, you can run an experiment with a glyph font like Zapf Dingbats. You'll need to use expressions to set the color based on the state of your data. If your icons are always going to be a fixed size, then a bitmap font should render even faster than a scalable font.

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.