Danke, und ich dachte schon es liegt an mir ![]()
Ich habe grade ein sehr einfaches Workaround gefunden: nicht perfekt, aber es funktioniert.
Wenn man jetzt noch die Enter Taste abfangen könnte wär ich zufrieden, aber _GUICtrlTreeView_EndEdit hat leider keinerlei wirkung ![]()
Nicht allzu schlimm - sowas kann man später verfeinern.
Spoiler anzeigen
#include <Misc.au3>
#include <StructureConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <WindowsConstants.au3>
GUICreate("TreeView Edit Text", 400, 300)
$hTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $TVS_EDITLABELS)
$hTreeView = GUICtrlGetHandle($hTreeView)
Global $hEdit, _ ; Handle to Listview-Edit Control
$hSel ; Current selected Item
GUISetState()
[/autoit] [autoit][/autoit] [autoit]Dim $hItem[6]
For $x = 0 To 5
$hItem[$x] = _GUICtrlTreeView_Add($hTreeView, 0, StringFormat("[%02d] New Item", $x + 1))
Next
GUIRegisterMsg(0x004E, "MY_WM_NOTIFY")
[/autoit] [autoit][/autoit] [autoit]; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
Func MY_WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
;~ #forceref $hWnd, $iMsg, $iwParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
;~ ConsoleWrite($hWnd & @TAB & $iMsg & @TAB & $iwParam & @TAB & $ilParam & @TAB & $iIDFrom & @CRLF)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hTreeView
Switch $iCode
Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
$hSel = _GUICtrlTreeView_GetSelection($hTreeView)
_GUICtrlTreeView_EditText($hTreeView, $hSel)
$hEdit = _GUICtrlTreeView_GetEditControl($hTreeView)
ConsoleWrite("Doppelklick" & @CRLF)
AdlibRegister("_GetEditText", 10) ; Funktion per Adlibregister aufrufen, damit erst der DLLCallback zurück gegeben werden kann
Return 1 ; nonzero to not allow the default processing
;~ Return 0 ; zero to allow the default processing
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_WM_NOTIFY
Func _GetEditText()
Local $sRet, $sBuffer
AdlibUnRegister("_GetEditText")
Do
$sBuffer = $sRet
$sRet = ControlGetText($hTreeView, "", $hEdit)
Until $sRet = "" Or _IsPressed("0D")
_GUICtrlTreeView_EndEdit($hEdit)
_GUICtrlTreeView_SetText($hTreeView, $hSel, $sBuffer)
ConsoleWrite($sBuffer & @CRLF)
EndFunc ;==>_GetEditText