Sign in to follow this  
Followers 0
BoogY

Liste View items

4 posts in this topic

Hello to everyone :

I have tis funtion :

;---------------------------------------------------------
;Add the files to the .ini file
;---------------------------------------------------------
func addFilesList()
    $configFile = @ScriptDir & "\config.ini"

    ;$listCount = _GUICtrlListView_GetItemCount($listeCibles); count the files
    $aItem = _GUICtrlListView_GetItemTextString($listeCibles, 1)
    
    For $i = 1 To $aItem -1
        $sText &= $aItem[$i] & @LF
        IniWriteSection($configFile,"FilesToCopy",$sText)
    Next    
EndFunc

I don't know how to put all the items text in the .ini file.

and how to delete a selected item in the list view ?

Thank a lot.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Try this:

;---------------------------------------------------------
;Add the files to the .ini file
;---------------------------------------------------------
func addFilesList()
    $configFile = @ScriptDir & "\config.ini"
    $sText = ""

    $lviewSelected = _GUICtrlListView_GetSelectedIndices($listeCibles, 1)
    For $x = 1 To $lviewSelected[0]
        $sText &= _GUICtrlListView_GetItemText($listeCibles, $lviewSelected[$x]) & @LF
    Next
    
    IniWriteSection($configFile,"FilesToCopy",$sText)
EndFunc

**Edit - After looking at it a little closer, I don't think you're using IniWriteSection correctly, the helpfile gives this as an example for how your $sText should be formatted:

; Demonstrate creating a new section using a string as input.
$sData = "Key1=Value1" & @LF & "Key2=Value2" & @LF & "Key3=Value3"
IniWriteSection($sIni, "Section1", $sData)

You're getting the value and you're getting the delimiting @LF in there, but based off your example you don't specify any "Key#="-type of reference.

Edited by exodius

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I need it to write juste the value and not the Key = value. this work for me.

And i tryed like this and it works :

func addFilesList()
    $configFile = @ScriptDir & "\config.ini"
    $nbrItems = _GUICtrlListView_GetItemCount($listeCibles)
    For $i = 0 To $nbrItems -1
        $aItem = _GUICtrlListView_GetItemTextString($listeCibles, $i)
        IniWriteSection($configFile,"FilesToCopy",$aItem)
    Next
EndFunc

Cause i want it to add all the items texts in the ini file.

It works now. Thanks for your help

Edited by BoogY

Share this post


Link to post
Share on other sites

So you do realize that what you posted is going to get all of the listview items, not just the ones that are selected right?

Oh, and your function to delete selected items is:

_GUICtrlListView_DeleteItemsSelected($listeCibles

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