Könntest du dazu mal ein Beispiel machen? ![]()
Beiträge von nuts
-
-
Ohne das jetzt ausprobiert zu haben würde ich da mal widersprechen. Wobei mir jetzt unklar ist wie man das fair vergleichen soll.
-
inis sind aber viel schneller (bei großen dateien)
Im Vergleich wozu? -
Dazu müsste man mitkriegen wann ein Musiktitel zuende ist. Würde mich auch sehr interessieren, vielleicht fällt den HTTP-Profis was ein.
P.S. Der Adobe-Flashplayer isch schwer zu beherrschen

-
Mache mich gleich an die Farben...
Bugfix hat das fürs Listview schon umgesetzt:Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
#Include <Array.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <ListViewConstants.au3>
#include <StructureConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>#region - required declarations for coloring and font
[/autoit] [autoit][/autoit] [autoit]
Global $hFont, $defColLV = 0x000000, $defBkColLV = 0xFFFFFF
; Font long = $nHeight, $nWidth[, $nEscape = 0[, $nOrientn = 0[, $fnWeight = $FW_NORMAL[,
; $bItalic = False[, $bUnderline = False[, $bStrikeout = False[, $nCharset = $DEFAULT_CHARSET[,
; $nOutputPrec = $OUT_DEFAULT_PRECIS[, $nClipPrec = $CLIP_DEFAULT_PRECIS[, $nQuality = $DEFAULT_QUALITY[,
; $nPitch = 0[, $szFace = 'Arial']]]]]]]]]]]])]
; zur Unterscheidung:
; $nHeight mit vorangestelltem '-' bei Font long !!
; Font short = $nHeight, $fnWeight, $szFaceGlobal $aSubItemSet[1][5] = [[-1]] ; [$i][$iItem, $iSubItem, $iBkCol, $iCol, $sFont]
[/autoit] [autoit][/autoit] [autoit]
;~ wenn [0][0] = -1
;~ $aSubItemSet[0][1] = Zeilen abwechselnd, -2 Spalten abwechselnd, -3 Einzelzeile, -4 Einzelspalte
;~ $aSubItemSet[0][2] = ungerade Zeile/Spalte Bk-Color oder Bk-Color Einzelzeile/-spalte
;~ $aSubItemSet[0][3] = gerade Zeile/Spalte Bk-Color oder Text-Color Einzelzeile/-spalte
;~ $aSubItemSet[0][4] = Zeile od. Spalte (bei [0][1]= -3 / -4)
#endregionGlobal $setIndex, $setSubIndex
[/autoit] [autoit][/autoit] [autoit]$GUI = GUICreate("Listview Custom Draw", 400, 440)
[/autoit] [autoit][/autoit] [autoit]
$cListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$hListView = GUICtrlGetHandle($cListView)
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
For $i = 1 To 30
_GUICtrlListView_AddItem($hListView, "Row" & $i & ": Col 1", $i-1)
For $j = 1 To 2
_GUICtrlListView_AddSubItem ($hListView, $i-1, "Row" & $i & ": Col " & $j+1, $j)
Next
Next
GUICtrlCreateLabel('Item', 2, 278, 50, 17)
GUICtrlCreateLabel('or Row', 2, 290, 50, 17)
$inItem = GUICtrlCreateInput('10', 50, 280, 25, 20)
GUICtrlCreateLabel('SubItem', 86, 278, 45, 17)
GUICtrlCreateLabel('or Column', 86, 290, 50, 17)
$inSubItem = GUICtrlCreateInput('1', 145, 280, 25, 20)
GUICtrlCreateLabel('( 0-Index )', 185, 283, 50, 17)
$btSet = GUICtrlCreateButton('Set', 260, 280, 50, 20)
$btOff = GUICtrlCreateButton('Off', 340, 280, 50, 20)
GUICtrlCreateLabel('Bk-Color', 2, 308, 40, 17)
GUICtrlCreateLabel('or odd', 2, 320, 40, 17)
$inBkCol = GUICtrlCreateInput('0x3DF8FF', 50, 310, 60, 20)
GUICtrlCreateLabel('Color', 130, 308, 40, 17)
GUICtrlCreateLabel('or even', 130, 320, 40, 17)
$inCol = GUICtrlCreateInput('0xFF0000', 170, 310, 60, 20)
GUICtrlCreateLabel('Font', 2, 343, 40, 17)
$inFont = GUICtrlCreateInput('14,700,Courier New', 50, 340, 180, 20)
GUICtrlCreateGroup(' Spalten od. Zeilen', 240, 315, 150, 120)
$rRows = GUICtrlCreateRadio('Zeilen wechselnd', 245, 330, 130)
GUICtrlSetState(-1, $GUI_CHECKED)
$rCols = GUICtrlCreateRadio('Spalten wechselnd', 245, 350, 130)
$rOneRow = GUICtrlCreateRadio('Einzelzeile', 245, 370, 130)
$rOneCol = GUICtrlCreateRadio('Einzelspalte', 245, 390, 130)
$btSet2 = GUICtrlCreateButton('Set', 250, 412, 50, 18)
$btOff2 = GUICtrlCreateButton('Off', 330, 412, 50, 18)
GUICtrlCreateGroup('', -99, -99, 1, 1)
$lbActiv = GUICtrlCreateLabel('Zeilen-/ Spaltenmodus aktiv', 40, 415, 200)
GUICtrlSetFont(-1, 10, 400, -1, 'Comic Sans MS')
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetState(-1, $GUI_HIDE)GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
[/autoit] [autoit][/autoit] [autoit]
GUISetState()While True
[/autoit] [autoit][/autoit] [autoit]
$msg = GUIGetMsg()
Switch $msg
Case -3
ExitLoop
Case $btSet
$setIndex = GUICtrlRead($inItem)
$setSubIndex = GUICtrlRead($inSubItem)
If ($setIndex <> '' And $setSubIndex <> '') Then _
_SubItemColSet($setIndex, $setSubIndex, GUICtrlRead($inBkCol), GUICtrlRead($inCol), GUICtrlRead($inFont))
Case $btOff
$setIndex = GUICtrlRead($inItem)
$setSubIndex = GUICtrlRead($inSubItem)
If ($setIndex <> '' And $setSubIndex <> '') Then _
_SubItemColOff($setIndex, $setSubIndex)
Case $btSet2
If BitAND(GUICtrlRead($rRows), $GUI_CHECKED) Then
_RowsSetCol(GUICtrlRead($inBkCol), GUICtrlRead($inCol))
ElseIf BitAND(GUICtrlRead($rCols), $GUI_CHECKED) Then
_ColumnsSetCol(GUICtrlRead($inBkCol), GUICtrlRead($inCol))
ElseIf BitAND(GUICtrlRead($rOneRow), $GUI_CHECKED) Then
_OneRowSetCol(GUICtrlRead($inItem), GUICtrlRead($inBkCol), GUICtrlRead($inCol)) ;die brauch ich
Else
_OneColumnSetCol(GUICtrlRead($inSubItem), GUICtrlRead($inBkCol), GUICtrlRead($inCol))
EndIf
Case $btOff2
_ColRowOff()
EndSwitch
WEnd
_WinAPI_DeleteObject($hFont)
Exit#region - functions for setting color and font
[/autoit] [autoit][/autoit] [autoit]
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hListView
Switch $iCode
Case $NM_CUSTOMDRAW
If Not _GUICtrlListView_GetViewDetails($hWndFrom) Then Return $GUI_RUNDEFMSG
Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
Local $iDrawStage, $iItem, $iSubitem, $hDC, $tRect
$iDrawStage = DllStructGetData($tCustDraw, 'dwDrawStage')
Switch $iDrawStage
Case $CDDS_ITEMPREPAINT
Return $CDRF_NOTIFYSUBITEMDRAW
Case BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM)
$iItem = DllStructGetData($tCustDraw, 'dwItemSpec')
$iSubitem = DllStructGetData($tCustDraw, 'iSubItem')
_SetItemCol($hDC, $tCustDraw, $iItem, $iSubitem)
Return $CDRF_NEWFONT
EndSwitch
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFYFunc _SetItemCol(ByRef $hDC, ByRef $tCustDraw, $iItem, $iSubitem)
[/autoit] [autoit][/autoit] [autoit]
If $aSubItemSet[0][0] = -1 Then
If $aSubItemSet[0][1] < 0 Then
Switch $aSubItemSet[0][1]
Case -1 ; Zeilen abwechselnd färben
If Mod($iItem, 2) Then ; ungerade
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
Else
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][3]))
EndIf
Case -2 ; Spalten abwechselnd färben
If Mod($iSubItem, 2) Then ; ungerade
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
Else
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][3]))
EndIf
Case -3 ; einzelne Zeile färben
If $iItem = $aSubItemSet[0][4] Then
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[0][3]))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
Else
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
EndIf
Case -4 ; einzelne Spalte färben
If $iSubItem = $aSubItemSet[0][4] Then
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[0][3]))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[0][2]))
Else
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
EndIf
Case Else
Return
EndSwitch
$hDC = DllStructGetData($tCustDraw, 'hdc')
$hFont = _WinAPI_CreateFont(14,0,0,0,$FW_NORMAL,False,False,False,$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, _
$CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial')
_WinAPI_SelectObject($hDC, $hFont)
EndIf
Else
Local $indx, $aIndex = _ArrayFindAll($aSubItemSet, $iItem)
If @error Then Return
For $i = 0 To UBound($aIndex) -1
If $aSubItemSet[$aIndex[$i]][1] = $iSubitem Then
$indx = $aIndex[$i]
ExitLoop
EndIf
Next
Local $aDefFont[14] = [14,0,0,0,$FW_NORMAL,False,False,False, _
$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS,$CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial']
Local $splitFont = StringSplit($aSubItemSet[$indx][4], ',')
If StringLeft($splitFont[1], 1) <> '-' Then ; alternativer FontString?
$aDefFont[0] = $splitFont[1]
$aDefFont[4] = $splitFont[2]
$aDefFont[13] = $splitFont[3]
Else
For $i = 1 To UBound($splitFont) -1
If $i = 1 Then
$aDefFont[0] = StringTrimLeft($splitFont[1], 1)
Else
$aDefFont[$i-1] = $splitFont[$i]
EndIf
Next
EndIf
If ($aSubItemSet[$indx][0] = $iItem) And ($aSubItemSet[$indx][1] = $iSubitem) Then
$hDC = DllStructGetData($tCustDraw, 'hdc')
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($aSubItemSet[$indx][3]))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($aSubItemSet[$indx][2]))
$hFont = _WinAPI_CreateFont($aDefFont[0],$aDefFont[1],$aDefFont[2],$aDefFont[3],$aDefFont[4],$aDefFont[5],$aDefFont[6], _
$aDefFont[7],$aDefFont[8],$aDefFont[9],$aDefFont[10],$aDefFont[11],$aDefFont[12],$aDefFont[13])
_WinAPI_SelectObject($hDC, $hFont)
Else
$hDC = DllStructGetData($tCustDraw, 'hdc')
DllStructSetData($tCustDraw, 'clrText', RGB2BGR($defColLV))
DllStructSetData($tCustDraw, 'clrTextBk', RGB2BGR($defBkColLV))
$hFont = _WinAPI_CreateFont(14,0,0,0,$FW_NORMAL,False,False,False,$DEFAULT_CHARSET,$OUT_DEFAULT_PRECIS, _
$CLIP_DEFAULT_PRECIS,$DEFAULT_QUALITY,0,'Arial')
_WinAPI_SelectObject($hDC, $hFont)
EndIf
EndIf
EndFunc ;==>_SetItemColFunc RGB2BGR($iColor)
[/autoit] [autoit][/autoit] [autoit]
Local $sH = Hex($iColor,6)
Return '0x' & StringRight($sH, 2) & StringMid($sH,3,2) & StringLeft($sH, 2)
EndFuncFunc _SubItemColSet($iItem, $iSubItem, $iBkCol=-1, $iCol=-1, $sFont='-14,0,0,0,400,False,False,False,1,0,0,0,0,Arial')
[/autoit] [autoit][/autoit] [autoit]
Local $Bk, $Col
If $iBkCol = -1 Then $iBkCol = $defBkColLV
If $iCol = -1 Then $iCol = $defColLV
If $aSubItemSet[0][0] <> -1 Then ReDim $aSubItemSet[UBound($aSubItemSet)+1][5]
$aSubItemSet[UBound($aSubItemSet)-1][0] = $iItem
$aSubItemSet[UBound($aSubItemSet)-1][1] = $iSubItem
$aSubItemSet[UBound($aSubItemSet)-1][2] = $iBkCol
$aSubItemSet[UBound($aSubItemSet)-1][3] = $iCol
$aSubItemSet[UBound($aSubItemSet)-1][4] = $sFont
_WinAPI_InvalidateRect($hListView)
EndFunc ;==>_SubItemColSetFunc _SubItemColOff($iItem, $iSubItem)
[/autoit] [autoit][/autoit] [autoit]
Local $indx, $aIndex = _ArrayFindAll($aSubItemSet, $iItem)
If @error Then Return
For $i = 0 To UBound($aIndex) -1
If $aSubItemSet[$aIndex[$i]][1] = $iSubitem Then
$indx = $aIndex[$i]
ExitLoop
EndIf
Next
If UBound($aSubItemSet) > 1 Then
_ArrayDelete($aSubItemSet, $indx)
Else
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = 0
$aSubItemSet[0][2] = 0
$aSubItemSet[0][3] = 0
$aSubItemSet[0][4] = 0
EndIf
_WinAPI_InvalidateRect($hListView)
EndFunc ;==>_SubItemColOffFunc _OneColumnSetCol($iIndex, $iBkCol=-1, $iCol=-1)
[/autoit] [autoit][/autoit] [autoit]
If $iBkCol = -1 Then $iBkCol = $defBkColLV
If $iCol = -1 Then $iCol = $defColLV
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = -4
$aSubItemSet[0][2] = $iBkCol
$aSubItemSet[0][3] = $iCol
$aSubItemSet[0][4] = $iIndex
_WinAPI_InvalidateRect($hListView)
EndFuncFunc _OneRowSetCol($iIndex, $iBkCol=-1, $iCol=-1) ;die brauch ich
[/autoit] [autoit][/autoit] [autoit]
If $iBkCol = -1 Then $iBkCol = $defBkColLV
If $iCol = -1 Then $iCol = $defColLV
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = -3
$aSubItemSet[0][2] = $iBkCol
$aSubItemSet[0][3] = $iCol
$aSubItemSet[0][4] = $iIndex
_WinAPI_InvalidateRect($hListView)
EndFuncFunc _ColumnsSetCol($iOddCol=-1, $iEvenCol=-1)
[/autoit] [autoit][/autoit] [autoit]
If $iOddCol = -1 Then $iOddCol = $defBkColLV
If $iEvenCol = -1 Then $iEvenCol = $defColLV
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = -2
$aSubItemSet[0][2] = $iOddCol
$aSubItemSet[0][3] = $iEvenCol
_WinAPI_InvalidateRect($hListView)
EndFuncFunc _RowsSetCol($iOddCol=-1, $iEvenCol=-1)
[/autoit] [autoit][/autoit] [autoit]
If $iOddCol = -1 Then $iOddCol = $defBkColLV
If $iEvenCol = -1 Then $iEvenCol = $defColLV
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = -1
$aSubItemSet[0][2] = $iOddCol
$aSubItemSet[0][3] = $iEvenCol
_WinAPI_InvalidateRect($hListView)
EndFuncFunc _ColRowOff()
[/autoit]
$aSubItemSet[0][0] = -1
$aSubItemSet[0][1] = 0
$aSubItemSet[0][2] = 0
$aSubItemSet[0][3] = 0
$aSubItemSet[0][4] = 0
_WinAPI_InvalidateRect($hListView)
EndFunc
#endregion -
Oder nimm einfach ein Listview. Dann kommst du ganz ohne Fremdsoftware aus und bleibst flexibel.
Oscar hat mal ein tolles Beispiel für Anfänger geschrieben (Listview-Datenbank oder so ähnlich, sollte sich über die Foren-suche leicht finden lassen). -
Mal eine kurze Zwischenfrage: Wie kann man den maximalen Arbeitsspeicher seines Autoit-Skripts begrenzen?
-
Kleine Anmerkung:
Die Codesschnipsel bei Pastebin sind ja nur temporär verfügbar und dadruch wird für die Nachwelt der Thread meist ziemlich unbrauchbar.
Darum solltest du dein Skript auch hier im Forum posten. -
Wäre im Hilfe-Forum sicher besser aufgehoben.
Du wirst in diesem Fall die Datei anhand des Dateinamens in den Verzeichnissen suchen müssen. -
Für Autoit gibts noch (?) keinen Debugger.
Du musst sauberer programmieren. Jede Zeile, die unvorhersehbare Informationen (z.B. eine User Eingabe) verarbeiten muss, muss auch mit einem entsprechenden errormanagment versehen werden
-
So irgendwie würde ich das machen.
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
Func _MoveLVItem($startIndex, $endindex, $hLV) ; $hLV = handle vom Listview!
If $endindex >_GUICtrlListView_GetItemCount($hLV)-1 or $endindex < 0 then
SetError(1)
Return 0
EndIf
If $startindex >_GUICtrlListView_GetItemCount($hLV)-1 or $startindex < 0 then
SetError(1)
Return 0
EndIf
;errormanagement braucht man vielleicht gar nicht.
;im Errorfall wird das Item ganz oben bzw. ganz unten eingefügt? Kanns nicht testen ...Local $gettext = _GUICtrlListView_GetItemText($hLV, $startindex)
[/autoit]
if $startindex < $endindex then
_GUICtrlListView_InsertItem($hLV, $gettext, $endindex +1)
_GUICtrlListView_DeleteItem($hLV, $startindex)
else
_GUICtrlListView_InsertItem($hLV, $gettext, $endindex)
_GUICtrlListView_DeleteItem($hLV, $startindex)
endif
EndFunc ;==>_MoveLVItem -
Wenn du dein lauffähiges Skript postest verrate ich dir warum

-
Die Funktion ist sehr wohl in der Hilfe erklärt.
Vielleicht nur nicht in der deutschen Hilfe? -
Sehr beindruckend - auch die Idee es als UDF auszuarbeiten ist super!

-
Wow das wirkt echt.
Mein System: WinXP, Amd x2 3800, 690G Ati ChipsatzBestätigt für beide Skripte - die Dreiecke sind so viel cooler

-
Sehr cool.
Ist nur brutal anstrengend für die Augen der Laufschrift zu folgen
( oder sind das die Faschingsnachwirkungen?
) -
doc sag mal kann man damit den auch was "lernen "

Na sicher doch
Es kommt ja drauf an wo man hin will.
Zum privat bisschen rummurksen gibt es im Netz mehr als genug Infos - dazu braucht man sich kein 1500 Seiten Buch in den Schrank stellen.
Soviel Spaß bringt es nämlich nicht die Bücher zu wälzen.
Wenn du beruflich in diese Richtung gehen willst ist es jedoch sicher kein Fehler mit den Basic' s anzufangen. -
Eigentlich ist die Deklarierung der beiden Arrays ganz oben gar nicht nötig oder missverstehe ich das jetzt?
Kannst dir die Arrays doch aus Funktionen zurückgeben lassen. -
Das Label liegt ja dann über der ganzen GUI.
Welche Nachteile sind dabei zu beachten?
So einfach vor allen Controls erstellen überlagert ja die Interaktion mit den restlichen Controls. Oder gibts dazu nen bestimmten Style?edit \ Post 1000

-