FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log inLog in 


Listview automatic column width

Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog
View previous topic :: View next topic  
Author Message
Harrison Pratt



Des Moines, Iowa USA
Joined: 05 Nov 2000
Posts: 312

PostPosted: 16 Aug 2017 16:42    Post subject: Listview automatic column width Reply with quote

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.

    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 )
            ].

Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3124

PostPosted: 16 Aug 2017 18:27    Post subject: Reply with quote

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
Prolog Development Center
Back to top
View user's profile Send private message
Harrison Pratt



Des Moines, Iowa USA
Joined: 05 Nov 2000
Posts: 312

PostPosted: 17 Aug 2017 12:31    Post subject: Reply with quote

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

Thanks!
Back to top
View user's profile Send private message
Thomas Linder Puls



Copenhagen, Denmark
Joined: 28 Feb 2000
Posts: 3124

PostPosted: 17 Aug 2017 20:17    Post subject: Reply with quote

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
Prolog Development Center
Back to top
View user's profile Send private message
Harrison Pratt



Des Moines, Iowa USA
Joined: 05 Nov 2000
Posts: 312

PostPosted: 17 Aug 2017 21:52    Post subject: Re: Reply with quote

Thomas Linder Puls wrote:

It sometimes helps to include "win32" in as a search word.

That is my plan!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    discuss.visual-prolog.com Forum Index -> Visual Prolog All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum