Jump to content

This has to be a bug in the new listview stuff


ChrisL
 Share

Recommended Posts

Windows XP Autoit Ver 3.2.10.0

Run this script then click on the item in row6 and it activates the function for the $fileMenu, how does this happen?

(I've just spent hours trying to figure out why upgrading a script went mad with a listview and clicking on an item)

Can anyone else confirm this behaviour?

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


Opt("GuiOnEventMode",1)

$main = GuiCreate("MyGUI", 1025, 459,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
    
$h_listview = GUICtrlCreateListView(" ", 8, 10, 849, 337)

$FileMenu = GUICtrlCreateMenu("File")
$ExitItem = GUICtrlCreateMenuItem("Exit",$FileMenu)
GUICtrlSetOnEvent(-1,"_Exit")

GUIStartGroup()
For $i = 0 to 10
    _GUICtrlListView_InsertColumn ( $h_listview, $i, "Col " & $i , 75  )
Next

GuiSetState()

 $hwnd = GUICtrlGetHandle($h_listview)
    For $x = 1 to 10
            For $y = 1 to 11
                
                If $y = 1 then 
                    $ret = _GUICtrlListView_AddItem($hWnd, "Row " & $x & " Col 0")
                Else
                    $ret = _GUICtrlListView_SetItemText($hWnd, $x-1,"Row " & $x & " Col " & $y -1, $y-1)
                EndIf

            Next
        Next
        
While 1
    Sleep (100)
WEnd



Func _Exit()
    Msgbox(0,"","How the F**K did clicking row 6 activate this?")
EndFunc


Func SpecialEvents()
  ConsoleWrite("Special Events WinHandle = " & @GUI_WINHANDLE & " ControlID = " & @GUI_CtrlId & @crlf)
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE

            $ans = Msgbox(4 + 262144,"Exit","Do you really want to exit?")
            If $ans = 6 then Exit
                    
        Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
            WinSetState(@GUI_WINHANDLE,"",@SW_MINIMIZE)
            
        Case @GUI_CTRLID = $GUI_EVENT_RESTORE
            WinSetState(@GUI_WINHANDLE,"",@SW_RESTORE)
        
    EndSelect
    
EndFunc
Link to comment
Share on other sites

LOL, what? how did I fail?

EDIT: I am trying to help you get it running, not confirm that an outdated version of autoit will not run it.

Autoit Ver 3.2.10.0 the latest released version!

I just tried it with 3.2.9.14 and it goes wrong with that one as well, see if clicking any of the listview items does anything? (it shouldn't but it does on my computer)

Edit: I think your running outdated

Edited by ChrisL
Link to comment
Share on other sites

Link to comment
Share on other sites

It gets more strange....

All I did was move a couple lines around... now it activates on row 5 !!!

MsgBox(0, "test", @AutoItVersion )

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


Opt("GuiOnEventMode",1)

$main = GuiCreate("MyGUI", 1025, 459,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
    GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
    

$FileMenu = GUICtrlCreateMenu("File")
$ExitItem = GUICtrlCreateMenuItem("Exit",$FileMenu)
GUICtrlSetOnEvent( -1 ,"_Exit")
$h_listview = GUICtrlCreateListView(" ", 8, 10, 849, 337)
GUIStartGroup()
For $i = 0 to 10
    _GUICtrlListView_InsertColumn ( $h_listview, $i, "Col " & $i , 75  )
    
Next

GuiSetState()

$hwnd = GUICtrlGetHandle($h_listview)
    For $x = 1 to 10
            For $y = 1 to 11
                
                If $y = 1 then
                    $ret = _GUICtrlListView_AddItem($hWnd, "Row " & $x & " Col 0")
                Else
                    $ret = _GUICtrlListView_SetItemText($hWnd, $x-1,"Row " & $x & " Col " & $y -1, $y-1)
                EndIf

            Next
        Next
        
While 1
    Sleep (100)
WEnd



Func _Exit()
    Msgbox(0,"","How the F**K did clicking row 6 activate this?")
EndFunc


Func SpecialEvents()
  ConsoleWrite("Special Events WinHandle = " & @GUI_WINHANDLE & " ControlID = " & @GUI_CtrlId & @crlf)
    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE

            $ans = Msgbox(4 + 262144,"Exit","Do you really want to exit?")
            If $ans = 6 then Exit
                    
        Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
            WinSetState(@GUI_WINHANDLE,"",@SW_MINIMIZE)
            
        Case @GUI_CTRLID = $GUI_EVENT_RESTORE
            WinSetState(@GUI_WINHANDLE,"",@SW_RESTORE)
        
    EndSelect
    
EndFunc
Func lv()
    MsgBox(0, "click", "click" )
EndFunc
Link to comment
Share on other sites

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...