Jump to content
Sign in to follow this  
Drew

On Double Click

Recommended Posts

Drew

I have a GUICtrlCreateList , and when I double click one of its entries... I need it to do something.

I have NO idea how to go about this , and can't find any support in the Helpfile.

Please help if you can ,

*Drew

Share this post


Link to post
Share on other sites
smashly

Hi, modified example from the help file under "User Defined Functions -> GuiListBox Mangement -> _GUICtrlListBox_Create"..

#include <GUIListBox.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Global $DoubleClicked

$hGUI = GUICreate("List Double Click..", 400, 296)
$List = GUICtrlCreateList("", 2, 2, 396, 296)
GUICtrlSetData(-1, "Item 1|Item 2|Item 3|Item 4|Item 5")
GUISetState(@SW_SHOW, $hGUI)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else   
            If $DoubleClicked Then
                MsgBox(0, "Double Clicked!", "Item text: " & GUICtrlRead($List))
                $DoubleClicked = 0
            EndIf
    EndSwitch
WEnd    

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
    If Not IsHWnd($List) Then $hWndListBox = GUICtrlGetHandle($List)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF)
    $iCode = BitShift($iwParam, 16)

    Switch $hWndFrom
        Case $hWndListBox
            Switch $iCode
                Case $LBN_DBLCLK
                    If Not $DoubleClicked Then $DoubleClicked = 1
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Cheers

Share this post


Link to post
Share on other sites
YellowLab

And for those of us who use Opt("GUIOnEventMode", 1) - you shouldn't run user defined functions from the registered function (see the help file for more info) - here is a solution:

CODE
#include <GUIListBox.au3>

#include <GuiConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Constants.au3>

Opt("GUIOnEventMode", 1)

Global $DoubleClicked

$hGUI = GUICreate("List Double Click..", 400, 296)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$List = GUICtrlCreateList("", 2, 2, 396, 296)

GUICtrlSetData(-1, "Item 1|Item 2|Item 3|Item 4|Item 5")

GUISetState(@SW_SHOW, $hGUI)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1

Sleep(25)

If $DoubleClicked Then _ListDoubleClick()

WEnd

Func _Exit()

Exit

EndFunc

Func _ListDoubleClick()

MsgBox(0, "Double Clicked!", "Item text: " & GUICtrlRead($List))

$DoubleClicked=0

EndFunc

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)

#forceref $hWnd, $iMsg

Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox

If Not IsHWnd($List) Then $hWndListBox = GUICtrlGetHandle($List)

$hWndFrom = $ilParam

$iIDFrom = BitAND($iwParam, 0xFFFF)

$iCode = BitShift($iwParam, 16)

Switch $hWndFrom

Case $hWndListBox

Switch $iCode

Case $LBN_DBLCLK

If Not $DoubleClicked Then $DoubleClicked = 1

EndSwitch

EndSwitch

Return $GUI_RUNDEFMSG

EndFunc

Bob


You can't see a rainbow without first experiencing the rain.

Share this post


Link to post
Share on other sites
Drew

Alright , I'm having a ton of trouble putting this into my script and it work... Here are some errors I'm getting:

1. $WM_Command possibly used before declaration.

2. I've done something to the loop to where now when I click the X on the GUI , it doesn't close...

and well... 3 is the fact when I double click them nothing happens. ( I'm sure this is to blame on #1. )

If someone could help me out , its greatly appreciated. I've commented throughout my script to make it clear to me what's editted etc, It will show where I inputted my attempts to add this feature to my script. ( I will also try to put some things in bold or something. )

Notes:

;Start and ;End are places where I added in the code ( I went with YellowLabs )... and ;Start Eddited Doubles is when I'm edditing your code to suit my needs. ( I have a tab with 3 sections... a list on each. It would need to know which tab is active I think. ( Maybe I'm wrong. )

But I've done all I know to try, but I don't understand how your codes work so I ran out of ideas quickly. =/.

#include <GUIConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIListBox.au3>
#include <array.au3>
#include <GUIListBox.au3>
#include <Constants.au3>
Opt("GUIOnEventMode", 1)

Global $CashVar, $FamVar, $EneVar, $DoubleClicked, $WM_COMMAND

#region ### START Koda GUI section ### Form=c:\documents and settings\dreu\desktop\id tool\form1_1.kxf
$Form1_1 = GUICreate("Don Vinnie Corleones ID Tool - V1.2", 631, 260, 220, 156)
$AddRadio = GUICtrlCreateRadio("Quick Add", 280, 56, 153, 25)
$AttackRadio = GUICtrlCreateRadio("Attack Link", 280, 96, 153, 33)
$Edit1 = GUICtrlCreateEdit("", 8, 136, 345, 113)
GUICtrlSetData(-1, "")
$Go = GUICtrlCreateButton("Go", 368, 168, 65, 81, 0)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$EnterID = GUICtrlCreateInput("Enter ID Here", 56, 104, 209, 21)
$ID = GUICtrlCreateLabel("ID", 16, 96, 29, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("The Corleone", 56, 8, 197, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Family", 104, 56, 98, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Add = GUICtrlCreateButton("Add", 448, 216, 81, 33, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Tab1 = GUICtrlCreateTab(448, 16, 169, 185)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$CashTab = GUICtrlCreateTabItem("Cash Cows")
$CashList = GUICtrlCreateList("", 456, 48, 160, 136)
$EnemiesTab = GUICtrlCreateTabItem("Enemies")
GUICtrlSetState(-1, $GUI_SHOW)
$EnemiesList = GUICtrlCreateList("", 456, 48, 160, 136)
$FamilyTab = GUICtrlCreateTabItem("Family")
$FamilyList = GUICtrlCreateList("", 456, 48, 160, 136)
GUICtrlCreateTabItem("")
$Delete = GUICtrlCreateButton("Delete", 536, 216, 81, 33, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
;[b]start double[/b]
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
;[b]end[/b]
#endregion ### START Koda GUI section ### Form=c:\documents and settings\dreu\desktop\id tool\form1_1.kxf


_Startup_Enemies()
_Startup_Family()
_Startup_CashCows()

While 1
    $nMsg = GUIGetMsg()
;[b]start[/b]
    If $DoubleClicked Then _ListDoubleClick()
;[b]end[/b]
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Go
            If GUICtrlRead($AddRadio) = $GUI_CHECKED Then
            ;Do stuff for quick add --- DONE
                $read = GUICtrlRead($EnterID)
                ClipPut('<a href="http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=' & $read & '">Quick Add</a>')
                GUICtrlSetData($Edit1, '<a href="http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=' & $read & '">Quick Add</a>')
                GUICtrlSetData($EnterID, "")
            ElseIf GUICtrlRead($AttackRadio) = $GUI_CHECKED Then
            ;Do stuff for quick attack
                $read = GUICtrlRead($EnterID)
                ClipPut("http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283&appParams={%22show_user_id%22%3A%22" & $read & "%22}")
                GUICtrlSetData($Edit1, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283&appParams={%22show_user_id%22%3A%22" & $read & "%22}")
                GUICtrlSetData($EnterID, "")
            Else
                MsgBox(0, "Error", "Niether of the options are checked. Please choose one and press Go.")
            EndIf
        Case $Add
            #region ### START Koda GUI section ### Form=
            $Entry = GUICreate("Add an Entry", 358, 121, 243, 176)
            $NameLabel = GUICtrlCreateLabel("Name:", 16, 8, 65, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $IDLabel = GUICtrlCreateLabel("ID:", 16, 40, 29, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $LvlLabel = GUICtrlCreateLabel("Lvl:", 16, 72, 36, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $Name = GUICtrlCreateInput("Name", 88, 8, 137, 21)
            $ID = GUICtrlCreateInput("ID", 88, 40, 137, 21)
            $Lvl = GUICtrlCreateInput("Lvl", 88, 72, 137, 21)
            $Help = GUICtrlCreateButton("HELP", 240, 8, 105, 41)
            GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
            $Add2 = GUICtrlCreateButton("Add Entry", 240, 56, 105, 41, 0)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            GUISetState(@SW_SHOW)
            #endregion ### START Koda GUI section ### Form=
            $WhichTab = GUICtrlRead($Tab1)
            If $WhichTab = 0 Then
                $WhichTab = $CashList
                $IniFile = @ScriptDir & "\CashCows.ini"
            ElseIf $WhichTab = 1 Then
                $WhichTab = $EnemiesList
                $IniFile = @ScriptDir & "\Enemies.ini"
            ElseIf $WhichTab = 2 Then
                $WhichTab = $FamilyList
                $IniFile = @ScriptDir & "\Family.ini"
            EndIf
            While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($Entry)
                        ExitLoop
                    Case $Help
                    ;do stuff to help
                        MsgBox( 0, "Help", "In the appropriate boxes , enter the information accordingly. Enter the name how you wish it to be displayed, and enter the ID without the '22' at the beginning. ( Look in the ReadMe for a more indepth on this.)")
                    Case $Add2
                    ;do stuff to add
                        $Name = GuiCtrlRead( $Name )
                        $Lvl = GuiCtrlRead( $Lvl )
                        $ID = GuiCtrlRead( $ID )
                        IniWriteSection($IniFile, $Name, "Lvl=" & $Lvl& @LF&"ID=" & $ID)
                        _GUICtrlListBox_AddString( $WhichTab, $Name & " ( " & $Lvl & " ) " & "ID: " & $ID)
                        GUIDelete($Entry)
                        ExitLoop
                EndSwitch
            WEnd
            
        Case $Delete
            $WhichTab = GUICtrlRead($Tab1)
            If $WhichTab = 0 Then
                $WhichTab = $CashList
                $IniFile = @ScriptDir & "\CashCows.ini"
            ElseIf $WhichTab = 1 Then
                $WhichTab = $EnemiesList
                $IniFile = @ScriptDir & "\Enemies.ini"
            ElseIf $WhichTab = 2 Then
                $WhichTab = $FamilyList
                $IniFile = @ScriptDir & "\Family.ini"
            EndIf
            $WhichTabNum = _GUICtrlListBox_GetCurSel($WhichTab)
            $TextTab = _GUICtrlListBox_GetText($WhichTab, $WhichTabNum)
            $tbfs = StringLeft($TextTab, StringInStr($TextTab, Chr(32)) - 1)
            IniDelete($IniFile, $tbfs)
            _GUICtrlListBox_DeleteString($WhichTab, $WhichTabNum)
    EndSwitch
WEnd

Func _Startup_Enemies()
    $IniFile = @ScriptDir & "\Enemies.ini"
    $EneVar = IniReadSectionNames($IniFile)
    If @error Then
        MsgBox(4096, "", "Error occurred, probably no INI file.")
    Else
        For $i = 1 To $EneVar[0]
            $Lvl = IniRead($IniFile, $EneVar[$i], "Lvl", "Default")
            $ID = IniRead($IniFile, $EneVar[$i], "ID", "Default")
            _GUICtrlListBox_AddString($EnemiesList, $EneVar[$i] & " ( " & $Lvl & " ) " & "ID: " & $ID)
        Next
    EndIf
EndFunc  ;==>_Startup_Enemies
Func _Startup_CashCows()
    $IniFile = @ScriptDir & "\CashCows.ini"
    $CashVar = IniReadSectionNames(@ScriptDir & "\Cashcows.ini")
    If @error Then
        MsgBox(4096, "", "Error occurred, probably no INI file.")
    Else
        For $i = 1 To $CashVar[0]
            $Section = IniReadSection($IniFile, $CashVar[$i])
            $Lvl = IniRead($IniFile, $CashVar[$i], "Lvl", "Default")
            $ID = IniRead($IniFile, $CashVar[$i], "ID", "Default")
            _GUICtrlListBox_AddString($CashList, $CashVar[$i] & " ( " & $Lvl & " ) " & "ID: " & $ID)
        Next
    EndIf
EndFunc  ;==>_Startup_CashCows
Func _Startup_Family()
    $IniFile = @ScriptDir & "\Family.ini"
    $FamVar = IniReadSectionNames(@ScriptDir & "\Family.ini")
    If @error Then
        MsgBox(4096, "", "Error occurred, probably no INI file.")
    Else
        For $i = 1 To $FamVar[0]
            $Section = IniReadSection($IniFile, $FamVar[$i])
            $Lvl = IniRead($IniFile, $FamVar[$i], "Lvl", "Default")
            $ID = IniRead($IniFile, $FamVar[$i], "ID", "Default")
            _GUICtrlListBox_AddString($FamilyList, $FamVar[$i] & " ( " & $Lvl & " ) " & "ID: " & $ID)
        Next
    EndIf
EndFunc  ;==>_Startup_Family

;Start Double Funcs

Func _Exit()
Exit
EndFunc

Func _ListDoubleClick()
;[b]start edditted double[/b]
    $WhichTab = GUICtrlRead($Tab1)
            If $WhichTab = 0 Then
                $WhichTab = $CashList
                $IniFile = @ScriptDir & "\CashCows.ini"
            ElseIf $WhichTab = 1 Then
                $WhichTab = $EnemiesList
                $IniFile = @ScriptDir & "\Enemies.ini"
            ElseIf $WhichTab = 2 Then
                $WhichTab = $FamilyList
                $IniFile = @ScriptDir & "\Family.ini"
            EndIf
;[b]end[/b]
MsgBox(0, "Double Clicked!", "Item text: " & GUICtrlRead($WhichTab))
$DoubleClicked=0
EndFunc

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg
Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox
;[b]start editted doubles[/b]
$WhichTab = GUICtrlRead($Tab1)
            If $WhichTab = 0 Then
                $WhichTab = $CashList
                $IniFile = @ScriptDir & "\CashCows.ini"
            ElseIf $WhichTab = 1 Then
                $WhichTab = $EnemiesList
                $IniFile = @ScriptDir & "\Enemies.ini"
            ElseIf $WhichTab = 2 Then
                $WhichTab = $FamilyList
                $IniFile = @ScriptDir & "\Family.ini"
            EndIf
;[b]end edit[/b]
If Not IsHWnd($WhichTab) Then $hWndListBox = GUICtrlGetHandle($WhichTab)
$hWndFrom = $ilParam
$iIDFrom = BitAND($iwParam, 0xFFFF)
$iCode = BitShift($iwParam, 16)

Switch $hWndFrom
Case $hWndListBox
Switch $iCode
Case $LBN_DBLCLK
If Not $DoubleClicked Then $DoubleClicked = 1
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
Edited by Drew

Share this post


Link to post
Share on other sites
smashly

Alright , I'm having a ton of trouble putting this into my script and it work... Here are some errors I'm getting:

1. $WM_Command possibly used before declaration.

2. I've done something to the loop to where now when I click the X on the GUI , it doesn't close...

and well... 3 is the fact when I double click them nothing happens. ( I'm sure this is to blame on #1. )

Hi, I probably broke some things I'm not sure.

Edit: Changed your ini loading into 1 function instead of 3 functions.

#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GUIListBox.au3>
#include <array.au3>
#include <GUIListBox.au3>
#include <Constants.au3>

Global $CashVar, $FamVar, $EneVar, $DoubleClicked = -1
Global $Ini[3] = [@ScriptDir & "\CashCows.ini", @ScriptDir & "\Enemies.ini", @ScriptDir & "\Family.ini"]
Global $List[3]

#Region ### START Koda GUI section ### Form=c:\documents and settings\dreu\desktop\id tool\form1_1.kxf
$Form1_1 = GUICreate("Don Vinnie Corleones ID Tool - V1.2", 631, 260, 220, 156)
$AddRadio = GUICtrlCreateRadio("Quick Add", 280, 56, 153, 25)
$AttackRadio = GUICtrlCreateRadio("Attack Link", 280, 96, 153, 33)
$Edit1 = GUICtrlCreateEdit("", 8, 136, 345, 113)
GUICtrlSetData(-1, "")
$Go = GUICtrlCreateButton("Go", 368, 168, 65, 81, 0)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$EnterID = GUICtrlCreateInput("Enter ID Here", 56, 104, 209, 21)
$ID = GUICtrlCreateLabel("ID", 16, 96, 29, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("The Corleone", 56, 8, 197, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Family", 104, 56, 98, 41)
GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif")
$Add = GUICtrlCreateButton("Add", 448, 216, 81, 33, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Tab1 = GUICtrlCreateTab(448, 16, 169, 185)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$CashTab = GUICtrlCreateTabItem("Cash Cows")
$List[0] = GUICtrlCreateList("", 456, 48, 160, 136)
$EnemiesTab = GUICtrlCreateTabItem("Enemies")
GUICtrlSetState(-1, $GUI_SHOW)
$List[1] = GUICtrlCreateList("", 456, 48, 160, 136)
$FamilyTab = GUICtrlCreateTabItem("Family")
$List[2] = GUICtrlCreateList("", 456, 48, 160, 136)
GUICtrlCreateTabItem("")
$Delete = GUICtrlCreateButton("Delete", 536, 216, 81, 33, 0)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)


GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

#EndRegion ### START Koda GUI section ### Form=c:\documents and settings\dreu\desktop\id tool\form1_1.kxf


_LoadIni()

While 1
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Go
            If GUICtrlRead($AddRadio) = $GUI_CHECKED Then
                ;Do stuff for quick add --- DONE
                $read = GUICtrlRead($EnterID)
                ClipPut('<a href="http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=' & $read & '">Quick Add</a>')
                GUICtrlSetData($Edit1, '<a href="http://friends.myspace.com/index.cfm?fuseaction=invite.addfriend_verify&friendID=' & $read & '">Quick Add</a>')
                GUICtrlSetData($EnterID, "")
            ElseIf GUICtrlRead($AttackRadio) = $GUI_CHECKED Then
                ;Do stuff for quick attack
                $read = GUICtrlRead($EnterID)
                ClipPut("http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283&appParams={%22show_user_id%22%3A%22" & $read & "%22}")
                GUICtrlSetData($Edit1, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283&appParams={%22show_user_id%22%3A%22" & $read & "%22}")
                GUICtrlSetData($EnterID, "")
            Else
                MsgBox(0, "Error", "Niether of the options are checked. Please choose one and press Go.")
            EndIf
        Case $Add
            #Region ### START Koda GUI section ### Form=
            $Entry = GUICreate("Add an Entry", 358, 121, 243, 176)
            $NameLabel = GUICtrlCreateLabel("Name:", 16, 8, 65, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $IDLabel = GUICtrlCreateLabel("ID:", 16, 40, 29, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $LvlLabel = GUICtrlCreateLabel("Lvl:", 16, 72, 36, 28)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            $Name = GUICtrlCreateInput("Name", 88, 8, 137, 21)
            $ID = GUICtrlCreateInput("ID", 88, 40, 137, 21)
            $Lvl = GUICtrlCreateInput("Lvl", 88, 72, 137, 21)
            $Help = GUICtrlCreateButton("HELP", 240, 8, 105, 41)
            GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
            $Add2 = GUICtrlCreateButton("Add Entry", 240, 56, 105, 41, 0)
            GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
            GUISetState(@SW_SHOW)
            #EndRegion ### START Koda GUI section ### Form=
            $WhichTab = $List[GUICtrlRead($Tab1)]
            $IniFile = $Ini[GUICtrlRead($Tab1)]
            While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                    Case $GUI_EVENT_CLOSE
                        GUIDelete($Entry)
                        ExitLoop
                    Case $Help
                        ;do stuff to help
                        MsgBox(0, "Help", "In the appropriate boxes , enter the information accordingly. Enter the name how you wish it to be displayed, and enter the ID without the '22' at the beginning. ( Look in the ReadMe for a more indepth on this.)")
                    Case $Add2
                        ;do stuff to add
                        $Name = GUICtrlRead($Name)
                        $Lvl = GUICtrlRead($Lvl)
                        $ID = GUICtrlRead($ID)
                        IniWriteSection($IniFile, $Name, "Lvl=" & $Lvl & @LF & "ID=" & $ID)
                        _GUICtrlListBox_AddString($WhichTab, $Name & " ( " & $Lvl & " ) " & "ID: " & $ID)
                        GUIDelete($Entry)
                        ExitLoop
                EndSwitch
            WEnd

        Case $Delete
            $WhichTab = $List[GUICtrlRead($Tab1)]
            $IniFile = $Ini[GUICtrlRead($Tab1)]
            $WhichTabNum = _GUICtrlListBox_GetCurSel($WhichTab)
            $TextTab = _GUICtrlListBox_GetText($WhichTab, $WhichTabNum)
            $tbfs = StringLeft($TextTab, StringInStr($TextTab, Chr(32)) - 1)
            IniDelete($IniFile, $tbfs)
            _GUICtrlListBox_DeleteString($WhichTab, $WhichTabNum)
        Case Else
            If $DoubleClicked <> -1 Then _ListDoubleClick($DoubleClicked)
    EndSwitch
WEnd

Func _LoadIni()
    For $i = 0 To UBound($Ini) - 1
        Local $FamVar = IniReadSectionNames($Ini[$i])
        If @error Then
            MsgBox(4096, "Error occurred", 'Trying to read: "' & $Ini[$i] & '". Probably no INI file.')
        Else
            For $j = 1 To $FamVar[0]
                Local $Section, $Lvl, $ID
                $Section = IniReadSection($Ini[$i], $FamVar[$j])
                $Lvl = IniRead($Ini[$i], $FamVar[$j], "Lvl", "Default")
                $ID = IniRead($Ini[$i], $FamVar[$j], "ID", "Default")
                _GUICtrlListBox_AddString($List[$i], $FamVar[$j] & " ( " & $Lvl & " ) " & "ID: " & $ID)
            Next
        EndIf
    Next
EndFunc   ;==>_LoadIni

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _ListDoubleClick($iClick)
    $IniFile = $Ini[$iClick]
    $DoubleClicked = -1
    MsgBox(0, "Double Clicked!", "Item text: " & GUICtrlRead($List[$iClick]))
EndFunc   ;==>_ListDoubleClick

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode, $hCashList, $hEnemiesList, $hFamilyList

    If Not IsHWnd($List[0]) Then $hCashList = GUICtrlGetHandle($List[0])
    If Not IsHWnd($List[1]) Then $hEnemiesList = GUICtrlGetHandle($List[1])
    If Not IsHWnd($List[2]) Then $hFamilyList = GUICtrlGetHandle($List[2])
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF)
    $iCode = BitShift($iwParam, 16)

    Switch $hWndFrom
        Case $hCashList, $hEnemiesList, $hFamilyList
            Switch $iCode
                Case $LBN_DBLCLK
                    Switch $hWndFrom
                        Case $hCashList
                            $DoubleClicked = 0
                        Case $hEnemiesList
                            $DoubleClicked = 1
                        Case $hFamilyList
                            $DoubleClicked = 2
                    EndSwitch
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.