Hallo Leute,
ich muss nochmal mein Beispiel-Script aufgreifen, da sich ein neues Problem ergeben hat.
Ich wollte gern die Doubleclick-Funktion von ChaosKeks verwenden und musste leider feststellen, dass dadurch leider kein Drag&Drop im ListView mehr möglich ist.
Spoiler anzeigen
C
#include <GUIConstantsEx.au3>
#include <GUIListViewEx.au3>
#include <WindowsConstants.au3>
Global $idListView
Example()
Func Example()
Local $hGUI=GUICreate("listview items", 250, 300, -1, -1)
$idListview = GUICtrlCreateListView("col_1 |col_2|col_3 ", 0, 0, 250, 260)
Local $idButton = GUICtrlCreateButton("add entry", 10, 270, 230, 20)
$i = 1
GUISetState(@SW_SHOW)
_GUIListViewEx_MsgRegister()
Local $idLV = _GUIListViewEx_Init($idListview, '', 0, 0, True)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
_GUIListViewEx_Close($idLV)
GUICtrlCreateListViewItem("item_1_"&$i&"|item_2_"&$i&"|item_3_"&$i, $idListview)
$idLV = _GUIListViewEx_Init($idListview, '', 0, 0, True)
$i=$i+1
EndSwitch
WEnd
EndFunc ;==>Example
Func WM_NOTIFY($hWnd, $MsgID, $wParam, $lParam) ;<================== Benachrichtigung Doppelklick (Original from Chaoskeks [in ChaosExecution])
Local $tagNMHDR = "hwnd hWndFrom;uint_ptr IDFrom;INT Code"
Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
Local $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
Local $iCode = DllStructGetData($tNMHDR, "Code")
$tagNMHDR = DllStructCreate("int;int;int", $lParam)
If @error Then Return 0
Local $Ycode = DllStructGetData($tagNMHDR, 3)
If $wParam = $idListView Then
Select
Case $hWndFrom = GUICtrlGetHandle($idListView)
Select
Case $iCode = $NM_DBLCLK
If _GUICtrlListView_GetSelectedCount($idListView) > 0 Then
For $i = 0 To _GUICtrlListView_GetItemCount($idListView)
If _GUICtrlListView_GetItemSelected($idListView, $i) Then
$aItem = _GUICtrlListView_GetItemTextArray($idListView, $i)
MsgBox(0, 'Beispiel', $aItem[1] & @CRLF & $aItem[2]& @CRLF& $aItem[3])
EndIf
Next
EndIf
EndSelect
EndSelect
EndIf
Return $GUI_RUNDEFMSG
$tagNMHDR = 0
$lParam = 0
EndFunc ;==>WM_NOTIFY
Alles anzeigen
Hat jemand ne Idee, wo mein Fehler liegt?
Grüße Gremlin