Jump to content
Sign in to follow this  
dantay9

delete listview item

Recommended Posts

dantay9

I am trying to delete an item in a list view control. I am using _GUICtrlListView_DeleteItem on line 138. The line won't delete itself, but the _GUICtrlListView_SetItemText does work so it isn't the index. The $Clicked item comes from the WM_Notify function. It is the index of the item right clicked on in the list view. Why doesn't the index clicked on delete?

Shutdown_GUI.au3


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
Yoriz

Try changing your delete line to the following

_GUICtrlListView_DeleteItem(GUICtrlGetHandle($ListView_Run), $Clicked_Item)


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites
dantay9

That worked, but I don't know why. The GUICtrlCreateListView should have returned the handle(control ID) to the list view. Do you know why it worked?


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
Authenticity

A subtle difference which is not documented but is visible through reading the library code. If you use GUICtrlCreateListViewItem() the lparam of the LV_ITEM of the new item is it's @CtrlID. If you use _GUICtrListView_InsertItem() or _GUICtrlListView_AddItem() the lparam is by default 0. _GUICtrlListView_DeleteItem() use GUICtrlDelete() if the list view item lparam is not 0 but it should be 0 in your case, or I'm totally wrong :D

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  

×