Sign in to follow this  
Followers 0

Strange ListView behavior in 3.2.10.0

2 posts in this topic

Posted (edited)

This one is kinda weird. I've noticed that clicking some items in a list view causes other actions to fire (in a while loop GUI). My example includes tabs because I originally thought it might be related but now I don't think so. Double clicking or single clicking items 5 and higher trigger other actions. In another script, single clicking list item 4 switches to another tab... it's different in each case.

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

Global $nMsg, $cnt1, $cnt2, $cnt3
Global $Form = GUICreate("Test", 307, 450, 263, 127, BitOR ($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_SYSMENU))
Global $lbl = GUICtrlCreateLabel("Click or double click list items to see the problem." & @CR & @CR & "In this case, list items 5 and higher trigger other controls.", 10, 1, 275, 52)
Global $btn_Add = GUICtrlCreateButton("Add", 144, 50, 57, 33)
Global $btn_DeleteAll = GUICtrlCreateButton("Delete All", 244, 50, 57, 33)
Global $TabCtrl = GUICtrlCreateTab(0, 90, 305, 333)
Global $TabSheet1 = GUICtrlCreateTabItem("Tab 1")
Global $lst1 = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 6, 120, 292, 284)
Global $TabSheet2 = GUICtrlCreateTabItem("Tab 2")
Global $lst2 = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 6, 120, 292, 284)
Global $TabSheet3 = GUICtrlCreateTabItem("Tab 3")
Global $lst3 = GUICtrlCreateListView("Col1|Col2|Col3|Col4", 6, 120, 292, 284)
GUICtrlCreateTabItem("")
Global $lblx = GUICtrlCreateLabel("Hi", 10, 430, 275, 52)

For $j = 1 To 10
    Add($lst1, $cnt1)
    Add($lst2, $cnt2)
    Add($lst3, $cnt3)
Next

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case 0
            ContinueLoop
        Case -3 ;$GUI_EVENT_CLOSE
            Exit(0)
        Case $btn_Add
            Switch GUICtrlRead($TabCtrl)
                Case 0
                    Add($lst1, $cnt1)
                Case 1
                    Add($lst2, $cnt2)
                Case 2
                    Add($lst3, $cnt3)
            EndSwitch
        Case $btn_DeleteAll
            $cnt1 = 0
            $cnt2 = 0
            $cnt3 = 0
            _GUICtrlListView_DeleteAllItems(ControlGetHandle("", "", $lst1))
            _GUICtrlListView_DeleteAllItems(ControlGetHandle("", "", $lst2))
            _GUICtrlListView_DeleteAllItems(ControlGetHandle("", "", $lst3))
    EndSwitch
    GUICtrlSetData($lblx, $nMsg)
WEnd

Exit(0)

Func Add ( $obj, ByRef $k)
    Local $idx
    $k += 1
    $idx = _GUICtrlListView_InsertItem($obj, "+", -1)
    _GUICtrlListView_SetItemText($obj, $idx, $k, 0)
    _GUICtrlListView_SetItemText($obj, $idx, $obj & " Item " & $k, 1)
    _GUICtrlListView_SetItemText($obj, $idx, "Path", 2)
    _GUICtrlListView_SetItemText($obj, $idx, "Parms", 3)
EndFunc

-Rick

Edited by Koder

Share this post


Link to post
Share on other sites



Posted

Fixed in next UDF delivery

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.