Discussions related to Visual Prolog
Harrison Pratt
VIP Member
Posts: 439
Joined: 5 Nov 2000 0:01

Listview automatic column width

Unread post by Harrison Pratt »

How does automatic column width setting work in VIP 7.5 listview class?

What I see in various sources leads me to believe that I can set the column width(s) to -1 or -2 to size the column width(s) to fit the data or the header, respectively. However, when I use those numbers for ColumnWidth the listView control's display is blank.

Of course, it is trivial to write code to do this manually -- I've already done that for column headers -- but it appears that this functionality is built-in and I don't know how to access it.

Code: Select all

    ss_columnList( SS ) = ColumnList :-         %  To adjust the width of the longest item in the column, set the Width property to -1.         %  To autosize to the width of the column heading, set the Width property to -2.         %  NOTE:  these parameters don't seem to work in VIP 2017-08-13         % https://msdn.microsoft.com/en-us/library/system.windows.forms.columnheader.width.aspx         % https://stackoverflow.com/questions/1257500/c-sharp-listview-column-width-auto         ColumnList = [ C || S in SS,             ColumnWidth = calcColumnWidth(S), % calculates column width to use and adds 2 spaces for padding %            ColumnWidth = lvscw_autoSize,  % NOTE: setting width to -1 (lvscw_autoSize) or -2 (lvscw_autoSize_useHeader) to autosize does not work with VIP             C = listViewControl::column( S, ColumnWidth, alignLeft )             ].
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

The documentation you look at is about .net controls.

Visual Prolog deals with a win32 List View control.

I do not believe that the win32 control has such automatic column width handling.

It may seem that Microsoft now uses the name Desktop App UI for the win32 kind of UI.
Regards Thomas Linder Puls
PDC
Harrison Pratt
VIP Member
Posts: 439
Joined: 5 Nov 2000 0:01

Unread post by Harrison Pratt »

Ahhh ... that tip will save me a lot of headaches in the future, too!

Thanks!
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

I hope so.

But a large problem is that it is not always easy to see whether a piece of documentation is about one thing or the other. Moreover it can be difficult to find the right kind of documentation. It sometimes helps to include "win32" in as a search word.
Regards Thomas Linder Puls
PDC
Harrison Pratt
VIP Member
Posts: 439
Joined: 5 Nov 2000 0:01

Re:

Unread post by Harrison Pratt »

Thomas Linder Puls wrote: It sometimes helps to include "win32" in as a search word.
That is my plan!
Post Reply