Jump to content

ListViews with many columns


LarsJ
 Share

Recommended Posts

This is awesome! The dream of fast scrolling (and even larger) ListViews could come true…

IMHO – The only drawback this isn’t a set of UDFs. Any chance to build an UDF set based on your code? As a *complete* replacement to GUICtrl* and _GUICtrlListView_*?

Link to comment
Share on other sites

supersonic, I don't think there is such a need for listviews with a large number of columns that it can justify to spend a lot of time making a complete UDF.

In your own post here it should be possible to implement such a listview based on the medium examples.

There is one important thing to consider when using an owner drawn listview: While the code in the WM_DRAWITEM message handler is running, it must not be interrupted by other Windows messages. If listview data (label texts) is stored directly in the listview (which is the case for normal listviews) and data is extracted from the listview in the WM_DRAWITEM code with _GUICtrlListView_GetItemText, it will generate WM_NOTIFY messages. These messages can cause a lot of problems as discussed in this thread. Therefore, it's convenient to combine an owner drawn listview with a virtual listview where data isn't stored directly in the listview but in an external data source eg. an array. Note that the problems in the thread are not an expression of an actual error in the AutoIt code. The problems are an indication that AutoIt as an interpreted language isn't fast enough to handle a large number of WM_DRAWITEM messages while at the same time handling an even larger number of WM_NOTIFY messages. In the code in first post in the thread there is both a WM_DRAWITEM and a WM_NOTIFY message handler. Exactly as in my examples here.

 

I have added two new examples and updated most other examples to make the code more uniform and correct some errors. New zip-file at bottom of first post.

Link to comment
Share on other sites

The size of the cell rectangle given by column index $i and row index $itemID can be determined with this code:

DllStructSetData( $tRect, 2, $i ) ; Top
DllStructSetData( $tRect, 1, $LVIR_BOUNDS ) ; Left
GUICtrlSendMsg( $idListView, $LVM_GETSUBITEMRECT, $itemID, $pRect )

The first column when $i = 0 is the column representing the entire listview item. When $i = 0, the code above will result in a column width corresponding to the width of the entire listview item. If there are 100 columns each 90 pixels wide, it will result in a column width for column 0 of 9,000 pixels.

To calculate the real width of the cell rectangle for column 0, an extra line must be added:

DllStructSetData( $tRect, 2, $i ) ; Top
DllStructSetData( $tRect, 1, $LVIR_BOUNDS ) ; Left
GUICtrlSendMsg( $idListView, $LVM_GETSUBITEMRECT, $itemID, $pRect )
If Not $i Then DllStructSetData( $tRect, 3, DllStructGetData( $tRect, 1 ) + GUICtrlSendMsg( $idListView, $LVM_GETCOLUMNWIDTH, 0, 0 ) )

The cell rectangle calculation is used in WM_DRAWITEM code. This means that all examples are updated to add this line.

The code box at top of first post is corrected accordingly.

 

A number of new examples marked with red have been added in first post.

 

So far, these are all examples I've planned for the topic of many-column listviews.

New zip file at bottom of first post.

Link to comment
Share on other sites

  • 2 months later...

Hello LarsJ,

Your ListView controls Functions/Files/Codes are just great.

Thank you for sharing these files/codes.

If you've ListView groups functions, Can you Please also share those functions ?

ListView Group Functions:-

Set/GetLVGroupFont (Size,Color,Style,....) of any ListView
Set/GetLVGroupHandle
Set/GetLVGroupPosition
Set/GetLVGroupEnable/Disable
Set/GetLVGroupAdd/RemoveFromArray
Set/GetLVGroupAdd/Remove
Set/GetLVGroupNameHyperlink
Set/GetLVGroupCollapse/ExpandState

Set/GetLVGroupItemCount

Set/GetLVGroupSort
.....

 

Edited by BJR
Have missing

BJR

Link to comment
Share on other sites

If you search carefully, then it is possible to find a few code examples that are about listview groups.

I don't use listview groups quite often, so I don't know the code completely. I'm not quite sure if all the functions can be implemented. But an example regarding listview groups is certainly not unattractive. I've made a note on the subject. But don't expect any code already this coming weekend.

Link to comment
Share on other sites

15 hours ago, LarsJ said:

If you search carefully, then it is possible to find a few code examples that are about listview groups.

I don't use listview groups quite often, so I don't know the code completely. I'm not quite sure if all the functions can be implemented. But an example regarding listview groups is certainly not unattractive. I've made a note on the subject. But don't expect any code already this coming weekend.

 

Thank You.

BJR

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...