EditLabel in einer ListView

  • Hallo,

    wenn ich einen ListViewItem editierbar mache, was eingebe und Enter drücke wird das neue Wert nicht übernommen.
    Hier ein Teil des Codes:

    [autoit]

    Switch $idFrom
    Case $ListView4
    Switch $code
    Case $LVN_ENDLABELEDIT, $LVN_ENDLABELEDITW
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView4)
    If $getselectedplugin1 = -1 Then
    Else
    MsgBox(0,"","")
    EndIf
    EndSwitch
    EndSwitch

    [/autoit]
    • Offizieller Beitrag

    Dafür hat BugFix das passende geschrieben . Schau mal hier ListView - Editieren aller SubItems. :thumbup:

    • Offizieller Beitrag

    Hi,

    wenn ich das Debugging hinzufüge, dann geht es zumindest einmal Mal :)

    Mal sehen woran es liegt

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.0.0
    Author: Burak Keskin

    Script Function:
    Template AutoIt script.

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <GuiImageList.au3>
    #include <GuiListView.au3>
    #include <Constants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Form1", 633, 449)
    $ListView1 = GUICtrlCreateListView("", 9, 40, 615, 401)
    GUICtrlSetStyle($ListView1, $LVS_ICON + $LVS_EDITLABELS, $LVS_EX_DOUBLEBUFFER)

    [/autoit] [autoit][/autoit] [autoit]

    $hImage = _GUIImageList_Create(48, 48, 5, 1) ; Icons 32x32, Farbtiefe 5: 32bit, 1: verwende Transparenz)
    _GUIImageList_AddIconSize($hImage, "Folder.ico", 48)
    _GUICtrlListView_SetImageList($ListView1, $hImage, 0)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlListView_AddItem($ListView1, "Ordner", 0)

    [/autoit] [autoit][/autoit] [autoit]

    $Button1 = GUICtrlCreateButton("Zurück", 8, 8, 75, 25, 0)
    $Button2 = GUICtrlCreateButton("Vor", 88, 8, 75, 25, 0)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $ContextMenu = GUICtrlCreateContextMenu($ListView1)
    $New_Folder = GUICtrlCreateMenuItem("Neuer Ordner", $ContextMenu)
    $Delete_Folder = GUICtrlCreateMenuItem("Ordner löschen", $ContextMenu)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button1

    [/autoit] [autoit][/autoit] [autoit]

    Case $Button2

    [/autoit] [autoit][/autoit] [autoit]

    Case $New_Folder
    _GUICtrlListView_AddItem($ListView1, "Neuer Ordner", 0)
    $hedit = _GUICtrlListView_EditLabel($ListView1, _GUICtrlListView_GetItemCount($ListView1) - 1)
    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    [/autoit] [autoit][/autoit] [autoit]

    Case $Delete_Folder
    $IndexNumber = _GUICtrlListView_GetSelectionMark($ListView1)
    _GUICtrlListView_DeleteItem(ControlGetHandle("", "", $ListView1), $IndexNumber)

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ;By progandy
    Func _GUIImageList_AddIconSize($hWnd, $sFile, $iSize = 32)
    Local $tIcon, $iResult, $hIcon
    $hIcon = _WinAPI_LoadImage(0, $sFile, $IMAGE_ICON, $iSize, $iSize, $LR_LOADFROMFILE)
    _WinAPI_Check("_GUIImageList_AddIcon", ($hIcon = 0), -1)
    $iResult = _GUIImageList_ReplaceIcon($hWnd, -1, $hIcon)
    _WinAPI_Check("_GUIImageList_AddIcon", ($iResult = -1), -2)
    _WinAPI_DestroyIcon($hIcon)
    Return $iResult
    EndFunc ;==>_GUIImageList_AddIconSize

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $ListView1
    If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)

    [/autoit] [autoit][/autoit] [autoit]

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_BEGINLABELEDIT, $LVN_BEGINLABELEDITW ; Start of label editing for an item
    $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
    _DebugPrint("$LVN_BEGINLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
    "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
    "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
    "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
    "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
    "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
    "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
    "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
    "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
    Return False ; Allow the user to edit the label
    ;Return True ; Prevent the user from editing the label
    Case $LVN_COLUMNCLICK ; A column was clicked
    $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
    _DebugPrint("$LVN_COLUMNCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
    ; No return value
    Case $LVN_DELETEITEM ; An item is about to be deleted
    $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam)
    _DebugPrint("$LVN_DELETEITEM" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->Param:" & @TAB & DllStructGetData($tInfo, "Param"))
    ; No return value
    Case $LVN_ENDLABELEDIT, $LVN_ENDLABELEDITW ; The end of label editing for an item
    $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
    Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
    _DebugPrint("$LVN_ENDLABELEDIT" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Mask:" & @TAB & DllStructGetData($tInfo, "Mask") & @LF & _
    "-->Item:" & @TAB & DllStructGetData($tInfo, "Item") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->State:" & @TAB & DllStructGetData($tInfo, "State") & @LF & _
    "-->StateMask:" & @TAB & DllStructGetData($tInfo, "StateMask") & @LF & _
    "-->Text:" & @TAB & DllStructGetData($tBuffer, "Text") & @LF & _
    "-->TextMax:" & @TAB & DllStructGetData($tInfo, "TextMax") & @LF & _
    "-->Image:" & @TAB & DllStructGetData($tInfo, "Image") & @LF & _
    "-->Param:" & @TAB & DllStructGetData($tInfo, "Param") & @LF & _
    "-->Indent:" & @TAB & DllStructGetData($tInfo, "Indent") & @LF & _
    "-->GroupID:" & @TAB & DllStructGetData($tInfo, "GroupID") & @LF & _
    "-->Columns:" & @TAB & DllStructGetData($tInfo, "Columns") & @LF & _
    "-->pColumns:" & @TAB & DllStructGetData($tInfo, "pColumns"))
    ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
    ; If Text is empty the return value is ignored
    If StringLen(DllStructGetData($tBuffer, "Text")) Then Return True
    Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
    ; No return value
    Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
    ; No return value
    Case $NM_KILLFOCUS ; The control has lost the input focus
    _DebugPrint("$NM_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; No return value
    Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
    ;Return 1 ; not to allow the default processing
    Return 0 ; allow the default processing
    Case $NM_RDBLCLK ; Sent by a list-view control when the user double-clicks an item with the right mouse button
    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
    _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode & @LF & _
    "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _
    "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _
    "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _
    "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _
    "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _
    "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _
    "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _
    "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _
    "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags"))
    ; No return value
    Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key
    _DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; No return value
    Case $NM_SETFOCUS ; The control has received the input focus
    _DebugPrint("$NM_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; No return value
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

    [/autoit] [autoit][/autoit] [autoit]

    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]

    Mega

  • Also, wenn die Änderung akzepiert wird, muss man True zurückgeben und nicht $GUI_RUNDEFMSG ;)

    Spoiler anzeigen
    [autoit]

    Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
    $hWndListView = $ListView1
    If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)

    [/autoit] [autoit][/autoit] [autoit]

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
    Case $hWndListView
    Switch $iCode
    Case $LVN_ENDLABELEDIT, $LVN_ENDLABELEDITW ; The end of label editing for an item
    $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
    Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
    ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
    ; If Text is empty the return value is ignored
    Return StringLen(DllStructGetData($tBuffer, "Text")) > 0
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_NOTIFY

    [/autoit]
  • Wieso funktioniert es hier nicht:

    Spoiler anzeigen
    [autoit]

    Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    Local $tNMTOOLBAR, $tNMTBHOTITEM, $tInfo
    $hWndListView = $ListView4
    If Not IsHWnd($ListView4) Then $hWndListView = GUICtrlGetHandle($ListView4)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
    Case $hToolbar
    Switch $code
    Case $NM_CLICK
    $tNMACTIVE = DllStructCreate($tagNMITEMACTIVATE, $lParam)
    $iItem = DllStructGetData($tNMACTIVE, "Index")
    If $iItem = -1 Then Return $GUI_RUNDEFMSG
    Switch _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem)
    Case 0
    GUICtrlSendToDummy($Dummy1)
    Case 1
    GUICtrlSendToDummy($Dummy2)
    Case 3
    GUICtrlSendToDummy($Dummy3)
    Case 4
    GUICtrlSendToDummy($Dummy4)
    Case 5
    GUICtrlSendToDummy($Dummy5)
    Case 7
    GUICtrlSendToDummy($Dummy6)
    Case 8
    GUICtrlSendToDummy($Dummy7)
    Case 9
    GUICtrlSendToDummy($Dummy8)
    Case 10
    GUICtrlSendToDummy($Dummy9)
    Case 11
    GUICtrlSendToDummy($Dummy10)
    Case 12
    GUICtrlSendToDummy($Dummy11)
    Case 13
    GUICtrlSendToDummy($Dummy12)
    EndSwitch
    Case $TBN_HOTITEMCHANGE
    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
    $iItem = $i_idNew
    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
    EndSwitch
    EndSwitch
    Switch $idFrom
    Case $ListView1
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView1)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemText($ListView1, $getselectedplugin1)
    If $Selected_Item = "Radiosender" Then
    GUICtrlSetState($ListView2, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Enable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Radiosender"
    ElseIf $Selected_Item = "Musik" Then
    GUICtrlSetState($ListView3, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Enable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Musik"
    ElseIf $Selected_Item = "Favouriten" Then
    GUICtrlSetState($ListView4, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Disable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Favouriten"
    EndIf
    EndIf
    EndSelect
    Case $ListView2
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView2)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemTextArray($ListView2)
    _SendData('New_Media("' & $Selected_Item[4] & '"', $Remote_ReceiverID_Name)
    _SendData('_SetStatus("Play")', $Remote_ReceiverID_Name)
    _SendData('SetChannel("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    EndIf
    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    Case $ListView3
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView3)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemTextArray($ListView3)
    $Path = _GetMusicPathByName($Selected_Item[1])
    _SendData('_SetStatus("Play")', $Remote_ReceiverID_Name)
    _SendData('_RefreshCombos()', $Remote_ReceiverID_Name)
    _SendData('New_Media("' & $Path & '"', $Remote_ReceiverID_Name)
    _SendData('AddStringToPlayer("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    _SendData('SetChannel("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    EndIf
    EndSelect
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    Switch $hwndFrom
    Case $hWndListView
    Switch $code
    Case $LVN_ENDLABELEDIT, $LVN_ENDLABELEDITW ; The end of label editing for an item
    $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
    Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
    ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
    ; If Text is empty the return value is ignored
    Return StringLen(DllStructGetData($tBuffer, "Text")) > 0
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

    [/autoit]

    Es wird dadurch sofort beenden...und die neuen Werte werden nicht übernommen -.-

  • Hmm, ich hab würde es erst mal übersichtlicher machen:

    Spoiler anzeigen
    [autoit]

    Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    Local $tNMTOOLBAR, $tNMTBHOTITEM, $tInfo

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
    Case $hToolbar
    Switch $code
    Case $NM_CLICK
    $tNMACTIVE = DllStructCreate($tagNMITEMACTIVATE, $lParam)
    $iItem = DllStructGetData($tNMACTIVE, "Index")
    If $iItem = -1 Then Return $GUI_RUNDEFMSG
    Switch _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem)
    Case 0
    GUICtrlSendToDummy($Dummy1)
    Case 1
    GUICtrlSendToDummy($Dummy2)
    Case 3
    GUICtrlSendToDummy($Dummy3)
    Case 4
    GUICtrlSendToDummy($Dummy4)
    Case 5
    GUICtrlSendToDummy($Dummy5)
    Case 7
    GUICtrlSendToDummy($Dummy6)
    Case 8
    GUICtrlSendToDummy($Dummy7)
    Case 9
    GUICtrlSendToDummy($Dummy8)
    Case 10
    GUICtrlSendToDummy($Dummy9)
    Case 11
    GUICtrlSendToDummy($Dummy10)
    Case 12
    GUICtrlSendToDummy($Dummy11)
    Case 13
    GUICtrlSendToDummy($Dummy12)
    EndSwitch
    Case $TBN_HOTITEMCHANGE
    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
    $iItem = $i_idNew
    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
    EndSwitch
    Case GUICtrlGetHandle($ListView1)
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView1)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemText($ListView1, $getselectedplugin1)
    If $Selected_Item = "Radiosender" Then
    GUICtrlSetState($ListView2, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Enable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Radiosender"
    ElseIf $Selected_Item = "Musik" Then
    GUICtrlSetState($ListView3, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Enable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Musik"
    ElseIf $Selected_Item = "Favouriten" Then
    GUICtrlSetState($ListView4, $GUI_Show)
    GUICtrlSetState($ListView1, $GUI_Hide)
    _Disable_All_Toolbar_Buttons()
    $CurrentDirectory1 = "Favouriten"
    EndIf
    EndIf
    EndSelect
    Case GUICtrlGetHandle($ListView2)
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView2)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemTextArray($ListView2)
    _SendData('New_Media("' & $Selected_Item[4] & '"', $Remote_ReceiverID_Name)
    _SendData('_SetStatus("Play")', $Remote_ReceiverID_Name)
    _SendData('SetChannel("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    EndIf
    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    Case GUICtrlGetHandle($ListView3)
    Select
    Case $code = $NM_DBLCLK
    $getselectedplugin1 = _GUICtrlListView_GetSelectionMark($ListView3)
    If $getselectedplugin1 = -1 Then
    Else
    $Selected_Item = _GUICtrlListView_GetItemTextArray($ListView3)
    $Path = _GetMusicPathByName($Selected_Item[1])
    _SendData('_SetStatus("Play")', $Remote_ReceiverID_Name)
    _SendData('_RefreshCombos()', $Remote_ReceiverID_Name)
    _SendData('New_Media("' & $Path & '"', $Remote_ReceiverID_Name)
    _SendData('AddStringToPlayer("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    _SendData('SetChannel("' & $Selected_Item[1] & '")', $Remote_ReceiverID_Name)
    EndIf
    EndSelect
    Case GUICtrlGetHandle($ListView4)
    Switch $code
    Case $LVN_ENDLABELEDIT, $LVN_ENDLABELEDITW ; The end of label editing for an item
    $tInfo = DllStructCreate($tagNMLVDISPINFO, $ilParam)
    Switch $code = $LVN_ENDLABELEDITW
    Case True
    Local $tBuffer = DllStructCreate("wchar Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
    Case False
    Local $tBuffer = DllStructCreate("char Text[" & DllStructGetData($tInfo, "TextMax") & "]", DllStructGetData($tInfo, "Text"))
    EndSwitch
    ; If Text is not empty, return True to set the item's label to the edited text, return false to reject it
    ; If Text is empty the return value is ignored
    Return StringLen(DllStructGetData($tBuffer, "Text")) > 0
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>_WM_NOTIFY

    [/autoit]