- Offizieller Beitrag
Die Überschrift sagt es schon. Ich habe eine UDF erstellt. Sie funktioniert.
Nun brauche ich dieselbe Funktion nochmals - was liegt näher, als sie mit Variablen aufzurufen. Doch dann versagt sie.
Hier der Code, ich habe es kommentiert.
Spoiler anzeigen
Code
; markierter Eintrag wird im Array gelöscht
; Liste wird gelöscht, dann Einträge aus Array neu in Liste gesetzt
; funktioniert
Func _AttachDel()
Dim $tmp = GUICtrlRead($lAttach), $tmp1, $sDrive, $sDir, $sFName, $sExt, $aPath, $i = 1
If $tmp <> "" Then
While UBound($aFullPath) > 0
$tmp1 = _PathSplit($aFullPath[$i], $sDrive, $sDir, $sFName, $sExt)
If $sFName & $sExt = $tmp Then
_ArrayDelete($aFullPath, $i)
ExitLoop
EndIf
$i = $i +1
WEnd
GUICtrlSetData($lAttach, "")
For $i = 1 To UBound($aFullPath) -1
$tmp1 = _PathSplit($aFullPath[$i], $sDrive, $sDir, $sFName, $sExt)
GUICtrlSetData($lAttach, $sFName & $sExt)
If $attachname = "" Then
$attachname = $sFName & $sExt
Else
$attachname = $attachname & ", " & $sFName & $sExt
EndIf
Next
EndIf
EndFunc
; Hier die gleiche Funktion mit Übergabe von Array und Liste
; wird aber nur ausgeführt bis: GUICtrlSetData($delList, "")
; es erfolgt kein Eintritt in die Schleife zur Befüllung der Liste (getestet mit einer Messagebox)
; Aufruf mit: _AttachDel($aFullPath, $lAttach)
Func _AttachDel($delArray, $delList)
Dim $tmp = GUICtrlRead($delList), $tmp1, $sDrive, $sDir, $sFName, $sExt, $aPath, $i = 1
If $tmp <> "" Then
For $i =1 To UBound($delArray) - 1
$tmp1 = _PathSplit($delArray[$i], $sDrive, $sDir, $sFName, $sExt)
If $sFName & $sExt = $tmp Then
_ArrayDelete($delArray, $i)
ExitLoop
EndIf
Next
GUICtrlSetData($delList, "")
For $i = 1 To UBound($delArray) -1
$tmp1 = _PathSplit($delArray[$i], $sDrive, $sDir, $sFName, $sExt)
GUICtrlSetData($delList, $sFName & $sExt)
If $attachname = "" Then
$attachname = $sFName & $sExt
Else
$attachname = $attachname & ", " & $sFName & $sExt
EndIf
Next
EndIf
EndFunc
Alles anzeigen