Jump to content

Recommended Posts

  • Moderators
Posted

[bUGFIX VERSION] - 19 Nov 14

Fixed: Multiple item drag/drop was not working as the result of previous change.

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

 

  • 1 month later...
Posted (edited)

little bug...
 
drag the last item (tom 4) down, but keep it inside the LV control, then release it - you'll see what i mean
 
you can test this example, or any of the examples included with the function package

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

#include "GUIListViewEx.au3"

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

; Create ListViews
$cLV_Tom = GUICtrlCreateListView("Tom",10, 30, 300, 300)
_GUICtrlListView_SetColumnWidth($cLV_Tom, 0, 140)

; Create arrays and fill ListViews
Global $aTom[5]
For $i = 0 To 4
    $aTom[$i] = "Tom " & $i
    GUICtrlCreateListViewItem($aTom[$i], $cLV_Tom)
Next

; Initiate ListViews and set differing external drag/drop states
GUICtrlCreateLabel("Normal", 10, 10, 180, 20)
$iLV_Tom = _GUIListViewEx_Init($cLV_Tom, $aTom, 0, 0, True) ; External drag & drop - items deleted on drag

GUISetState()

_GUIListViewEx_MsgRegister()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

also, i might suggest adding a return value after a successful call to _GUIListViewEx_WM_LBUTTONUP_Handler() if you think it might be worth while

in my case, i need to re-order items in a file after the LV is re-ordered

Edited by iCode

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

  • Moderators
Posted (edited)

iCode,

Thanks for the bug report. This Beta UDF resolves the problem for me - can you please confirm it works for you too: :)

<snip>

I cannot see how to provide a return from the WM_LBUTTONUP handler as there is no sensible place to read it. But there is a flag in the UDF itself that you can read to detect the end of a drag operation - as shown in this example:

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

#include "GUIListViewEx_Mod.au3"

Global $bDraggingFlag = False ; Create flag <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

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

; Create ListViews
$cLV_Tom = GUICtrlCreateListView("Tom",10, 30, 300, 300)
_GUICtrlListView_SetColumnWidth($cLV_Tom, 0, 140)

; Create arrays and fill ListViews
Global $aTom[5]
For $i = 0 To 4
    $aTom[$i] = "Tom " & $i
    GUICtrlCreateListViewItem($aTom[$i], $cLV_Tom)
Next

; Initiate ListViews and set differing external drag/drop states
GUICtrlCreateLabel("Normal", 10, 10, 180, 20)
$iLV_Tom = _GUIListViewEx_Init($cLV_Tom, $aTom, 0, 0, True) ; External drag & drop - items deleted on drag

GUISetState()

_GUIListViewEx_MsgRegister()

While 1

    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    ; Read the UDF internal flag
    If $iGLVEx_Dragging Then
        ; If dragging is occuring
        $bDraggingFlag = True ; Set flag
    Else
        ; No drag occuring and flag set
        If $bDraggingFlag Then
            ; Drag has ended, so clear flag
            $bDraggingFlag = False
            ; Do whatever you require at this point
            ConsoleWrite("Drag over" & @CRLF)
        EndIf
    EndIf
    ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Does that satisfy your requirement? :huh:

M23

Edited by Melba23
Beta code removed

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

hi Melba - works fine for me also!

there's still an issue with flickering of the dragged item when you drag it off of the list, or outside of list content, but that's a rather minor visual thing

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

  • Moderators
Posted

iCode,

 

works fine for me also!

Great - I will release a new version soon. :)

 

there's still an issue with flickering of the dragged item when you drag it off of the list, or outside of list content, but that's a rather minor visual thing

And all to do with Windows' implementation of dragging, not with AutoIt as such. Not a lot I can do about that I am afraid. :(>

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 (edited)

[bUGFIX VERSION] - 24 Dec 14

Fixed: Bottom item no longer moves to top if dragged into empty space below in the ListView.

New zip in the first post. :)

M23

Edited by Melba23
Reworded for clarity

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

@Melba23 - are you sure you replaced the attachment in the first post?

dragging below the list (but within the LV) does not move the bottom item to the top for me - i just quickly tried it using the first LV in example 5

other than that it works great :)

thanks!

FUNCTIONS: WinDock (dock window to screen edge) | EditCtrl_ToggleLineWrap (line/word wrap for AU3 edit control) | SendEX (yet another alternative to Send( ) ) | Spell Checker (Hunspell wrapper) | SentenceCase (capitalize first letter of sentences)

CODE SNIPPITS: Dynamic tab width (set tab control width according to window width)

  • Moderators
Posted (edited)

iCode,

 

dragging below the list (but within the LV) does not move the bottom item to the top for me

I am confused. I thought that bottom item moving to the top when dragged down within the ListView was the bug you wanted me to fix - so the fact that it does not means that I have indeed fixed it. The UDF code in the zip is the same as the Beta I posted earlier - I have just downloaded it to check. :)

M23

Edit: Re-reading the bugfix post, I can see why you might have interpreted it incorrectly. I have reworded the explanation to make it clearer what behaviour was changed. ;)

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

I was having a huge headache trying to figure out what I was doing wrong because none of my cells were editable.  Your examples worked, but when I copy/pasted them into my script they again couldn't be edited.  I couldn't figure out why until I started line-by-line commenting out of my other options/variables/etc.

So it turns out... your UDF isn't compatible with the following:

AutoItSetOption ( "MouseCoordMode", 0 )

Just an FYI in case anyone shows up here in the same situation.

  • Moderators
Posted (edited)

LondonNDIB,

Thanks for the report. Please try this Beta version which should work regardless of the MouseCoordMode set by the user:

<snip>

M23

Edited by Melba23
Beta code removed

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

Thanks!  But are there other changes I should know about in this Beta vs. the one I downloaded from the start of this that might break my script?  Or is this specifically to resolve this issue?

  • Moderators
Posted

LondonNDIB,

No, the only change I made was to put the UDF into the default MouseCoordMode mode when dealing internally with the mouse and resetting the user-defined mode before returning control to the main script. Look for the 4 Opt("MouseCoordMode", #) lines to see where I did this. ;)

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

Great.  When you said it was beta I didn't know if it was a fix specific to my post or if it was some long-worked-on beta version that happened to also include this fix.  I'm clear now :)  Thanks so much for the fast response to my issue!  

  • Moderators
Posted

LondonNDIB,

Delighted I could fix it so quickly, unlike some bugs! I will release a new version of the UDF soon, but I doubt that it will differ much from the Beta above, so go ahead and use that for the moment. ;)

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

Is there a simple enough way to programmically alter a cell's value?  I see your function: 

; _GUIListViewEx_EditItem:             Edit ListView items programatically

Which sounded exactly like what I want, but that makes the cell editable, but doesn't directly edit it.

What i'm looking to do is on-the-fly cell validation.  For a given cell, I validate down in this section of code:

$aRet = _GUIListViewEx_EditOnClick($iEditMode) ; Use combos to change EditMode
    ; Array only returned AFTER EditOnClick process - so check array exists
    If IsArray($aRet) Then
                ; This looks like a good place to put in some validation code.  This fires immediately after a cell is edited
                ; check if the input is valid, if not then revert.  But how??


        ; Uncomment to see returned array
        ;_ArrayDisplay($aRet, @error)
    EndIf

And actually, "revert" is dead easy for my case because the cell in question always starts out blank.  So really I just need a way to programically delete the contents of a particular cell.

I tried just using your _GUIListViewEx_EditItem function followed by a Send({DEL}{ENTER}) but it does't work... it leaves me with the cell awaiting input (as though Send was completely ignored).

I also figured I could just assign "" to that part of "the" array and then invoke your "for internal use only" _GUIListViewEx_ReWriteLV function, but I got pretty confused pretty quick there and thought I better seek assistance before delving further into a function that basically tells me to keep the heck out!   :)

  • Moderators
Posted (edited)

LondonNDIB,

 

but I got pretty confused pretty quick there and thought I better seek assistance before delving further into a function that basically tells me to keep the heck out!

A very sensible reaction! :D

Try this new Beta with a new function _GUIListViewEx_ChangeItem: Change ListView item content programmatically - I think it does what you require:

<snip>

And here is an example of it working:

#include <GUIConstantsEx.au3>

#include "GUIListViewEx_Mod.au3"

Opt("MouseCoordMode", 0) ; Just to show that this still works

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

$cLV = GUICtrlCreateListView("Col 1         |Col 2         ", 10, 10, 480, 300)
For $i = 0 To 4
    GUICtrlCreateListViewItem("Item " & $i & "|SubItem " & $i & "-1", $cLV)
Next
; Read content and initiate ListView for editing
$aArray = _GUIListViewEx_ReadToArray($cLV)
$iLVIndex = _GUIListViewEx_Init($cLV, $aArray, 0, Default, 0, 2)

$cButton_1 = GUICtrlCreateButton("Change Data", 10, 350, 80, 30)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1
            $aArray = _GUIListViewEx_ReturnArray($iLVIndex)
            _ArrayDisplay($aArray, "Original", Default, 8)
            $aArray = _GUIListViewEx_ChangeItem($iLVIndex, 3, 1, "New Data")
            _ArrayDisplay($aArray, "Changed", Default, 8)
    EndSwitch
WEnd
I have also reworded the description of the existing "edit" functions to clarify that they only open items for subsequent user editing. ;)

M23

Edited by Melba23
Removed Beta code

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)

Well aren't you Mr. Accommodating!  Nice, thanks!

I'll test out the new function shortly.   Edit:  WORKS PERFECTLY!

And I'm a little late here expressing how impressed I am with this incredibly useful UDF.  Really great job. 

Edited by LondonNDIB
  • Moderators
Posted

LondonNDIB,

 

Well aren't you Mr. Accommodating!

I like to offer support for my UDFs when I can. ;)

 

WORKS PERFECTLY!

Any other requests before I release a new version this weekend? :whistle:

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...