Jump to content

_GUICtrlListView_DeleteItem


Rawox
 Share

Recommended Posts

Hi there,

I almost finished my new project but I just can't get the _GUICtrlListView_DeleteItem to work...

Anyone can tell me what the hell is going wrong?

Thanks in advance, Rawox

$Interface =        GUICreate ( $Title & " " & $Version & " by " & $Nickname, 600, 265 )
$List =             GUICtrlCreateListView ( "Server tag:", 15, 15, 570, 200 )
                    _GUICtrlListView_SetColumnWidth ( $List, 0, 146 )
                    _GUICtrlListView_AddColumn ( $List, "IP-address:", 100 )
                    _GUICtrlListView_AddColumn ( $List, "Port:", 60 )
                    _GUICtrlListView_AddColumn ( $List, "Nickname:", 100 )
                    _GUICtrlListView_AddColumn ( $List, "Team:", 60 )
                    _GUICtrlListView_AddColumn ( $List, "Character:", 100 )
$Options =          GUICtrlCreateButton ( "Options...", 15, 225, 108, 28 )
$AddServer =        GUICtrlCreateButton ( "Add Server...", 130, 225, 108, 28 )
$DeleteServer =     GUICtrlCreateButton ( "Delete Server", 246, 225, 108, 28 )
$JoinPlayer =       GUICtrlCreateButton ( "Play", 362, 225, 108, 28 )
$JoinSpec =         GUICtrlCreateButton ( "Spectate", 477, 225, 108, 28 )

                    If $idArray[0] <> 0 Then
                        $i = 1
                        Do
                            $CurrentItem = $idArray[$i]
                            IniRead ( $IniDir, "Servers", $CurrentItem, "" )
                            $taArray = StringSplit ( IniRead ( $IniDir, "Servers", $CurrentItem, "" ), "|", 2 )
                            _GUICtrlListView_AddItem ( $List, $taArray[0] )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[1], 1 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[2], 2 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[3], 3 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[4], 4 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[5], 5 )
                            $i += 1
                        Until $i = $idArray[0] + 1
                    EndIf

When user presses "Delete Server" Button

Case $DeleteServer
            #cs
            $i = -1
            Do
                $i += 1
                $GetSelectedItem = _GUICtrlListView_GetItemState ( $List, $i, $LVIS_SELECTED )
            Until $GetSelectedItem = True
            _GUICtrlListView_DeleteItem ( $List, 1 )
            #ce
            MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($List, 0))

Full Script:

;ShellExecute ( RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Unreal Technology\Installed Apps\UT2004", "Folder" ) & "\System\ut2004.exe", "87.238.170.41?bSpectator=true?NAME=Rawox" )
;Exit

#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <ListviewConstants.au3>
#include <GuiListView.au3>
#Include <GuiComboBox.au3>
#include <GuiIPAddress.au3>
#include <GuiConstantsEx.au3>
#include <Array.au3>
#include <WindowsConstants.au3>

Global $Title =         "UTQuickServer"
Global $Version =       "1.3"
Global $Author =        "Cas Cornelissen"
Global $Nickname =      "Rawox"
Global $IniDir =        @ScriptDir & "/" & $Title & ".ini"
Global                  $nnArray[1]
Global                  $idArray[1]

Global $CurrentWindow = "Main"

If NOT FileExists ( $IniDir ) Then
    $nnArray[0] = "1"
    $idArray[0] = "0"
    IniWrite ( $IniDir, "User", "Nicknames", _ArrayToString ( $nnArray, "|" ) )
    IniWrite ( $IniDir, "Servers", "UniqueIDs", _ArrayToString ( $idArray, "|" ) )
Else
    $nnArray = StringSplit ( IniRead ( $IniDir, "User", "Nicknames", "" ), "|", 2 )
    $idArray = StringSplit ( IniRead ( $IniDir, "Servers", "UniqueIDs", "" ), "|", 2 )
EndIf

#Region = = = = = = = = = = = = = = MAIN INTERFACE = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

$Interface =        GUICreate ( $Title & " " & $Version & " by " & $Nickname, 600, 265 )
$List =             GUICtrlCreateListView ( "Server tag:", 15, 15, 570, 200 )
                    _GUICtrlListView_SetColumnWidth ( $List, 0, 146 )
                    _GUICtrlListView_AddColumn ( $List, "IP-address:", 100 )
                    _GUICtrlListView_AddColumn ( $List, "Port:", 60 )
                    _GUICtrlListView_AddColumn ( $List, "Nickname:", 100 )
                    _GUICtrlListView_AddColumn ( $List, "Team:", 60 )
                    _GUICtrlListView_AddColumn ( $List, "Character:", 100 )
$Options =          GUICtrlCreateButton ( "Options...", 15, 225, 108, 28 )
$AddServer =        GUICtrlCreateButton ( "Add Server...", 130, 225, 108, 28 )
$DeleteServer =     GUICtrlCreateButton ( "Delete Server", 246, 225, 108, 28 )
$JoinPlayer =       GUICtrlCreateButton ( "Play", 362, 225, 108, 28 )
$JoinSpec =         GUICtrlCreateButton ( "Spectate", 477, 225, 108, 28 )

                    If $idArray[0] <> 0 Then
                        $i = 1
                        Do
                            $CurrentItem = $idArray[$i]
                            IniRead ( $IniDir, "Servers", $CurrentItem, "" )
                            $taArray = StringSplit ( IniRead ( $IniDir, "Servers", $CurrentItem, "" ), "|", 2 )
                            _GUICtrlListView_AddItem ( $List, $taArray[0] )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[1], 1 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[2], 2 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[3], 3 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[4], 4 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $taArray[5], 5 )
                            $i += 1
                        Until $i = $idArray[0] + 1
                    EndIf

#EndRegion = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
#Region = = = = = = = = = = = = = = ADD SERVER INTERFACE = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

$AddServerGui =     GUICreate ( "Add Server", 300, 244, -1, -1, -1, -1 )
                    GUICtrlCreateLabel ( "IP and Port:", 20, 24 )
                    GUICtrlCreateLabel ( ":", 238, 24, 5 )
                    GUICtrlCreateLabel ( "Server Tag:", 20, 54 )
                    GUICtrlCreateLabel ( "Nickname:", 20, 84 )
                    GUICtrlCreateLabel ( "Team:", 20, 114 )
                    GUICtrlCreateLabel ( "Character:", 20, 144 )
                    GUICtrlCreateLabel ( "(Race)", 230, 144 )
                    GUICtrlSetColor ( -1, 0xAAAAAA )
                    GUICtrlCreateLabel ( "(Name)", 230, 174 )
                    GUICtrlSetColor ( -1, 0xAAAAAA )
$InputIP =          _GUICtrlIpAddress_Create ( $AddServerGui, 100, 20, 135, 20 )
$InputPort =        GUICtrlCreateInput ( "", 245, 20, 35, 20, $ES_NUMBER )
$InputServerTag =   GUICtrlCreateInput ( "", 100, 50, 180, 20 )
$InputNickname =    GUICtrlCreateCombo ( "", 100, 80, 180, 20 )
$InputTeam =        GUICtrlCreateCombo ( "Red", 100, 110, 75, 20, $CBS_DROPDOWNLIST )
$TeamRandom =       GUICtrlCreateCheckbox ( "Random color", 185, 111 )
$CharacterRace =    GUICtrlCreateCombo ( "Default", 100, 140, 120, 20, $CBS_DROPDOWNLIST )
$CharacterName =    GUICtrlCreateCombo ( "", 100, 170, 120, 20, $CBS_DROPDOWNLIST )
$CancelAdd =        GUICtrlCreateButton ( "Close", 15, 200, 80, 28 )
$ServerAddNow =     GUICtrlCreateButton ( "Add server to list", 100, 200, 180, 28 )
                    GUICtrlSetState ( $TeamRandom, $GUI_CHECKED )
                    GUICtrlSetState ( $InputTeam, $GUI_DISABLE )
                    GUICtrlSetData ( $CharacterRace, "Skaarj|Metalguard|Necris|Thundercrash|Mercenary|Egyptian|Juggernaut|Gen Mo'Kai|Robot|Nightmare|Cybernetic|Hellions" )
                    GUICtrlSetData ( $InputTeam, "Blue" )
                    GUICtrlSetLimit ( $InputPort, 4, 4 )
                    GUICtrlSetTip ( $InputNickname, "The name you want to use on the server. (Max: 16)", "Nickname:", 1, 2 )
                    GUICtrlSetData ( $InputNickname, " " )
                    If $nnArray[0] > 1 Then
                        $i = 1
                        Do
                            GUICtrlSetData ( $InputNickname, $nnArray[$i] )
                            $i += 1
                        Until $i = $nnArray[0]
                        _GUICtrlComboBox_SetCurSel ( $InputNickname, 0 )
                    EndIf
                    _charNameCombo ( GUICtrlRead ( $CharacterRace ) )               

#EndRegion = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
#Region = = = = = = = = = = = = = = CONFIG INTERFACE = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 

$ConfigInterface =  GUICreate ( "Configuration", 250, 185, -1, -1, -1, -1 )
$CancelConfig =     GUICtrlCreateButton ( "Cancel", 10, 145, 112, 28 )
$ConfigSave =       GUICtrlCreateButton ( "Save", 128, 145, 112, 28 )
$FocusGroup =       GUICtrlCreateGroup ( "Group", -200, -200, 10, 10 )
                    GUICtrlCreateTab ( 10, 10, 232, 130 )
                    GUICtrlCreateTabItem ( "General" )
$StartWithWin =     GUICtrlCreateCheckBox ( "Start with Windows", 25, 40 )
$StartWithWinHide = GUICtrlCreateCheckBox ( "Hidden", 150, 40 )
$HideToTrayClose =  GUICtrlCreateCheckBox ( "Hide to Tray on Close", 25, 62 )
$ConfirmDialogs =   GUICtrlCreateCheckBox ( "Show confirmation Dialogs", 25, 84 )
$StayOnTop =        GUICtrlCreateCheckBox ( "Always on Top", 25, 106 )
                    GUICtrlCreateTabItem ( "Add Server" )
                    GUICtrlCreateLabel ( "Remember the following options:", 25, 43 )
$RemembIP =         GUICtrlCreateCheckBox ( "IP address", 25, 84 )
$RemembPort =       GUICtrlCreateCheckBox ( "Port", 25, 62 )
$RemembServerTag =  GUICtrlCreateCheckBox ( "Server tag", 25, 106 )
$RemembTeam =       GUICtrlCreateCheckBox ( "Team", 120, 62 )
$RemembRace =       GUICtrlCreateCheckBox ( "Character Race", 120, 84 )
$RemembName =       GUICtrlCreateCheckBox ( "Character Name", 120, 106 )
                    GUICtrlCreateTabItem ( "Nicknames" )

                    GUICtrlSetState ( $StartWithWin, IniRead ( $IniDir, "General", "StartWithWin", 4 ) )
                    GUICtrlSetState ( $StartWithWinHide, IniRead ( $IniDir, "General", "StartWithWinHide", 4 ) )
                    GUICtrlSetState ( $HideToTrayClose, IniRead ( $IniDir, "General", "HideToTrayClose", 1 ) )
                    GUICtrlSetState ( $ConfirmDialogs, IniRead ( $IniDir, "General", "ConfirmDialogs", 1 ) )
                    GUICtrlSetState ( $StayOnTop, IniRead ( $IniDir, "General", "StayOnTop", 4 ) )
                    GUICtrlSetState ( $RemembIP, IniRead ( $IniDir, "AddServer", "RemembIP", 4 ) )
                    GUICtrlSetState ( $RemembPort, IniRead ( $IniDir, "AddServer", "RemembPort", 4 ) )
                    GUICtrlSetState ( $RemembServerTag, IniRead ( $IniDir, "AddServer", "RemembServerTag", 1 ) )
                    GUICtrlSetState ( $RemembTeam, IniRead ( $IniDir, "AddServer", "RemembTeam", 1 ) )
                    GUICtrlSetState ( $RemembRace, IniRead ( $IniDir, "AddServer", "RemembRace", 1 ) )
                    GUICtrlSetState ( $RemembName, IniRead ( $IniDir, "AddServer", "RemembName", 1 ) )
                    GUICtrlSetState ( $FocusGroup, $GUI_FOCUS )
                    If GUICtrlRead ( $StartwithWin ) = $GUI_CHECKED Then
                        GUICtrlSetState ( $StartWithWinHide, $GUI_ENABLE )
                    Else
                        GUICtrlSetState ( $StartWithWinHide, $GUI_DISABLE )
                    EndIf

#EndRegion = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

                    GUISetState ( @SW_SHOW, $Interface )
                    GUISetState ( @SW_HIDE, $AddServerGui )
                    GUISetState ( @SW_HIDE, $ConfigInterface )
                    
                    If IniRead ( $IniDir, "General", "StayOnTop", "" ) = 1 Then
                        WinSetOnTop ( $Title & " " & $Version & " by " & $Nickname, "", 1 )
                    Else
                        WinSetOnTop ( $Title & " " & $Version & " by " & $Nickname, "", 0 )
                    EndIf
                    
While 1
    Switch GUIGetMsg()
        ; = = = = = = = = = = $ConfigInterface = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
        Case $CancelConfig
            _closeWindows ( )
        Case $ConfigSave
            _saveConfig ( )
        Case $StartWithWin
            If GUICtrlRead ( $StartwithWin ) = $GUI_CHECKED Then
                GUICtrlSetState ( $StartWithWinHide, $GUI_ENABLE )
            Else
                GUICtrlSetState ( $StartWithWinHide, $GUI_DISABLE )
            EndIf
            
        ; = = = = = = = = = = $AddServerGui = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
        Case $ServerAddNow
            $GetArray = _GUICtrlIpAddress_GetArray ( $InputIP )
            If $GetArray[0] <> "" And $GetArray[1] <> "" And $GetArray[2] <> "" And $GetArray[3] <> "" Then
                If StringLen ( GUICtrlRead ( $InputPort ) ) = 4 Then
                    If StringLen ( GUICtrlRead ( $InputNickname ) ) < 16 Then
                        If StringIsSpace ( GUICtrlRead ( $InputNickname ) ) Then
                            GUICtrlSetData ( $InputNickname, "" )
                        EndIf
                        If NOT StringInStr ( GUICtrlRead ( $InputNickname ), " " ) Then
                            _GUICtrlListView_AddItem ( $List, GUICtrlRead ( $InputServerTag ) )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, _GUICtrlIpAddress_Get ( $InputIP ), 1 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, GUICtrlRead ( $InputPort ), 2 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, GUICtrlRead ( $InputNickname ), 3 )
                            If GUICtrlRead ( $TeamRandom ) = $GUI_CHECKED Then $Team = "Random"
                            If GUICtrlRead ( $TeamRandom ) = $GUI_UNCHECKED Then $Team = GUICtrlRead ( $InputTeam )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, $Team, 4 )
                            _GUICtrlListView_AddSubItem ( $List, _GUICtrlListView_GetItemCount ( $List ) - 1, GUICtrlRead ( $CharacterName ) , 5 )
                            _closeWindows ( )
                            $GetID = _uniqueIDGen ( )
                            _ArraySearch ( $idArray, $GetID )
                            If @error = 6 Then
                                $idArray = StringSplit ( IniRead ( $IniDir, "Servers", "UniqueIDs", "" ), "|", 2 )
                                $idArray[0] = $idArray[0]+1
                                _ArrayAdd ( $idArray, $GetID )
                                IniWrite ( $IniDir, "Servers" , "UniqueIDs", _ArrayToString ( $idArray, "|" ) )
                                IniWrite ( $IniDir, "Servers" , $GetID, GUICtrlRead ( $InputServerTag ) & "|" & _GUICtrlIpAddress_Get ( $InputIP ) & "|" & GUICtrlRead ( $InputPort ) & "|" & GUICtrlRead ( $InputNickname ) & "|" & $Team & "|" & GUICtrlRead ( $CharacterName ) )
                            EndIf
                            If IniRead ( $IniDir, "AddServer", "RemembIP", 4 ) = 4 Then _GUICtrlIpAddress_ClearAddress ( $InputIP )
                            If IniRead ( $IniDir, "AddServer", "RemembPort", 4 ) = 4 Then GUICtrlSetData ( $InputPort, "" )
                            If IniRead ( $IniDir, "AddServer", "RememberServerTag", 1 ) = 4 Then GUICtrlSetData ( $InputServerTag, "" )
                            If IniRead ( $IniDir, "AddServer", "RemembRace", 1 ) = 4 Then GUICtrlSetData ( $CharacterRace, "" )
                            If IniRead ( $IniDir, "AddServer", "RemembName", 1 ) = 4 Then GUICtrlSetData ( $CharacterName, "" )
                            If IniRead ( $IniDir, "AddServer", "RemembTeam", 1 ) = 4 Then 
                                GUICtrlSetData ( $InputTeam, "" )
                                GUICtrlSetState ( $InputTeam, $GUI_DISABLE )
                                GUICtrlSetState ( $TeamRandom, $GUI_CHECKED )
                            EndIf
                            If GUICtrlRead ( $InputNickname ) <> "" Then
                                _ArraySearch ( $nnArray, GUICtrlRead ( $InputNickname ) )
                                If @error = 6 Then
                                    $nnArray = StringSplit ( IniRead ( $IniDir, "User", "Nicknames", "" ), "|", 2 )
                                    $nnArray[0] = $nnArray[0]+1
                                    _ArrayAdd ( $nnArray, GUICtrlRead ( $InputNickname ) )
                                    IniWrite ( $IniDir, "User" , "Nicknames", _ArrayToString ( $nnArray, "|" ) )
                                EndIf
                            EndIf
                        Else
                            MsgBox ( 16, "Nickname Error", "It is not possible to use whitespaces in your nickname." )
                        EndIf
                    Else
                        MsgBox ( 16, "Nickname Error", "Your nickname exceeds the limit of 16 characters." )
                    EndIf
                Else
                    MsgBox ( 16, "Port Error", "Be sure the port has 4 digits." )
                EndIf
            Else
                MsgBox ( 16, "IP Error", "Please check what you've filled in in the IP input field." )
            EndIf
        Case $CancelAdd
            _closeWindows ( )
        Case $TeamRandom
            If GUICtrlRead ( $TeamRandom ) = $GUI_CHECKED Then
                GUICtrlSetState ( $InputTeam, $GUI_DISABLE )
            Else
                GUICtrlSetState ( $InputTeam, $GUI_ENABLE )
            EndIf
        Case $CharacterRace
            _charNameCombo ( GUICtrlRead ( $CharacterRace ) )
            
        ; = = = = = = = = = = $Interface = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
        Case $Options
            $CurrentWindow = "Configuration"
            GUISetState ( @SW_HIDE, $Interface )
            Sleep ( 200 )
            GUISetState ( @SW_SHOW, $ConfigInterface )
        Case $AddServer
            If $nnArray[0] > 1 Then
                $i = 1
                Do
                    GUICtrlSetData ( $InputNickname, $nnArray[$i] )
                    $i += 1
                Until $i = $nnArray[0]
                _GUICtrlComboBox_SetCurSel ( $InputNickname, 0 )
            EndIf
            $CurrentWindow = "AddServer"
            GUISetState ( @SW_HIDE, $Interface )
            Sleep ( 200 )
            GUISetState ( @SW_SHOW, $AddServerGui )
        Case $DeleteServer
            #cs
            $i = -1
            Do
                $i += 1
                $GetSelectedItem = _GUICtrlListView_GetItemState ( $List, $i, $LVIS_SELECTED )
            Until $GetSelectedItem = True
            _GUICtrlListView_DeleteItem ( $List, 1 )
            #ce
            MsgBox(4160, "Deleted?", _GUICtrlListView_DeleteItem($List, 0))
        Case $JoinSpec
            
        Case $GUI_EVENT_CLOSE
            _closeWindows ( )
    EndSwitch
WEnd

Func _closeWindows ( )
    If $CurrentWindow = "Main" Then
        Exit
    ElseIf $CurrentWindow = "Configuration" Then
        GUISetState ( @SW_HIDE, $ConfigInterface )
        Sleep ( 200 )
        GUISetState ( @SW_SHOW, $Interface )
        $CurrentWindow = "Main"
    ElseIf $CurrentWindow = "AddServer" Then
        GUISetState ( @SW_HIDE, $AddServerGui )
        Sleep ( 200 )
        GUISetState ( @SW_SHOW, $Interface )
        $CurrentWindow = "Main"
    EndIf   
EndFunc

Func _uniqueIDGen ( )
    $UniqueIDGen = ""
    Do
        $Gamble = Random ( )
        If $Gamble < 0.5 Then
            $Rand = Random ( 65, 122, 1 )
            $Char = Chr ( $Rand )
        Else
            $Rand = Random ( 48, 57, 1 )
            $Char = Chr ( $Rand )
        EndIf
        $UniqueIDGen &= $Char
    Until StringLen ( $UniqueIDGen ) = 8
    Return $UniqueIDGen
EndFunc

Func _charNameCombo ( $Race )
    _GUICtrlComboBox_ResetContent ( $CharacterName )
    If $Race = "Default" Then
        GUICtrlSetState ( $CharacterName, $GUI_DISABLE )
    Else
        GUICtrlSetState ( $CharacterName, $GUI_ENABLE )
    EndIf
    If $Race = "Skaarj" Then
        GUICtrlSetData ( $CharacterName, "Mekkor|Skrilax|Dominator|Drekorig|Skakruk|Guardian|Kraagesh|Gaargod|Gkublok" )
    ElseIf $Race = "Metalguard" Then
        GUICtrlSetData ( $CharacterName, "Barktooth|Karag" )
    ElseIf $Race = "Necris" Then
        GUICtrlSetData ( $CharacterName, "Kragoth|Thannis" )
    ElseIf $Race = "Thundercrash" Then
        GUICtrlSetData ( $CharacterName, "Jakob|Aryss|Tamika|Othello|Azure|Annika|Riker" )
    ElseIf $Race = "Mercenary" Then
        GUICtrlSetData ( $CharacterName, "Brock|Lauren|Prism|Wraith|Sapphire|Romulus|BlackJack|Torch|Satin|Remus" )
    ElseIf $Race = "Egyptian" Then
        GUICtrlSetData ( $CharacterName, "Diva|Scarab|Asp|Roc|Memphis|Horus|Cleopatra|Hyena" )
    ElseIf $Race = "Juggernaut" Then
        GUICtrlSetData ( $CharacterName, "Gorge|Rylissa|Cannonball|Ambrosia|Frostbite|Reinha|Arclite|Siren" )
    ElseIf $Race = "Gen Mo'Kai" Then
        GUICtrlSetData ( $CharacterName, "Damarus|Mokara|Motig|Faraleth|Komek|Makreth|Selig|Nebri" )
    ElseIf $Race = "Robot" Then
        GUICtrlSetData ( $CharacterName, "Thorax|Widowmaker|Cobalt|Corrosion|Mandible|Syzygy|Rapier|Renegade" )
    ElseIf $Race = "Nightmare" Then
        GUICtrlSetData ( $CharacterName, "Brutalis|Lilith|Mr.Crow|Domina|Ravage|Fate|Harlequin|Subversa|Abaddon" )
    ElseIf $Race = "Cybernetic" Then
        GUICtrlSetData ( $CharacterName, "Virus|Enigma|Cyclops|Cathode|Axon|Divisor|Matrix" )
    ElseIf $Race = "Hellions" Then
        GUICtrlSetData ( $CharacterName, "Garret|Baird|Greith|Zarina|Ophelia|Kaela|Rae|Kane|Outlaw" )
    EndIf
    _GUICtrlComboBox_SetCurSel ( $CharacterName, 0 )
EndFunc

Func _saveConfig ( )
    IniWrite ( $IniDir, "General", "StartWithWin", GUICtrlRead ( $StartWithWin ) )
    IniWrite ( $IniDir, "General", "StartWithWinHide", GUICtrlRead ( $StartWithWinHide ) )
    IniWrite ( $IniDir, "General", "HideToTrayClose", GUICtrlRead ( $HideToTrayClose ) )
    IniWrite ( $IniDir, "General", "ConfirmDialogs", GUICtrlRead ( $ConfirmDialogs ) )
    IniWrite ( $IniDir, "General", "StayOnTop", GUICtrlRead ( $StayOnTop ) )
    If IniRead ( $IniDir, "General", "StayOnTop", "" ) = 1 Then
        WinSetOnTop ( $Title & " " & $Version & " by " & $Nickname, "", 1 )
    Else
        WinSetOnTop ( $Title & " " & $Version & " by " & $Nickname, "", 0 )
    EndIf
    IniWrite ( $IniDir, "AddServer", "RemembIP", GUICtrlRead ( $RemembIP ) )
    IniWrite ( $IniDir, "AddServer", "RemembPort", GUICtrlRead ( $RemembPort ) )
    IniWrite ( $IniDir, "AddServer", "RemembServerTag", GUICtrlRead ( $RemembServerTag ) )
    IniWrite ( $IniDir, "AddServer", "RemembTeam", GUICtrlRead ( $RemembTeam ) )
    IniWrite ( $IniDir, "AddServer", "RemembRace", GUICtrlRead ( $RemembRace ) )
    IniWrite ( $IniDir, "AddServer", "RemembName", GUICtrlRead ( $RemembName ) )
EndFunc
Link to comment
Share on other sites

Mixing the built-in functions with UDF functions has caused me grief more than once. You might try using _GUICtrlListView_Create() instead of GUICtrlCreateListView().

Edit: Although I do see the help example mixes the two and appears to work...

Edited by Spiff59
Link to comment
Share on other sites

I think that code should always delete the first item since indexing starts at 0. Try _GUICtrlListView_DeleteItemsSelected() instead or get the correct index and use the same function you already use.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I already tried _GUICtrlListView_DeleteItemsSelected() which also doesn't work.

I'm now trying _GUICtrlListView_Create()...

//EDIT, it now works but the listview looks ugly in Windows 7...

It has no border?

Edited by Rawox
Link to comment
Share on other sites

I should have remembered this because it annoyed me to no end. You can do this with the standard ListView control but it will probably have to use the single select style.

$iItem = Number(_GUICtrlListView_GetSelectedIndices($List))
_GUICtrlListView_DeleteItem($List, $iItem)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Weird combinations...

If you go back to the built-in GUICtrlCreateListView(), and use the built-in to load the ListView, something like:

$taText = IniRead ( $IniDir, "Servers", $CurrentItem, "" )
GUICtrlCreateListViewItem($taText, $List)

Then the ListView looks decent, and _GUICtrlListView_DeleteItem seems to behave fairly well.

Link to comment
Share on other sites

Weird combinations...

If you go back to the built-in GUICtrlCreateListView(), and use the built-in to load the ListView, something like:

$taText = IniRead ( $IniDir, "Servers", $CurrentItem, "" )
GUICtrlCreateListViewItem($taText, $List)

Then the ListView looks decent, and _GUICtrlListView_DeleteItem seems to behave fairly well.

It took a while for me to remember that I had to use Number() on the selectedindeces and without it nothing worked right.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Weird combinations...

If you go back to the built-in GUICtrlCreateListView(), and use the built-in to load the ListView, something like:

$taText = IniRead ( $IniDir, "Servers", $CurrentItem, "" )
GUICtrlCreateListViewItem($taText, $List)

Then the ListView looks decent, and _GUICtrlListView_DeleteItem seems to behave fairly well.

Thanks Spiff! That worked :idea:
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...