Jump to content

how to deleted the selected on GUICtrlCreateList ?


Recommended Posts

1 GUICtrlCreateList , 5 item like :

this line A

this line B

this line B

this line A

this line C

if user select the 3rd line ( the 2nd " this line B " ) and press buton to delete, how it works ?

case $button_delete

_function()

Func _function()

$x = GUICtrlRead($List1)

; and..... do what @@?

Return msgbox(0,"OK!", "The line u delete")

endFunc

My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Link to comment
Share on other sites

1)

- Remember index of selected item

- Read all lines from your ListBox into array variable

- erase content of whole ListBox

- add all lines from array except of selected one

Use_GUICtrlListBox_GetCount(), _GUICtrlListBox_GetText(), _GUICtrlListBox_AddString 

from #Include <GuiListBox.au3>

2) 

or use _GUICtrlListBox_GetCurSel () and _GUICtrlListBox_DeleteString($hWnd, $iIndex)

--> this is much simpler

EDIT: I'm too late here :-)

Edited by Zedna
Link to comment
Share on other sites

take a look at the help file...

#Include <GuiListBox.au3>
_GUICtrlListBox_DeleteString($hWnd, _GUICtrlListBox_GetCurSel($hWnd))

i found this under 5 seconds

i just want to say..... my eyes got popo....

use AUTOIT almost 1.5 years never found #Include <GuiListBox.au3> before...

anyway thanks a lot ^^"!

Func delselec()

$x = _GUICtrlListBox_GetCurSel($List1)

if $x <> -1 Then _GUICtrlListBox_DeleteString($List1,$x)

EndFunc

My website about Y-mate 網拍輔助程式 : http://www.L2play.comMy Blog ( Tranditional Chinese ) 開發小組的部落格 : http://tw.myblog.yahoo.com/play19990909

Link to comment
Share on other sites

i just want to say..... my eyes got popo....

use AUTOIT almost 1.5 years never found #Include <GuiListBox.au3> before...

anyway thanks a lot ^^"!

Func delselec()

$x = _GUICtrlListBox_GetCurSel($List1)

if $x <> -1 Then _GUICtrlListBox_DeleteString($List1,$x)

EndFunc

you're welcome... its under the UDF part of the help file. close to the bottom of the treeview

[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

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