Jump to content

GUIListView beta problems


Beege
 Share

Recommended Posts

Is anyone else haveing problems with GUIList and GUIListView in the new beta? My programs that work in the current version wont work with the beta. No items are being added to lists.

Link to comment
Share on other sites

Here is a example. works with current version but not the beta.

#include <GUIConstants.au3>
#include <GuiListView.au3>
#Include <GuiList.au3>
Global $WM_DROPFILES = 0x233
Global $gaDropFiles[1]
Local $Folderadd, $setdir, $ani1, $IPread, $wininet, $shell32, $nItem, $add

$hGUI = GUICreate("Drag and Drop List", 543, 339, 233, 193, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
$wininet = DllOpen('wininet.dll')
$shell32 = DllOpen('shell32.dll')
$hList = GUICtrlCreateListView("", 16, 16, 297, 185)
_GUICtrlListViewInsertColumn($hList, 1, 'Filename', 0, 233)
_GUICtrlListViewInsertColumn($hList, 1, 'Size', 0, 60)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUICtrlCreateLabel("Total Files :", 16, 220, 58, 17)
$total = GUICtrlCreateLabel("0", 76, 220, 25, 17)
GUICtrlCreateLabel("Total Size :", 206, 220, 58, 17)
$tsize = GUICtrlCreateLabel("0", 266, 220, 65, 17)
$Clearlist = GUICtrlCreateButton("Clear List", 352, 136, 115, 25)
GUICtrlSetState($ani1, 0)
GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES_FUNC")
GUISetState(@SW_SHOW)

Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_DROPPED
            For $i = 0 To UBound($gaDropFiles) - 1
                $fileorfolder = FileGetAttrib($gaDropFiles[$i])
                If $fileorfolder = 'D' Then
                    $foldersize = DirGetSize($gaDropFiles[$i])
                    $add = $add + $foldersize
                    If $add >= 1024000000 Then
                        GUICtrlSetData($tsize, Round($add / 1000000000, 2) & ' GB')
                    ElseIf $add >= 1024000 Then
                        GUICtrlSetData($tsize, Round($add / 1000000, 2) & ' MB')
                    ElseIf $add >= 1024 Then
                        GUICtrlSetData($tsize, Round($add / 1000, 2) & ' KB')
                    Else
                        GUICtrlSetData($tsize, $add & ' Bytes')
                    EndIf
                    If $foldersize >= 1024000000 Then
                        $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(DirGetSize($gaDropFiles[$i]) / 1000000000, 2) & ' GB', $hList)
                        ContinueLoop
                    ElseIf $foldersize >= 1024000 Then
                        $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(DirGetSize($gaDropFiles[$i]) / 1000000, 2) & ' MB', $hList)
                        ContinueLoop
                    ElseIf $foldersize >= 1024 Then
                        $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(DirGetSize($gaDropFiles[$i]) / 1000, 2) & ' KB', $hList)
                        ContinueLoop
                    Else
                        $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & DirGetSize($gaDropFiles[$i]) & ' Bytes', $hList)
                        ContinueLoop
                    EndIf
                EndIf
                $dSize = FileGetSize($gaDropFiles[$i])
                $add = $add + $dSize
                If $add >= 1024000000 Then
                    GUICtrlSetData($tsize, Round($add / 1000000000, 2) & ' GB')
                ElseIf $add >= 1024000 Then
                    GUICtrlSetData($tsize, Round($add / 1000000, 2) & ' MB')
                ElseIf $add >= 1024 Then
                    GUICtrlSetData($tsize, Round($add / 1000, 2) & ' KB')
                Else
                    GUICtrlSetData($tsize, $add & ' Bytes')
                EndIf
                If $dSize > 1024000000 Then
                    $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(FileGetSize($gaDropFiles[$i]) / 1000000000, 2) & ' GB', $hList)
                ElseIf $dSize > 1024000 Then
                    $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(FileGetSize($gaDropFiles[$i]) / 1000000, 2) & ' MB', $hList)
                ElseIf $dSize > 1024 Then
                    $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & Round(FileGetSize($gaDropFiles[$i]) / 1000, 2) & ' KB', $hList)
                Else
                    $nItem = GUICtrlCreateListViewItem($gaDropFiles[$i] & '|' & FileGetSize($gaDropFiles[$i]) & ' Bytes', $hList)
                EndIf
            Next
            GUICtrlSetData($total, _GUICtrlListViewGetItemCount($hList))
        Case $msg = $Clearlist
            _GUICtrlListViewDeleteAllItems($hList)
            $add = 0
            GUICtrlSetData($total, '0')
            GUICtrlSetData($tsize, '0 Bytes')
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Func WM_DROPFILES_FUNC($hWnd, $msgID, $wParam, $lParam)
    Local $nSize, $pFileName
    Local $nAmt = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", 0xFFFFFFFF, "ptr", 0, "int", 255)
    For $i = 0 To $nAmt[0] - 1
        $nSize = DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", 0, "int", 0)
        $nSize = $nSize[0] + 1
        $pFileName = DllStructCreate("char[" & $nSize & "]")
        DllCall("shell32.dll", "int", "DragQueryFile", "hwnd", $wParam, "int", $i, "ptr", DllStructGetPtr($pFileName), "int", $nSize)
        ReDim $gaDropFiles[$i + 1]
        $gaDropFiles[$i] = DllStructGetData($pFileName, 1)
        $pFileName = 0
    Next
EndFunc   ;==>WM_DROPFILES_FUNC
Link to comment
Share on other sites

Hi,

I have a number of LVs that do still work (not doing the same as yours, just writing), but a major problem with another, which i reported to @gafrost and put on forum;

seeing my script won't work in new AutoIt version [OK 3.2.4.9, not in 3.2.5.0], [as earlier script in that thread]

Fast Sort with Icons in ListView; ExIcons7.zip

Randall

Edited by randallc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...