Sign in to follow this  
Followers 0
quick_sliver007

How do I delete an item from a ListView

7 posts in this topic

How do I delete an item from a ListView. Is there like a guictrldeletelistviewitem function. I just want to delete one item from GUICtrlCreateListView not the whole list during run time.


.

Share this post


Link to post
Share on other sites



GuiCtrlDelete ( $ListViewItem )


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

GuiCtrlDelete ( $ListViewItem )

<{POST_SNAPBACK}>

I thoughts so too at first but I was wrong. Bshoenhair, pointed me in the right direction. I thank you both very much.

.

Share this post


Link to post
Share on other sites

Hi!

I also have some problems deleting a selected ListViewItem. First I tried this:

GUICtrlDelete(GUICtrlRead($MyListView_Handler))

$MyListView_Handler is the handler of the ListViewControl

GUICtrlRead( ) should return the handler of selected ListViewItem

GUICtrlDelete( ) should delete the Item

It didn't work :-(

I already tried the tip from:

http://www.autoitscript.com/forum/index.ph...wtopic=7026&hl=

my resulting code:

$LVM_DELETEITEM = 0x1008
$i = ControlListView ( "", "", $MyListView_Handler, "GetSelected" )
GuiCtrlSendMsg($MyListView_Handler, $LVM_DELETEITEM,$i,0)

This didn't work either, the selected ListViewItems where still there.

Do I have to 'update' (eg GUICtrlSetData) the ListView?

Can anyone help?

Thanks

Share this post


Link to post
Share on other sites

Hi!

I also have some problems deleting a selected ListViewItem. First I tried this:

GUICtrlDelete(GUICtrlRead($MyListView_Handler))

$LVM_DELETEITEM = 0x1008

$i = ControlListView ( "", "", $MyListView_Handler, "GetSelected" )

<{POST_SNAPBACK}>

You are looking for a listview in a gui with a blank title ?
$i = ControlListView ( "WinTitleGoesHere", "WinTextGoesHere", $MyListView_Handler, "GetSelected" )

Share this post


Link to post
Share on other sites

Thanks for your reply, but ControlListView accesses the correct ListView and returns a correct value $i (starting with "0" if the first item was selected), @error is "0" too.

GuiCtrlSendMsg returned always "0" and no @error.

But finally I found the reason of the trouble:

Unfortunately $i was a String, so I had to convert the return using Number() before GuiCtrlSendMsg was able to work with it

$i = Number(ControlListView ( "", "", $MyListView_Handler, "GetSelected" ))
GuiCtrlSendMsg($MyListView_Handler, $LVM_DELETEITEM,$i,0)

It's so easy... ;-)

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