Sign in to follow this  
Followers 0

listview items randomly disappear

9 posts in this topic

I'm not sure if this is a Win7 thing or a graphics driver thing or an Autoit thing, but...

Got a listview. Two columns, nothing unusual:

<lots of stuff removed so this standalone snippet won't run>

$gui2 = GUICreate("Files to be deleted", 780, 600, -1, -1, $WS_OVERLAPPEDWINDOW)

_GUICtrlListView_SetColumnWidth($listid, 0, 100)
_GUICtrlListView_SetColumnWidth($listid, 1, 2000)

For $l = 1 To $matches
    GUICtrlCreateListViewItem(FileGetSize($dellist[$l]) & "|" & $dellist[$l], $listid)
$okbutton = GUICtrlCreateButton("OK", 30, 550, 60)
$cancelbutton = GUICtrlCreateButton("Cancel", 690, 550, 60)
$helpbutton = GUICtrlCreateButton("Help", 470, 550, 60)
$rembutton = GUICtrlCreateButton("Remove", 250, 550, 60)
$removed = 0

While 1
    $guimsg = GUIGetMsg()
    Switch $guimsg

        Case 0 ; handled by WM_NOTIFY, GUIGetMsg() = 0
            If $doubleclick = 1 Then
                $doubleclick = 0
        Case $rembutton
            $editline = _GUICtrlListView_GetSelectionMark($listid) ; zero based so one less than the data line number
            If $editline = -1 Then
                MsgBox(4096, "Error", "No item selected")
            _GUICtrlListView_SetItemText($listid, $editline, "|<removed from list>", -1)
            $dellist[$editline + 1] = ""
            $removed = $removed + 1

        Case $okbutton
            $delyn = MsgBox(1 + 48 + 256 + 0 + 262144, "Delete Files", $matches - $removed & " files will be deleted!" & @CRLF & @CRLF & "Are you sure?")
            If $delyn = 1 Then
                ; delete files here
                _ArrayDisplay($dellist) ; for debug

        Case $cancelbutton
        Case $GUI_EVENT_CLOSE
        Case $helpbutton
            MsgBox(0, "Help", "no help yet")
        Case Else


Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ; subroutine to detect doubleclicks
    Local $hWndListView = GUICtrlGetHandle($listid)
    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    Local $iCode = DllStructGetData($tNMHDR, "Code")
    If (($hWndFrom == $hWndListView) And ($iCode == $NM_DBLCLK)) Then
        $doubleclick = 1
EndFunc   ;==>WM_NOTIFY

The problem is that at times, the entire listview control simply disappears. I think it only happens when I first select a listview item and then move the mouse out of the gui, but it's very random. Once the listview disappears, if I click on it, the line I click on reappears... or I can move the scroll bar to scroll it out of view and back, and everything reappears. Regardless, the program itself works.

This is a new computer. I haven't seen this issue on my other (also Win7) computer. It's a new autoit script, largely copied (this morning) from another old program. I never saw the problem with the old program, but I tried the old program today on the new computer and it does it, too.

This happens if I run the script from SciTE or if it's compiled.

Share this post

Link to post
Share on other sites

I can sorta bandaid it by putting GUICtrlSetState($listid, $GUI_SHOW) in the Case Else section, but then it flickers constantly... sometimes disappears, then is readrawn.

Share this post

Link to post
Share on other sites

The _ArrayDisplay UDF included with AutoIt does the same thing.

Share this post

Link to post
Share on other sites

No, it doesn't. There is something buggy about your environment, and I doubt it has anything to do with AutoIt.

Try this, since you couldn't come up with a running demo to talk about:

#include <Array.au3>

Global $aTest[16][8]
For $r = 0 To UBound($aTest) - 1
    For $c = 0 To UBound($aTest, 2) - 1
        $aTest[$r][$c] = $r & "-" & $c
_ArrayDisplay($aTest, "$aTest")


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

Psalty, sorry, that's what I meant. Because _ArrayDisplay (including your example using it) does it too, on my machine, it's not something in my code. I've also confirmed now that it doesn't do it on my laptop, so it's definitely something peculiar to this specific computer or graphics driver (Win7 64 bit, NVIDIA Quadro 200 graphics).

But I haven't seen it in any other (non AutoIT) programs.

Share this post

Link to post
Share on other sites

Nor is it just the listview; I'm seeing the same behavior with input boxes as well... not surprising as it's the same graphics style.

Share this post

Link to post
Share on other sites

@Dana, did you ever figure out the reason behind this problem?

I am having the same annoyance with my system.

At last, after two thousand years of research, the illudium Q-36 explosive space modulator.Well, back to the old drawing board.

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