Jump to content

Error in UDF GUIListViewEx


Recommended Posts

at first i use win10...
hello guys i have some random errors from UDF GUIListViewEx.au3 just by adding items to my list (hold KEY W)
how can i fix my problem ?? 

here is script

#include <GuiConstantsEx.au3>
#include <GUIListViewEx.au3>
#include <WindowsConstants.au3>
#include <SendMessage.au3>

HotKeySet("{ESC}", "_quit")
HotKeySet("w", "_wait")
Global $iCount = 0, $iEditMode = 0, $hGUI

$GUI = GUICreate("Clicker", 430, 400, 100, 100)
GUISetState()
$ListView = GUICtrlCreateListView("Name|Funkcja|Os X|Os Y|Click|Wait", 10, 20, 350, 300, $LVS_SHOWSELALWAYS)
_GUICtrlListView_SetExtendedListViewStyle($ListView, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES )

$iLV_Index = _GUIListViewEx_Init($ListView, "", 0, 0, True, 1 + 2 + 8)
_GUIListViewEx_SetEditStatus($iLV_Index, "0;2;3;4;5") ; Column 0 & 2 editable - simple text not selected on open
_GUIListViewEx_MsgRegister() ; Register for sorting, dragging and editing

$nazwa = 0

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    $vRet = _GUIListViewEx_EventMonitor($iEditMode)
WEnd

Func _wait()
    $nazwa = $nazwa + 1
    Global $vData[6] = ["Name " & $nazwa, "Wait", "", "", "", ""]
    $iCount += 1
    _GUIListViewEx_Insert($vData)
EndFunc   ;==>_wait

Func _quit()
    Exit
EndFunc   ;==>_quit

;~ "C:\Program Files (x86)\AutoIt3\Include\GUIListViewEx.au3" (5033) : ==> Subscript used on non-accessible variable.:
;~ For $i = 1 To $aLV_Array[0][0]
;~ For $i = 1 To $aLV_Array^ ERROR

;~ "C:\Program Files (x86)\AutoIt3\Include\GUIListViewEx.au3" (5211) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
;~ $avArray[$iIndex] = $vInsert
;~ ^ ERROR

;~ "C:\Program Files (x86)\AutoIt3\Include\GUIListViewEx.au3" (1316) : ==> Subscript used on non-accessible variable.:
;~ If $aGLVEx_SrcArray[0][0] = 0 Then $iRow = 0
;~ If $aGLVEx_SrcArray^ ERROR

 

Edited by Verssuss
Link to comment
Share on other sites

  • Moderators

Verssuss,

Why did you not post in the UDF thread as I suggest to you earlier?

After considerable testing since you PMed me about the problem I can now reproduce the same error on occasion - it happens if you keep the "w" key depressed permanently and the HotKey fires again before the previous _Insert function has completed - it interrupts that function in mid flow and so the error occurs as the new instance now thinks that the actual ListView content and the UDF shadow are not in sync.

Quite why you would want to add items to a ListView in such quick succession is beyond me, but you can solve the problem by unsetting the HotKey as you enter the function and resetting it as you leave. That way the HotKey will only fire again once the UDF has completed inserting the previous row:

Func _wait()
    HotKeySet("w")              ; Unset HotKey <<<<<<<<<<<<<<<<<<<<<<<<<<<
    $nazwa = $nazwa + 1
    Global $vData[6] = ["Name " & $nazwa, "Wait", "", "", "", ""]
    $iCount += 1
    _GUIListViewEx_Insert($vData)
    HotKeySet("w", "_wait")     ; Reset HotKey <<<<<<<<<<<<<<<<<<<<<<<<<<<
EndFunc   ;==>_wait

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

simle exapmle how do i need use it
 

Func _getcoord()
    $nazwa = $nazwa + 1
    $pos = MouseGetPos()
    Global $vData[5] = ["Name " & $nazwa, "Left Click", $pos[0], $pos[1], $click]
    $iCount += 1
    _GUIListViewEx_Insert($vData)
EndFunc   ;==>_getcoord

i want hold hotkey and take all possible mouse position while hotkey is pressed
here u see why "you would want to add items to a ListView in such quick"
after i use disable hotkey at start of function and enable it after function is done its works perfect
btw i can read later my mouse coords from whole list i did and repeat each move by 1 click
THX problem fixed 

Link to comment
Share on other sites

  • Moderators

Verssuss,

if you are simply storing the mouse coordinates for later use I would argue that immediately entering them into a ListView is massively overcomplicating the issue - but if you are happy with that approach, then fine.

However, given what you say you are doing, could I gently point you to the Forum rules - we would not want any subsequent threads of yours to stray into forbidden territory.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Verssuss,

I accused you of nothing - it was just a gentle hint. Recording and replaying mouse coordinates are often associated with things we do not wish to support and I merely wanted you to be sure what they are.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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