Sign in to follow this  
Followers 0
c.haslam

Selecting the first item in a ListView, then unselecting it

4 posts in this topic

I have a dialog with a ListView in it. I have succeeded in getting the first item to show in reverse video, as though the user selected it:

Local $FmInDirNotProj = GUICreate("Preview: jpg's in Directory but not in Project", 560, 305, 222, 279, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
Local $btnClose = GUICtrlCreateButton("Close", 312, 256, 41, 25, 0)
Local $ListView1 = GUICtrlCreateListView("Filename|Date and time", 8, 32, 357, 214)
GUICtrlSendMsg(-1, 0x101E, 0, 190)  ; set column widths
GUICtrlSendMsg(-1, 0x101E, 1, 163)
    $qPics = UBound($nuAr,1) - 1
    Local $cidVec[$qPics+1]
    For $i = 1 To $qPics
        Local $t = $nuAr[$i][$kFnam]&"|"&$nuAr[$i][$kDatTim]
        $cidVec[$i] = GUICtrlCreateListViewItem($t,$ListView1)
    Next
    _GUICtrlListView_SetItemDropHilited ($ListView1, 0)
    While 1
        $nMsg = GUIGetMsg()
        $cidIsLVitem = False
        For $i = 1 To $qPics
            If $nMsg=$cidVec[$i] Then
                $nrow = $i
                _GUICtrlListView_SetItemDropHilited ($ListView1, 0,False)
$cidIsLVitem = True
                ExitLoop
            EndIf
        Next
        If Not $cidIsLVitem Then
            Switch $nMsg
            Case $GUI_EVENT_CLOSE,$btnClose
                ExitLoop
            EndSwitch
        EndIf   
Wend

The second call to _GUICtrlListView_SetItemDropHilited() is intended to deselect the first item when the user selects another item, but it doesn't work.

How do I get this to work?

...chris


...chris

Share this post


Link to post
Share on other sites



I have a dialog with a ListView in it. I have succeeded in getting the first item to show in reverse video, as though the user selected it:

Local $FmInDirNotProj = GUICreate("Preview: jpg's in Directory but not in Project", 560, 305, 222, 279, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS))
Local $btnClose = GUICtrlCreateButton("Close", 312, 256, 41, 25, 0)
Local $ListView1 = GUICtrlCreateListView("Filename|Date and time", 8, 32, 357, 214)
GUICtrlSendMsg(-1, 0x101E, 0, 190)  ; set column widths
GUICtrlSendMsg(-1, 0x101E, 1, 163)
    $qPics = UBound($nuAr,1) - 1
    Local $cidVec[$qPics+1]
    For $i = 1 To $qPics
        Local $t = $nuAr[$i][$kFnam]&"|"&$nuAr[$i][$kDatTim]
        $cidVec[$i] = GUICtrlCreateListViewItem($t,$ListView1)
    Next
    _GUICtrlListView_SetItemDropHilited ($ListView1, 0)
    While 1
        $nMsg = GUIGetMsg()
        $cidIsLVitem = False
        For $i = 1 To $qPics
            If $nMsg=$cidVec[$i] Then
                $nrow = $i
                _GUICtrlListView_SetItemDropHilited ($ListView1, 0,False)
$cidIsLVitem = True
                ExitLoop
            EndIf
        Next
        If Not $cidIsLVitem Then
            Switch $nMsg
            Case $GUI_EVENT_CLOSE,$btnClose
                ExitLoop
            EndSwitch
        EndIf   
Wend

The second call to _GUICtrlListView_SetItemDropHilited() is intended to deselect the first item when the user selects another item, but it doesn't work.

How do I get this to work?

...chris

Can you post something we could run?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

c.haslam

_GUICtrlListView_SetItemSelected()

Share this post


Link to post
Share on other sites

Thanks for the heads-up.

...chris


...chris

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  
Followers 0