Sign in to follow this  
Followers 0
FireLordZi

GUICtrlCreateListViewItem

2 posts in this topic

#1 ·  Posted (edited)

Hi, I am trying to split a string in an INI file using StringSplit so when I create it in my listview each different string that is split will be a listview item.

I have tried unsuccessfully and am looking for some advice...

Case $msg = $GUI_EVENT_PRIMARYDOWN
    $itemID = _GUICtrlListViewGetCurSel($nListview); $nListview is my listview control handle
    $buddyText = _GUICtrlListViewGetItemText($nListview, $itemID, 1); Get the item ID of selected item
    $itemName = INIRead("C:\buddies.ini", "OnlineBuddies", $buddyText, "")
    $splitit = StringSplit($itemName, ","); Splits the strings
    If $itemName = "" Then; If key contains no values
        _GUICtrlListViewDeleteAllItems($sListview)
        GUICtrlCreateListViewItem("Offline", $sListview)
    Else
        _GUICtrlListViewDeleteAllItems($sListview)
    ; I think a For loop might have to go here, don't know how to do it though...
        GUICtrlCreateListViewItem($splitit, $sListview); Creates the listview items from INI
    EndIf

FireLordZi

Edited by FireLordZi

While Alive() {
	 DrinkWine();
}
AutoIt Programmer

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

#include <GUIConstantsEx.au3>

$Gui = GUICreate("Buddy List", 200, 300)
$ListView = GUICtrlCreateListView("Buddy Names     |Status", 5, 5, 190, 260)
$Button = GUICtrlCreateButton("Add Buddies", 50, 275, 100, 20) 
GUISetState(@SW_SHOW, $Gui)

While 1
    $msg = GUIGetMsg()
    Switch $msg 
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            Local $SSB = StringSplit("Goober,sLoPpYdOtBiGhOlE,Feeble,Joker,Ace,$Hit Me", ",")
            For $i = 1 To $SSB[0]
                GUICtrlCreateListViewItem($SSB[$i] & "|Offline", $ListView)
            Next    
    EndSwitch
WEnd
I honestly thought you would have learned by now to post some form of actual working code when asking for help.

Once again you post a snippet of unusable code with variables that mean nothing to some1 trying to help.

If you'd get it right instead of using a new nick and joining the forum over and over again you'd probably have your code already written to perfection by now instead of it dragging on for months.

Cheers

Edited by smashly

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