Jump to content

Recommended Posts

Posted

Using example: https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlListView_SetItemChecked.htm

This works as expected.

However, if two or more _GUICtrlListView_GetItemText with two different SubItems for same Index/Row precede _GUICtrlListView_SetItemChecked, the latter function reports False incorrectly.

MsgBox($MB_SYSTEMMODAL, "Information", "Item 0 0 Text: " & _GUICtrlListView_GetItemText($idListview, 0, 0))
MsgBox($MB_SYSTEMMODAL, "Information", "Item 0 1 Text: " & _GUICtrlListView_GetItemText($idListview, 0, 1))

 

Here is complete code (minimally altered from example):

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iStylesEx = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES), $idListview

    GUICreate("ListView Set Item Checked State", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2)

    ; Check item 2
    _GUICtrlListView_SetItemChecked($idListview, 1)
    MsgBox($MB_SYSTEMMODAL, "Information", "Item 0 0 Text: " & _GUICtrlListView_GetItemText($idListview, 0, 0)) ;~ New Line added to example
    MsgBox($MB_SYSTEMMODAL, "Information", "Item 0 1 Text: " & _GUICtrlListView_GetItemText($idListview, 0, 1)) ;~ This is the culprit that breaks the following
    MsgBox($MB_SYSTEMMODAL, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($idListview, 1))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

Issue occurring under this sandbox:

  • AutoIT v3.3.15.3 BETA (2020.05.16)

  •     File: Au3Info_x64.exe
         MD5: 59aa1caf3ba930ee40525f573d9f9234
       SHA-1: d4e0617e88d6a52ec9bf6991c6ad29d9b843b87b
     SHA-256: 7a9ffb984c5058d2552817b7a1a7bbd36fc521d645f52f035a216e8628cda1ac

  • SciTe v4.2.0.0 (2019.10.07)

  •     File: SciTE.exe
         MD5: b346a07d37051a5209f3e75e4a0262b2
       SHA-1: 33a4530bffd25a5b3a9673dd886fe0f1be643140
     SHA-256: b198caaf740115ea960248e421450c95fb4c7c985845e7801c2b7ffa1af1800a

Tested in both 64-bit and 32-bit (#AutoIt3Wrapper_UseX64=N) - same.

When referencing the SubItems 1 then 0 (vs. code above which is sequential 0 then 1) the bug does not surface.

i.e.: Working As Expected (changed from MsgBox to ConsoleWrite - note the second time the checkbox is inspected, False is returned in lieu of True.

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $iStylesEx = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES), $idListview

    GUICreate("ListView Set Item Checked State", 400, 300)
    $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
    GUISetState(@SW_SHOW)

    ; Add columns
    _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
    _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($idListview, "Row 3: Col 1", 2)

    ; Check item 2
    _GUICtrlListView_SetItemChecked($idListview, 1)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 1) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 0) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemChecked($idListview, 1) & @CRLF) ;~ Working here seemingly since the above are 1 then 0
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 1, 0) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 1, 1) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemChecked($idListview, 1) & @CRLF) ;~ Fails again when Sub Item iterates "forward" 0 then 1
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 0) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 1) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 2) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 2) & @CRLF)
;~     ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 1) & @CRLF)
;~     ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 1) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemText($idListview, 0, 0) & @CRLF)
    ConsoleWrite(_GUICtrlListView_GetItemChecked($idListview, 1) & @CRLF) ;~ Works when 0, 0 prior seemingly resets a pointer.

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

I do understand this is BETA.

Thank you all for your *kind* feedback :)

Posted (edited)

I can confirm this problem on 3.3.15.3 (on 3.3.14.5 it's OK) , but disabling X64 solves this problem:

 

Add this at top of script:

#pragma compile(x64, false)

 

So problem is probably with not X64 compatible code somewhere inside (new?) UDFs ...

 

EDIT2: rechecked now

compile as X32 helps only on Win10 (on Win7 it doesn't help)

compile as X32 doesn't help neither on Win10  nor on Win7

Edited by Zedna
  • Moderators
Posted

Hi,

We know about the problem and believe we have a solution. Please be patient. 

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

 

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
×
×
  • Create New...