PxPlus User Forum

Main Board => Discussions => Language => Topic started by: Ken Sproul on February 11, 2024, 07:38:07 AM

Title: Maximum Number of Columns in a Report View List Box
Post by: Ken Sproul on February 11, 2024, 07:38:07 AM
There seems to be a limit to the number of columns a report view list box can have but I couldn't find any documentation for the limit.


I defined a list box with 267 columns. The first column is defined as S0 (not visible).
While scrolling to the right, the headings stopped scrolling at the 180th visible column.
However, the data for the remaining columns continued to scroll and display.


Is this a limit or a bug?
Is it pxplus or Windows?


Attached is a txt file containing the string used in the fmt= option.
Title: Re: Maximum Number of Columns in a Report View List Box
Post by: Mike King on February 12, 2024, 11:08:54 AM
There is a limit imposed by Windows itself.

Check out the note at the bottom of: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.listview.columnheadercollection

Unexpected behavior can result when the combined width of all columns exceeds 32,768 pixels.

So depending on the column widths and the current user font you may be hitting this limit.
Title: Re: Maximum Number of Columns in a Report View List Box
Post by: Ken Sproul on February 14, 2024, 02:00:05 AM
Thanks Mike! That was the issue.
I added logic to calculate the total standard column widths in pixels and scale them down by percentage when the total exceeded 32767.

Title: Re: Maximum Number of Columns in a Report View List Box
Post by: Mike King on February 14, 2024, 10:10:12 AM
Glad to have helped.