Jump to content

Recommended Posts

Posted

well i dont need the console write i just wanted to see the structure

but i need to make some changes to the array before it is saved

this is what i have now:

$aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index)
If Not @error Then
  Local $createPlaylist = $playList
  _FileWriteFromArray($createPlaylist, $aLV_List_Right, 0)
Else
MsgBox(0, "Right", "Empty Array")
EndIf

but it want to be able to add more than just what is show in view

so if view says:

video1.flv
video2.flv

i want to be able to save it as:

video  'video1.flv'
video  'video2.flv'

i tried:

For $i = 1 To $aLV_List_Right[0]
     $test = "video '" & $fullPath & "\" & $aLV_List_Right[$i] & "'"
     ConsoleWrite($test & @CRLF)
Next

but does nothing, any ideas?

  • Moderators
Posted

dynamitemedia,

 

but does nothing, any ideas?

Indeed. When you initiated the ListView, you asked the UDF not to use a count element (you set the $iStart parameter to 0) so the returned array does not have the count in the [0] element. AutoIt expects the values of loops to be numeric and so it converts $aLV_List_Right[0] to a number - as the content is a string this returns "0". Thus your loop tries to run from 1 to 0 - and as a result does not run at all. ;)

If you were to code the loop as follows:

For $i = 0 To UBound($aLV_List_Right) - 1
     $test = "video '" & $fullPath & "\" & $aLV_List_Right[$i] & "'"
     ConsoleWrite($test & @CRLF)
Next
you should get what you require. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

dynamitemedia,

 

Indeed. When you initiated the ListView, you asked the UDF not to use a count element (you set the $iStart parameter to 0) so the returned array does not have the count in the [0] element. AutoIt expects the values of loops to be numeric and so it converts $aLV_List_Right[0] to a number - as the content is a string this returns "0". Thus your loop tries to run from 1 to 0 - and as a result does not run at all. ;)

If you were to code the loop as follows:

For $i = 0 To UBound($aLV_List_Right) - 1
     $test = "video '" & $fullPath & "\" & $aLV_List_Right[$i] & "'"
     ConsoleWrite($test & @CRLF)
Next
you should get what you require. :)

M23

 

 

oops!  i knew something was acting weird!  thanks...

  • Moderators
Posted

dynamitemedia,

Glad I could help. :)

And when you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - it just pads the thread unnecessarily. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

sorry about that.

can i ask you another what may seem like a dumb question..

i grabbed this little snipplet so i could get Full path:   

this is better so i have full path  but then i only want to show the file name in the list so i did this:

$aLV_List_Left = StringRegExpReplace($aFileList[$i], "^.*\\(.*)$", "$1")
GUICtrlCreateListViewItem($aLV_List_Left, $cListView_Left)

this works in the view

but how can i be sure the FULL path is saved?

and since i can grab from other folder that full path will change, i tried doing a local or global but it was just sticking with ONE full path and not switching with the new full path of file...

  • Moderators
Posted (edited)

dynamitemedia,

No need to use that snippet to get the full path - nowadays you can do the same thing directly with the _FileListToArray function. ;)

If you do not want the whole path in the ListView then you could look at having a hidden column in which you keep the full path while displaying just the name in another. I will try and work up an example for you - but you may have to wait until after the eclipse tomorrow morning. :)

M23

Edit:

Much easier than I thought it might be: ;)

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>

#include "GUIListViewEx.au3"

; Create GUI
$hGUI = GUICreate("playlist creator", 640, 430)

; browse for folder
$Browse4Folder = GUICtrlCreateButton("Browse", 10, 18, 75, 25)

$clearLeft = GUICtrlCreateButton("Clear", 90, 18, 75, 25)

$cDeleteRight = GUICtrlCreateButton("Delete Selected", 380, 18, 150, 25)

$cListView_Left = GUICtrlCreateListView("Path|Name", 10, 50, 350, 290, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cListView_Left, 0, 0)
_GUICtrlListView_SetColumnWidth($cListView_Left, 1, 245)

; get all the files from folder
Local $FileList2 = _FileListToArray("M:\Program\Au3 Scripts", "*.au3", $FLTA_FILES, True)
Local $aLV_List_Left[UBound($FileList2) - 1][2]
For $i = 1 To $FileList2[0]
    $aLV_List_Left[$i - 1][0] = $FileList2[$i]
    $aLV_List_Left[$i - 1][1] = StringRegExpReplace($FileList2[$i], "^.*\\|\..*$", "")
    GUICtrlCreateListViewItem($FileList2[$i] & "|" & $aLV_List_Left[$i - 1][1], $cListView_Left)
Next

$iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 0, 0, True, 128 + 256)

; Create Right ListView
$hListView_Right = _GUICtrlListView_Create($hGUI, "Path|Name", 380, 50, 250, 290, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER))
_GUICtrlListView_SetExtendedListViewStyle($hListView_Right, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($hListView_Right, 0, 0)
_GUICtrlListView_SetColumnWidth($hListView_Right, 1, 205)
ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView_Right)))

$iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, 0, 0x00FF00)

; Create buttons
$cSave_Button = GUICtrlCreateButton("Save", 430, 350, 200, 30)

GUISetState()

; Register for dragging and editing
_GUIListViewEx_MsgRegister()

; Set the left ListView as active
_GUIListViewEx_SetActive($iLV_Left_Index)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

        Case $cSave_Button
            $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index)
            For $i = 0 To UBound($aLV_List_Right) - 1
                $aSplit = StringSplit($aLV_List_Right[$i], "|")
                 $test = "video '" & $aSplit[1]  & "'"
                 ConsoleWrite($test & @CRLF)
            Next

        Case $clearLeft
            _GUICtrlListView_DeleteAllItems($cListView_Left)
            ; Delete ListView from UDF
            _GUIListViewEx_Close($iLV_Left_Index)
            ; Re-initiialise ListView with no content
            $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True, 128 + 256)
            MsgBox(0, "   ", "Folder Cleared!")

        Case $Browse4Folder
            Local $sMessage = "Select a folder"
            Local $sFileSelectFolder = FileSelectFolder($sMessage, "")
            If @error Then
                MsgBox("   ", "", "No folder was selected.")
            Else
                MsgBox("    ", "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
                Local $FileList2 = _FileListToArray($sFileSelectFolder, "*.au3", $FLTA_FILES, True)
                ; Add items to left ListView using UDF
                _GUIListViewEx_SetActive($iLV_Left_Index)
                For $i = 1 To $FileList2[0]
                    _GUIListViewEx_Insert($FileList2[$i] & "|" & StringRegExpReplace($FileList2[$i], "^.*\\|\..*$", ""))
                Next
            EndIf

        Case $cDeleteRight
            ; Delete items from right ListView using UDF
            _GUIListViewEx_SetActive($iLV_Right_Index)
            _GUIListViewEx_Delete()

    EndSwitch

WEnd
Please ask if anything is unclear. :)

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

yeah that is what i originally was going to so was a hidden column, but couldn't find how that worked.  

i will move on to another part of this project and wait for the eclipse! thanks so much for you help.

  • Moderators
Posted

dynamitemedia,

See my edit above. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

ok i got this working awesome!  only thing(s) i want to fix is some error handling on this delete button

i have tried:

Case $cDeleteRight
If @error Then
 MsgBox(0, $IpTvMyWay, "No File Selected")
Else
  ; Delete items from right ListView using UDF
  _GUIListViewEx_SetActive($iLV_Right_Index)
  _GUIListViewEx_Delete()
EndIf

But its just Not working...  


and how can i start the Left side View blank as well?   the few things i have done get me this error:

155) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aLV_List_Left[$i - 1][0] = $FileList2[$i]

i was thinking before opening a predestined folder but not everyone will like that or if the folder is empty its tossing errors

so leaving it blank and adding folder(s) i think would be better...

You did a great job with this UDF

Edited by dynamitemedia
  • Moderators
Posted

dynamitemedia,

Here is the code adjusted to have an empty left ListView on start (just initialise the ListView with an empty parameter) and with a (literal) errorcheck on the delete button: :)

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>

#include "GUIListViewEx.au3"

; Create GUI
$hGUI = GUICreate("playlist creator", 640, 430)

; browse for folder
$Browse4Folder = GUICtrlCreateButton("Browse", 10, 18, 75, 25)

$clearLeft = GUICtrlCreateButton("Clear", 90, 18, 75, 25)

$cDeleteRight = GUICtrlCreateButton("Delete Selected", 380, 18, 150, 25)

$cListView_Left = GUICtrlCreateListView("Path|Name", 10, 50, 350, 290, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cListView_Left, 0, 0)
_GUICtrlListView_SetColumnWidth($cListView_Left, 1, 245)

$iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True, 128 + 256) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; Create Right ListView
$hListView_Right = _GUICtrlListView_Create($hGUI, "Path|Name", 380, 50, 250, 290, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER))
_GUICtrlListView_SetExtendedListViewStyle($hListView_Right, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($hListView_Right, 0, 0)
_GUICtrlListView_SetColumnWidth($hListView_Right, 1, 205)
ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView_Right)))

$iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, "", 0, 0x00FF00)

; Create buttons
$cSave_Button = GUICtrlCreateButton("Save", 430, 350, 200, 30)

GUISetState()

; Register for dragging and editing
_GUIListViewEx_MsgRegister()

; Set the left ListView as active
_GUIListViewEx_SetActive($iLV_Left_Index)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit

        Case $cSave_Button
            $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index)
            For $i = 0 To UBound($aLV_List_Right) - 1
                $aSplit = StringSplit($aLV_List_Right[$i], "|")
                 $test = "video '" & $aSplit[1]  & "'"
                 ConsoleWrite($test & @CRLF)
            Next

        Case $clearLeft
            _GUICtrlListView_DeleteAllItems($cListView_Left)
            ; Delete ListView from UDF
            _GUIListViewEx_Close($iLV_Left_Index)
            ; Re-initiialise ListView with no content
            $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True, 128 + 256)
            MsgBox(0, "   ", "Folder Cleared!")

        Case $Browse4Folder
            Local $sMessage = "Select a folder"
            Local $sFileSelectFolder = FileSelectFolder($sMessage, "")
            If @error Then
                MsgBox("   ", "", "No folder was selected.")
            Else
                MsgBox("    ", "", "You chose the following folder:" & @CRLF & $sFileSelectFolder)
                Local $FileList2 = _FileListToArray($sFileSelectFolder, "*.au3", $FLTA_FILES, True)
                ; Add items to left ListView using UDF
                _GUIListViewEx_SetActive($iLV_Left_Index)
                For $i = 1 To $FileList2[0]
                    _GUIListViewEx_Insert($FileList2[$i] & "|" & StringRegExpReplace($FileList2[$i], "^.*\\|\..*$", ""))
                Next
            EndIf

        Case $cDeleteRight
            ; Delete items from right ListView using UDF
            _GUIListViewEx_SetActive($iLV_Right_Index)
            _GUIListViewEx_Delete()
            ; Check if error deleting <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            If @error = 2 Then
                MsgBox($MB_SYSTEMMODAL, "Delete Error", "No File Selected")
            EndIf

    EndSwitch

WEnd
Any other requests? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

that is so weird i had tried:

$aLV_List_Left = ""
$iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, $aLV_List_Left, 0, 0, True, 128 + 256)

and didn't work any reason why?

i added some error checking on the Save button too in case anyone is following:

Global $nClickButtonCount = 0 ; add up top with other globals


Case $cSave_Button
If $nClickButtonCount = 0 Then
Local $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index)
$playListFile = FileOpen($playList, 1)


If Not @error Then
For $i = 0 To UBound($aLV_List_Right) - 1
  $aSplit = StringSplit($aLV_List_Right[$i], "|")
  $vids2Add = "file '" & $aSplit[1]  & "'"
  ConsoleWrite($vids2Add  & @CRLF)
  FileWrite($playListFile, $vids2Add & @CRLF) ; The CRLF at the end is a line break
Next
  FileClose($playListFile)
Else
MsgBox(0, "", "Empty Playlist")
EndIf

$nClickButtonCount = 1
Else
$MyBox = MsgBox(16+4, "", "You can Only Hit Save once !!" & @CRLF & "Delete old playlist and start over?")
 If $MyBox == 6 Then
  MsgBox(0, "", "Playlist Deleted!")
  FileDelete($playList)
 ElseIf $MyBox == 7 Then
  MsgBox(0, "", "You Pressed no")
 EndIf
EndIf
 

and thanks for the awesome support!

do you have a example of just ONE column that is draggable?   i am thinking of adding to another app i made...  going to play with adding this function in one of its tabs

Edited by dynamitemedia
  • Moderators
Posted

dynamitemedia,

Setting the variable to an empty string works for me - no idea why it did not for you. :wacko:

 

do you have a example of just ONE column that is draggable?

You use the $LVS_EX_HEADERDRAGDROP style to enable column reordering. I will look into how you might limit the number that can be moved. But that is going outside the scope of this UDF, so I might respond in a new thread. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

dynamitemedia,

My first post was lost in the roll-back, so here it is again. :)

A ListView with a multiple columns, but only a single one draggable:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Misc.au3>

Global $iDragger = -1 ; Flag to indicate column being dragged
Global $hDLL = DllOpen("user32.dll")

$hGUI = GUICreate("Test", 500, 500)

$cLV = GUICtrlCreateListView("Column 0|Col 1 (Drag)|Column 2|Column 3|Column 4|", 10, 10, 480, 200)
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_HEADERDRAGDROP)
$hLV = GUICtrlGetHandle($cLV)

$hHeader = _GUICtrlListView_GetHeader($cLV)
ConsoleWrite("Header: " & $hHeader & @CRLF)

GUISetState()

GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            DllClose($hDLL)
            Exit
    EndSwitch

    ; Forced reset of flag when mouse button released after non-draggable column drag attempted
    If $iDragger <> -1 And Not(_IsPressed("01", $hDLL)) Then
        $iDragger = -1
    EndIf

WEnd

Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hHeader
            Switch $iCode
                Case $HDN_BEGINDRAG
                    $tNMHEADER = DllStructCreate($tagNMHEADER, $lParam)
                    $iCol = DllStructGetData($tNMHEADER, "Item")
                    ; If column flag not set
                    If $iDragger = -1 Then
                        ; Set to column being dragged
                        $iDragger = $iCol
                        ; Now flag holds index of that column and will not reset unless:
                        ; - successful drop of draggable column
                        ; - forced reset if column not draggable
                    EndIf
                    ; Now select return depending on column index
                    Switch $iDragger
                        Case 1 ; Index of draggable column
                            Return False ; To allow drag
                        Case Else
                            Return True  ; To refuse drag
                    EndSwitch

                Case $HDN_ENDDRAG
                    ; Successful drag of draggable column - so reset flag
                    $iDragger = -1
            EndSwitch
    EndSwitch

EndFunc
A lot of "little grey cells" went into that one so I hope you enjoy it! :D

But if you have any further general ListView questions, please ask in another thread so we can keep this one UDF-related. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Moderators
Posted

[bUGFIX VERSION] - 30 Mar 15

Fixed: A bug in the _GUIListViewEx_EditItem function - thanks to mjolnirmarkiv for the report.

New UDF in the first post. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • 2 weeks later...
Posted

yep its me again!! lol

i was trying to add this into a new gui with tabs...

how do i keep the right side list view from showing throughout all the other tabs?

For example:

 Create GUI
$hGUI = GUICreate($IpTvMyWay & " v1.0", 750, 483, 274, 286)
GUISetIcon(@ScriptDir & "\www\bin\IPTV.ico", -1)

$PageControl1 = GUICtrlCreateTab(8, 8, 732, 424)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)


$TabSheet1 = GUICtrlCreateTabItem("Create Playlist")


; 1st lets delete old list
FileDelete($playList)


; browse for folder
$Browse4Folder = GUICtrlCreateButton("Browse", 135, 50, 75, 25)
$clearLeft = GUICtrlCreateButton("Clear", 215, 50, 75, 25)
$cDeleteRight = GUICtrlCreateButton("Delete Selected", 610, 50, 100, 25)


; Video Type
Local $videoType = GUICtrlCreateCombo("", 30, 52, 95, 35, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$LabelVideoType = GUICtrlCreateLabel("Video Type", 30,32, 55, 17)
GUICtrlSetData($videoType, "*.flv|*.avi|*.mpg|*.mp4", "*.mpg")


$cListView_Left = GUICtrlCreateListView("Path| Name | Duration | Size", 30, 82, 390, 290, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
_GUICtrlListView_SetExtendedListViewStyle($cListView_Left, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cListView_Left, 0, 0)
_GUICtrlListView_SetColumnWidth($cListView_Left, 1, 235)
_GUICtrlListView_SetColumnWidth($cListView_Left, 2, 80)
_GUICtrlListView_SetColumnWidth($cListView_Left, 3, 60)


$iLV_Left_Index = _GUIListViewEx_Init($cListView_Left, "", 0, 0, True, 128 + 256)


; Create Right ListView
$hListView_Right = _GUICtrlListView_Create($hGUI, "Path| Name | Duration |   ", 440, 82, 270, 290, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER))
_GUICtrlListView_SetExtendedListViewStyle($hListView_Right, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($hListView_Right, 0, 0)
_GUICtrlListView_SetColumnWidth($hListView_Right, 1, 185)
_GUICtrlListView_SetColumnWidth($hListView_Right, 2, 70)
_GUICtrlListView_SetColumnWidth($hListView_Right, 3, 0)


;ControlDisable($hGUI, "", HWnd(_GUICtrlListView_GetHeader($hListView_Right)))
$iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, 0, 0x00FF00)


; Create buttons
$cSave_Button = GUICtrlCreateButton("Save Playlist",  610, 380, 100, 25)


;------------------------------------------------------------------------------  View Playlist  -----------------------------------------
$TabSheet2 = GUICtrlCreateTabItem("View Playlist")




;------------------------------------------------------------------------------


;GUICtrlSetState(-1,$GUI_SHOW)


GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("&OK", 574, 440, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("&Close", 662, 440, 75, 25, $WS_GROUP)


;GUISetState(@SW_SHOW)
GUISetState()


; Register for dragging and editing
_GUIListViewEx_MsgRegister()


; Set the left ListView as active
_GUIListViewEx_SetActive($iLV_Left_Index)


While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit


EndSwitch
WEnd
  • Moderators
Posted

dynamitemedia,

Nothing to do with my UDF. :P

The righthand ListView is created using the GUIListView UDF and so AutoIt does not manage it within the tab structure, unlike the lefthand one which is created with the native functions and so appears only on the tab within which it was created. The Tabs tutorial in the Wiki explains about this in more detail. Possible solutions:

 

- 1. Use the native functions to create the righthand ListView and let AutoIt deal with it.

- 2. Do as explained in the Wiki tutorial and add code to hide/show the righthand ListView when necessary.

No prizes for guessing which I would recommend. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted (edited)

Thanks will check that out and post my results!

i added the following... and it works

; This is the current active tab
$iLastTab = 0


While 1
     Switch GUIGetMsg()
         Case $GUI_EVENT_CLOSE
             Exit
     EndSwitch
     $iCurrTab = _GUICtrlTab_GetCurFocus($PageControl1)
     If $iCurrTab <> $iLastTab Then
         $iLastTab = $iCurrTab
         Switch $iCurrTab
             Case 0
 ControlShow($hGUI, "", $hListView_Right)
 ControlShow($hGUI, "", $hListView_Right)
             Case 1
 ControlHide($hGUI, "", $hListView_Right)


         EndSwitch
     EndIf
WEnd
Edited by dynamitemedia
Posted

Hi Melba

I have an easy feature - double-clicking on a read-only 2 element combo is logically just a toggle; no dropdown list is required.

The only changed function is _GUIListViewEx_EditProcess(); I coded it the way I thought you would.

I'm assuming that it's better to upload the changed GuiListViewEx.au3 in a ZIP file rather than use a code box for this amount of code.

GUIListViewEx.zip

  • Moderators
Posted

jrsofsd,

 

I coded it the way I thought you would

Pretty close! :D

But I do not agree that a 2-element read-only combo is simply a toggle - the user might well decide to reselect the original value after looking at the alternative. And the content of the combo might well be dynamic and then the user could be very surprised with a toggle effect when only 2 options are available, especially if unaware of the current content. So I am not going to incorporate your suggestion - but thanks for having taken the time to both suggest and code it, it makes a nice change not to have to do it myself. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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