Jump to content

How Do I delete from a list?


Recommended Posts

How do I delete an item from a list at any position in the list.

Where the user would type happy birthday

and it would be removed from the following list

cookies

happy birthday

cake

ice cream

please help

thanks

and yes this is my first post... ever

Yeah I'm not the greatest at DarkBasic either, but I'm good enough for a link :D A Thread of a W.I.P. that im making

Link to comment
Share on other sites

Welcome to the forum.

It really depends on what type of list you are using. Is the list an array in memory, in a control or a file? Do you know the position of what you want to delete ahead of time or do you need to be able to search the list and delete it?

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

they syntax is read as listed...

please bare with me as im doing this off of memory as im at school

it does run completly, just not how i want it to, when i have code correct...

#include <guicontrol.au3>
#include <Guilist.au3>
#include <xscript.au3>
$list = GUICtrlCreateList("",100,100...etc)


;then i am trying to use
While 1 
Wend

func add()
$add = xctrlinputbox("Something","else","")
_GuiCtrlListInsertItem($list,$add)

func remove()
;not sure if thats exact command
$remove = Xctrlinputbox("something","else","")
_GuiCtrlListDeleteItem($list,$remove)

please help me

thanks much more

I need to be able to search the list and then delete it.

Edited by sneakysmith12

Yeah I'm not the greatest at DarkBasic either, but I'm good enough for a link :D A Thread of a W.I.P. that im making

Link to comment
Share on other sites

Here's a simple example to get you started:

#include <GUIConstants.au3>
#include <GUIList.au3>

GUICreate("Test", 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU)
$hList = GUICtrlCreateList("", 4, 4, 342, 292, BitOr($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER))
GUISetState ()

for $I = 1 to 5
  _GUICtrlListAddItem($hList, "Item " & $I)
next

_GUICtrlListAddItem($hList, "Find Me")

for $I = 6 to 10
  _GUICtrlListAddItem($hList, "Item " & $I)
next

MsgBox(0, "Test", "Loaded")

$N = _GUICtrlListFindString($hList, "Find Me")

_GUICtrlListDeleteItem($hList, $N)

do
  Sleep(100)
until GUIGetMsg() = $GUI_EVENT_CLOSE
Auto3Lib: A library of over 1200 functions for AutoIt
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...