Ok so kann man es natürlich auch machen... Wie gesagt, das Problem wurde gelöst. Vielen Dank für eure Hilfe ![]()
Beiträge von Falki
-
-
Hab es jetzt mit HotKeySet("{TAB}", "TAB_C") gelöst.
Jedesmal wenn TAB gedrückt wird wird die Funktion aufgerufen:
Spoiler anzeigen
[autoit]
[/autoit]
Func TAB_C()
Local $Item, $SubItem
$ddong = 1
MouseClick("left")
MouseClick("left")
$ddong = 0
EndFuncDa durch einen Doppelklick (egal wo) die Funktion ausgeführt wird, frag ich einfach nach ob TAB oder die richtige Maustaste betätigt wurden in dem ich einfach mit Variablen arbeite.
[autoit]
[/autoit]
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tNMHDR, $hWndFrom, $iCode
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hListView
Switch $iCode
Case $NM_DBLCLK
If ($ddong = 1) Then
If ($aHit1 <> -1) And ($aHit2 = 0) Then
$Item = $aHit1
$SubItem = 0
$aHit1= $aHit1
$aHit2=1
Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item, $SubItem)
ElseIf ($aHit1 <> -1) And ($aHit2 > 0) Then
$Item = $aHit1
$SubItem = $aHit2
If ($aHit2 = 3) Then
$aHit1= $aHit1+1
$aHit2=1
ElseIf($aHit2 = 2) Then
$aHit1= $aHit1
$aHit2=3
Else
$aHit1= $aHit1
$aHit2=2
EndIf
Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
Else
Return $GUI_RUNDEFMSG
EndIf
Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
$hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 70, 17, $Style)
_GUICtrlEdit_SetSel($hEdit, 0, -1)
_WinAPI_SetFocus($hEdit)
$hDC = _WinAPI_GetWindowDC($hEdit)
$hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
FrameRect($hDC, 0, 0, $iLen + 70 , 17, $hBrush)
$ddong = 0
Else
$ddong = 1
Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)
If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
$Item = $aHit[0]
$SubItem = 0
$aHit1= $aHit[0]
$aHit2=1
Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
$Item = $aHit[0]
$SubItem = $aHit[1]
If ($aHit[1] = 3) Then
$aHit1= $aHit[0]+1
$aHit2=1
ElseIf($aHit[1] = 2) Then
$aHit1= $aHit[0]
$aHit2=3
Else
$aHit1= $aHit[0]
$aHit2=2
EndIf
Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
Else
Return $GUI_RUNDEFMSG
EndIf
Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
$hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 70, 17, $Style)
_GUICtrlEdit_SetSel($hEdit, 0, -1)
_WinAPI_SetFocus($hEdit)
$hDC = _WinAPI_GetWindowDC($hEdit)
$hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
FrameRect($hDC, 0, 0, $iLen + 70 , 17, $hBrush)
$ddong = 0
;Local $ffg
;MsgBox($MB_SYSTEMMODAL, "Information", "Selected Indices: " & _GUICtrlListView_GetSelectedIndices($hListView))
; _GUICtrlListView_SetSelectedColumn($hListView, $aHit[1])
;MsgBox($MB_SYSTEMMODAL, "Information", "Selected Column: " & _GUICtrlListView_GetSelectedColumn($hListView))
EndIf
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFuncDas war eigentlich das ganze Geheimnis, hat mich nur einige Stunden Zeit gekostet. xD
Aber trotzdem danke für die Hilfe

Kann geschlossen werden....
-
Guten Abend liebe AutoIt Community,
ich bin neu hier und habe mal eine Frage, ich hab mein kleines Script bereits soweit Fertig wie ich es haben will, mir fehlt jetzt eigentlich nur noch das man mit der TAB Taste in der Tabelle sich bewegen kann und nicht nur mit einem klick auf die entsprechende Zeile. Weil dann kann man sehr schnell die Tabelle abarbeiten ohne immer erst auf das Feld klicken zu müssen, was vor allem bei Größen Datenmengen ein Vorteil ist.
Hier mal ein kleiner Ausschnitt der meiner Meinung nach rellevanten Elemnte:
Spoiler anzeigen
[autoit][/autoit] [autoit][/autoit] [autoit]hListView = _GUICtrlListView_Create($hGUI, "bla|bla|bla", 2, 2, 600, 300, BitOR($LVS_EDITLABELS, $LVS_REPORT))
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)Global $hQuery, $aRow, $items, $i
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_SQLite_StartUp()
$hDB = _SQLite_Open(".\\bla.db")
_SQLite_Query($hDB, "SELECT * From Tabelle",$hQuery)$i=1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK_GUICtrlListView_AddItem($hListView, $aRow[0])
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlListView_AddSubItem($hListView, $i - 1, $aRow[1], 1)
_GUICtrlListView_AddSubItem($hListView, $i - 1, $aRow[2], 2)
$i=$i+1WEnd
[/autoit] [autoit][/autoit] [autoit]Local $ilast=$i
[/autoit] [autoit][/autoit] [autoit]
Local $ilast2=$i
Local $ihinzu = GUICtrlCreateButton('Hinzufügen', $iWidth - 270, $iHeight - 28, 85, 25)
Local $iGetArray = GUICtrlCreateButton('Speichern', $iWidth - 180, $iHeight - 28, 85, 25)
Local $iBeenden = GUICtrlCreateButton('Beenden', $iWidth - 90, $iHeight - 28, 85, 25)_SQLite_Close($hDB)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_SQLite_Shutdown()GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
[/autoit] [autoit][/autoit] [autoit]
Local $tNMHDR, $hWndFrom, $iCode$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
[/autoit] [autoit][/autoit] [autoit]
$hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
$iCode = DllStructGetData($tNMHDR, "Code")Switch $hWndFrom
[/autoit] [autoit][/autoit] [autoit]
Case $hListView
Switch $iCode
Case $NM_DBLCLK
Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
[/autoit] [autoit][/autoit] [autoit]
$Item = $aHit[0]
$SubItem = 0
Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
$Item = $aHit[0]
$SubItem = $aHit[1]
Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
Else
Return $GUI_RUNDEFMSG
EndIfLocal $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
[/autoit] [autoit][/autoit] [autoit]
Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
$hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 70, 17, $Style)_GUICtrlEdit_SetSel($hEdit, 0, -1)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_WinAPI_SetFocus($hEdit)
$hDC = _WinAPI_GetWindowDC($hEdit)
$hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
FrameRect($hDC, 0, 0, $iLen + 80 , 17, $hBrush)
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFuncFunc FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
[/autoit] [autoit][/autoit] [autoit]
Local $stRect = DllStructCreate("int;int;int;int")DllStructSetData($stRect, 1, $nLeft)
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($stRect, 2, $nTop)
DllStructSetData($stRect, 3, $nRight)
DllStructSetData($stRect, 4, $nBottom)DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
[/autoit] [autoit][/autoit] [autoit]
EndFuncFunc WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit]
Local $iCode = BitShift($wParam, 16)Switch $lParam
[/autoit] [autoit][/autoit] [autoit]
Case $hEdit
Switch $iCode
Case $EN_KILLFOCUS
Local $iText = _GUICtrlEdit_GetText($hEdit)
_GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)
_WinAPI_DeleteObject($hBrush)
_WinAPI_ReleaseDC($hEdit, $hDC)
_WinAPI_DestroyWindow($hEdit)$Item = -1
[/autoit] [autoit][/autoit] [autoit]
$SubItem = 0
EndSwitch
EndSwitchReturn $GUI_RUNDEFMSG
[/autoit] [autoit][/autoit] [autoit]
EndFuncFunc _CreateListView($hGUI, ByRef $iListView) ; Thanks to AZJIO for this function.
[/autoit] [autoit][/autoit] [autoit]
Local $aClientSize = WinGetClientSize($hGUI)
$iListView = GUICtrlCreateListView('', 0, 0, $aClientSize[0], $aClientSize[1] - 30)
GUICtrlSetResizing($iListView, $GUI_DOCKBORDERS)
Sleep(250)Local $iColumns = Random(1, 5, 1)
[/autoit] [autoit][/autoit] [autoit]
__ListViewFill($iListView, $iColumns, Random(25, 100, 1)) ; Fill the ListView with Random data.
For $i = 0 To $iColumns
_GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE)
_GUICtrlListView_SetColumnWidth($iListView, $i, $LVSCW_AUTOSIZE_USEHEADER)
Next
EndFunc ;==>_CreateListViewFunc __ListViewFill($hListView, $iColumns, $iRows) ; Required only for the Example.
[/autoit] [autoit][/autoit] [autoit]
If Not IsHWnd($hListView) Then
$hListView = GUICtrlGetHandle($hListView)
EndIf
Local $fIsCheckboxesStyle = (BitAND(_GUICtrlListView_GetExtendedListViewStyle($hListView), $LVS_EX_CHECKBOXES) = $LVS_EX_CHECKBOXES)_GUICtrlListView_BeginUpdate($hListView)
[/autoit] [autoit][/autoit] [autoit][/autoit]
For $i = 0 To $iColumns - 1
_GUICtrlListView_InsertColumn($hListView, $i, 'Column ' & $i + 1, 50)
_GUICtrlListView_SetColumnWidth($hListView, $i - 1, -2)
Next
For $i = 0 To $iRows - 1
_GUICtrlListView_AddItem($hListView, 'Row ' & $i + 1 & ': Col 1', $i)
If Random(0, 1, 1) And $fIsCheckboxesStyle Then
_GUICtrlListView_SetItemChecked($hListView, $i)
EndIf
For $j = 1 To $iColumns
_GUICtrlListView_AddSubItem($hListView, $i, 'Row ' & $i + 1 & ': Col ' & $j + 1, $j)
Next
Next
_GUICtrlListView_EndUpdate($hListView)
EndFuncich hoffe ihr versteht mein Problem und könnt mir weiterhelfen.
Mit freundlichen Grüßen