Sign in to follow this  
Followers 0
ChrisL

This has to be a bug in the new listview stuff

14 posts in this topic

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

Share this post


Link to post
Share on other sites



#4 ·  Posted (edited)

You failed on the first line :)

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.

Edited by danwilli

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

wow... my bad for being a retard that can't count.... I will download the latest > test > and post my results

sorry for being such a putz... been a long day

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

crazy... I get the same results as you

EDIT:

3.2.10.0 - has the issue

3.2.9.14 - has the issue also

Edited by danwilli

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

why would declaring a GUI variable later on, have that result.... man this is odd

Edited by danwilli

Share this post


Link to post
Share on other sites

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