Jump to content
Sign in to follow this  
ChrisL

Can Listviews highlight multiple rows?

Recommended Posts

ChrisL

Is it possible to highlight multiple rows in a listview?

I would have thought given that there is a listview style called $LVS_SINGLESEL that multiple selections would be the default but apparently not?

#include <GUIConstants.au3>
#Include <GuiListView.au3>

$Form1 = GUICreate("", 824, 663, 200, 24)

$h_listview = GUICtrlCreateListView("OrderID|Name|DueBy|ReleaseTime|Job Status|", 4, 44, 816, 561)
GuiCtrlSetFont(-1,14,400,2)
_GUICtrlListViewSetColumnWidth ( $h_listview, 0, 150 )
_GUICtrlListViewSetColumnWidth ( $h_listview, 1, 150 )
_GUICtrlListViewSetColumnWidth ( $h_listview, 2, 200 )
_GUICtrlListViewSetColumnWidth ( $h_listview, 3, 200 )
_GUICtrlListViewSetColumnWidth ( $h_listview, 4, 100 )

GUICtrlCreateListViewItem("0|0|0|0|0",$h_listview)
GUICtrlCreateListViewItem("1|1|1|1|1",$h_listview)
GUICtrlCreateListViewItem("2|2|2|2|2",$h_listview)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        
        Case Else
        ;;
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
evilertoaster

The defualts for the GUICtrlCreateListView() function make it only single select. To override this try-

$h_listview = GUICtrlCreateListView("OrderID|Name|DueBy|ReleaseTime|Job Status|", 4, 44, 816, 561,$LVS_SHOWSELALWAYS)

Which manually tells it parameters for the style (not letting it assign the defaults)

Share this post


Link to post
Share on other sites
ChrisL

The defualts for the GUICtrlCreateListView() function make it only single select. To override this try-

$h_listview = GUICtrlCreateListView("OrderID|Name|DueBy|ReleaseTime|Job Status|", 4, 44, 816, 561,$LVS_SHOWSELALWAYS)

Which manually tells it parameters for the style (not letting it assign the defaults)

Cool Thanks

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.