Sign in to follow this  
Followers 0
Tutech

GuiCtrlCreateList and deleting of items

9 posts in this topic

Hi :P

Just a simple question. I searched the forum and did not find any awnser :nuke:

Is it possible to delete an item from a list which is created with GuiCtrlCreateList ?

I just found the possibility to add items with GuiCtrlSetData .

No way to delete an item. I dont want to store the whole list in an array.

Thanks

Micha

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button

GUICreate("ListBox Delete Item Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Delete item #2", 150, 160, 120, 40)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListDeleteItem ($listbox, 1)
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListDeleteItem")
            EndIf
    EndSelect
WEnd


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button

GUICreate("ListBox Delete Item Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120)
GUICtrlSetData($listbox, "test1|test2|test3|")
$button = GUICtrlCreateButton("Delete item #2", 150, 160, 120, 40)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListDeleteItem ($listbox, 1)
            If ($ret == $LB_ERR) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListDeleteItem")
            EndIf
    EndSelect
WEnd
Nice thing (I think).

But two questions. Where do I get GuiList.au3 from?

And the second thing: If I understand this in the correct way _GUICtrlListDeleteItem($listbox,1) deletes the item with index number one from list listbox? Is there an function available to get the index of the selected item? Is there any documentation available for GuiList.au3 ? It's not standard I think.

Thanks

Micha

Share this post


Link to post
Share on other sites

Nice thing (I think).

But two questions. Where do I get GuiList.au3 from?

And the second thing: If I understand this in the correct way _GUICtrlListDeleteItem($listbox,1) deletes the item with index number one from list listbox? Is there an function available to get the index of the selected item? Is there any documentation available for GuiList.au3 ? It's not standard I think.

Thanks

Micha

Look in the UDF section of the help file from the latest release version (3.2.0.1)


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

Look in the UDF section of the help file from the latest release version (3.2.0.1)

Ok. Thanks for your help.

Micha :P

Share this post


Link to post
Share on other sites

Ok. Thanks for your help.

Micha :P

Me again. Got now the latest release of AutoIt and GuiList.au3

Is it just me or is this version of GuiList.au3 buggy? I got a bunch of errors by just including it.

Thanks

Micha

Share this post


Link to post
Share on other sites

Me again. Got now the latest release of AutoIt and GuiList.au3

Is it just me or is this version of GuiList.au3 buggy? I got a bunch of errors by just including it.

Thanks

Micha

If using SciTE and Au3Check, make sure you have the latest of those also.

I don't get any errors.


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


Link to post
Share on other sites

If using SciTE and Au3Check, make sure you have the latest of those also.

I don't get any errors.

Ok. Thats it. Thanks.

Have a nice day.

Micha

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