Jump to content

Recommended Posts

Posted

i have this code using _GUICtrlDeleteAllItems, but for some reason it doesn't work correctly. all items deleted and cannot be re-created

#include <GUIConstants.au3>
#include <GUIListView.au3>

GUICreate("", 400, 400)
$list = GUICtrlCreateListView("some data", 0, 0, 400, 400)
$List_h = GUICtrlGetHandle($List)
GUISetState()

For $i = 1 To 10
    For $a = 1 To 1024
        GUICtrlCreateListViewItem("data number : " & $a, $list)
    Next
    MsgBox(0,"Loop",$i)
    _GUICtrlListView_DeleteAllItems($list_h)
Next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

i tried deleting the items using _GUICtrlDeleteItem, sadly it doesn't work.

#include <GUIConstants.au3>
#include <GUIListView.au3>

GUICreate("", 400, 400)
$list = GUICtrlCreateListView("some data", 0, 0, 400, 400)
$List_h = GUICtrlGetHandle($List)
GUISetState()

For $i = 1 To 10
    For $a = 1 To 1024
        GUICtrlCreateListViewItem("data number : " & $a, $list)
    Next
    MsgBox(0,"Loop",$i)
    For $a = 0 To _GUICtrlListView_GetItemCount($list_h)
        _GUICtrlListView_DeleteItem($list_h, $a)
    Next
Next

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

so i tried declaring each item and then calling GUICtrlDelete, and that worked but my question is, could this be a bug with _GUICtrlDeleteAllItems or am i doing something wrong here ?

Posted

Maybe if you made your goal a little more obvious. What it seems is that you load info , and want it all deleted? _GuiCtrlDeletAllItems works for me so I don't understand the problem. The stuff is recreated as well. Be sure to install the latest beta version.

Posted

This seems to be a side effect of the 4096 item limit with GUICtrlCreateListViewItem, even though you are only creating 1024 items at a time. It fails for me after the 4th time thru.

_GUICtrlListView_AddItem appears to work ok

#include <GUIConstants.au3>
#include <GUIListView.au3>

GUICreate("", 400, 400)
$list = GUICtrlCreateListView("some data", 0, 0, 400, 400)
$List_h = GUICtrlGetHandle($List)
GUISetState()

For $i = 1 To 10
    For $a = 1 To 1024
        ;GUICtrlCreateListViewItem("data number : " & $a, $list)
        _GUICtrlListView_AddItem($list_h, "data number : " & $a)
    Next
    MsgBox(0,"Loop",$i)
    _GUICtrlListView_DeleteAllItems($list_h)
Next


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
Posted

This seems to be a side effect of the 4096 item limit with GUICtrlCreateListViewItem, even though you are only creating 1024 items at a time. It fails for me after the 4th time thru.

_GUICtrlListView_AddItem appears to work ok

seems to be working fine, thanks for your help
Posted

This seems to be a side effect of the 4096 item limit with GUICtrlCreateListViewItem, even though you are only creating 1024 items at a time. It fails for me after the 4th time thru.

_GUICtrlListView_AddItem appears to work ok

#include <GUIConstants.au3>
#include <GUIListView.au3>

GUICreate("", 400, 400)
$list = GUICtrlCreateListView("some data", 0, 0, 400, 400)
$List_h = GUICtrlGetHandle($List)
GUISetState()

For $i = 1 To 10
    For $a = 1 To 1024
        ;GUICtrlCreateListViewItem("data number : " & $a, $list)
        _GUICtrlListView_AddItem($list_h, "data number : " & $a)
    Next
    MsgBox(0,"Loop",$i)
    _GUICtrlListView_DeleteAllItems($list_h)
Next


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
With the next 3.2.11.1 it shouldn't matter which way it is created.

If item(s) created with the built-in function, just pass the listview control id in to the delete function.

This will properly delete the item(s) and you will still be able to add back in, with the limit of course.

If item(s) created with udf function(s) pass the handle to the listview in.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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