Jump to content

GUIListViewEx - New Version 13 Sep 21


Recommended Posts

  • Moderators

rony2006,

Looking forward to it - there is not much I can do otherwise as the function works fine on my coloured ListViews.

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

 

Link to post
Share on other sites
  • 1 month later...
  • Replies 609
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

[NEW VERSION] - 13 Sep 21 Changed:  - A small change to the $iAdded parameter value of 512 - this used to block ALL drag/drop operations, but now only blocks INTERNAL drag/drop. So to block

I've tested the header color example as 64 bit code on both Windows 7 and Windows 10. In both cases, it fails. There are no colors in the header. Then I've made a much smaller example that only c

Hi jimmy123j, I had the same issue with the dotted rectangle when the item is focused. @LarsJ provided a solution that worked fine for me and it seems to solve your problem too. 1) Running your

Posted Images

Hi Melba - Read through the Doc, and looked through the examples, but can't see anything.

Is there any way of selecting a row from code (so that it is highlighted) ?

I know I can click on a row to highlight it ready for an action, But I want to open the UDF with the top row highlighted at start.

Thanks

Link to post
Share on other sites
  • Moderators

Bruceway,

Look at the latest Beta code here - it should do what you want. If it does i will release a new version as Rony2006 seems to have vanished for the moment.

M23

PS: Welcome to the AutoIt forums.

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

 

Link to post
Share on other sites
  • Moderators

Bruceway,

Quote

Such a fast reply

Even by my standards 10 minutes is pretty fast - although I did have an over-ready solution for you!

Can you confirm that the modified UDF works for you?

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

 

Link to post
Share on other sites
5 hours ago, Melba23 said:

Can you confirm that the modified UDF works for you?

Don't know for others (though Rony2006's issue could be more a colour issue as selection seems to work fine for him too) but I'd like to let you know that the selection part works nicely in a test I just made.
In example 1, I added 1 line before the While loop, also inside a Case. All looks good in LV1 or LV2, scrolling, _EnsureVisible & tutti quanti :

_GUIListViewEx_SelectItem(15)

While 1
    Switch GUIGetMsg()
        ...
        Case $cDelete_Button
            _GUIListViewEx_Delete()
            _GUIListViewEx_SelectItem(10)

 

Link to post
Share on other sites

Melba23,

thank you again for this helpful UDF :)

Is there any chance to center the input cursor vertically? I'm working on a project using multi-line ListViews and it looks like this:

grafik.png.3ac53edc95e4e085696282df9c135122.png

If it is possible: Can you extend your UDF to address this wish?

Can the input font be changed specifically for individual LVs? Would be nice if a font handle from _WinAPI_CreateFont could be used...

If moving LV rows via drag/drop: Is the source and target index somewhere stored? Based on the LV (and its array @ [n][2] of your UDF) I fill another "shadow array" storing add. information that must also be rearranged (using _ArraySwap) if LV is sorted...

Edited by supersonic
3rd question :)
Link to post
Share on other sites
  • Moderators

supersonic,

I am afraid the answer to all of your questions is that I am not prepared to modify the UDF to meet your very specific requirements. But in more detail:

1: I do not see how you can vertically centre the text in a multi-line editbox - there are only the standard lines. And that is a Windows limitation, not one imposed by the UDF.

2. The edit font is the same as used by the ListView itself. This is determined by the (internal use only) __GUIListViewEx_GetLVFont function, so that is where you would have to insert different font details into the returned array if you wanted to alter the font used by the edit.

3. The details for the drag/drop rows are all to be found in the _GUIListViewEx_WM_LBUTTONUP_Handler function - $iGLVEx_DraggedIndex, $iGLVEx_InsertIndex, $iMultipleItems (count) - as well as the handles of the source and target ListView handles, although the index numbers of the ListViews concerned are also returned directly by _GUIListViewEx_EventMonitor after a drag/drop operation

So over to you if you want to fiddle around with the internals of the UDF - I have enough problems keeping the UDF up-to-date on standard ListViews!  And "Good luck", as every time I am asked to modify something I usually find that I have broken something else and it turns into a debugging nightmare.

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

 

Link to post
Share on other sites

M23,

thank you very much for your reply :)

I totally agree with you that the UDF can't meet all needs.

1. The effort will not be worth it - just to overcome Windows limitations.... I was hoping that there is an easy way....

2. If a LV font is set by _WinAPI_CreateFont (with custom size, width, ...), __GUIListViewEx_GetLVFont cannot get (~ ignores) these very custom/specific font settings - there seems to be an automatic "fallback" to the GUI font - I don't know why. Also, an edit font is "only" set via GUICtrlSetFont - this would then require a change to _WinAPI_CreateFont. I fully understand that such code intervention is not fun.

3. Perfect! These variables are all I need - currently I only need $iGLVEx_DraggedIndex, $iGLVEx_InsertIndex.

Regarding 1 + 2 maybe edit mode 9 (editable with user-defined function) could help me out to fit my very special needs without modifiying the UDF itself. I will give it a try...

Your UDF already fulfills many needs. I hope you continue to maintain it.

Edited by supersonic
Link to post
Share on other sites

HI Melba23

Yes I can confirm that the selection works fine Thank you.  Another question now I am trying to insert a line at the end, but when I do the redraw is emptying the previous lines in the array: - What am I doing wrong??

 

    ;_Check here for end of array and add a line if necessary
    $iRow = $iRow +1
    ;MsgBox($MB_SYSTEMMODAL,"GetClick", "Row " & $iRow & @CRLF _
    ;& "Ubd " & UBound($aItems))
    If UBound($aItems) = $iRow Then
        _ArrayDisplay($aItems)
        _GUIListViewEx_Insert("I|0|0|0")
        _ArrayDisplay($aItems)
        _ArrayAdd($aItems, "I|0|0|0")
        _ArrayDisplay($aItems)
    ;    $aItems = _GUIListViewEx_ReadToArray($hListView)
    ;    $iRow = $iRow +1
    ;    MsgBox($MB_SYSTEMMODAL,"GetClick", "Row " & $iRow & @CRLF _
    ;    & "Ubd " & UBound($aItems))
    ;    _GUICtrlListView_AddArray($hListView, $aItems)
    EndIf
    _GUIListViewEx_SelectItem($iRow)
EndFunc    ;==>GetClick

Link to post
Share on other sites
  • Moderators

Bruceway,

Thanks for the confirmation.

I am afraid i have no idea what that code snippet is supposed to show (and see here how to post code on the forum). What I can see is that you appear to be mixing my UDF commands with those from the the standard GUICtrlListView library - this will certainly result in tears at bedtime. Once you start using my UDF you MUST keep using its functions to manipulate the ListView as it maintains an internal shadow array of the contents and using the standard UDF commands means that the actual and shadow contents no longer match - a guarantee of disaster in short order.

Can you please post a short runnable script to show the problem - then I can either explain where you are going wrong - or start debugging!

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

 

Link to post
Share on other sites

OK - Posted WORKING Script - Where can I found your equivalent of  - Copy contents of Array to Listview (I have found Listview to Array).

Anyway feel free to take a look -  Press Ins to get a mouse click - and it should move down to the next row (at the bottom is where I am having trouble (adding a new Row to the array and listview!)

Treat me nicely, I'm as old as you and a newb...

; NOTES
; Array -> ListView
; _GUICtrlListView_AddArray
; ListView -> Array
; _GUIListViewEx_ReadToArray - Correct

; *** Includes ***
#include <Misc.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
;#include <GuiListView.au3>
#include <GuiListViewEx_Beta.au3>
#include <ButtonConstants.au3>
#include <File.au3>

; *** Global Variables ***
Global $sSelectedRow, $iRet, $iIndex, $iRow, $iColumn
Global $iRowCounter, $aSelected
Global $bMouseClick = False
Global $dll = Null
Global $iMouseX = 0
Global $iMouseY = 0
Global $iMouseType = 0
Global $aItems[4][4]
Global $iEditMode = 0

#Region ### START Koda GUI section ### Form=
Global $_1 = GUICreate("Array Create", 402, 374, 257, 223)
GUISetBkColor(0xE0FFFF)
;Global $hListView = GUICtrlCreateListView("X   |Y   |Type", 12, 8, 220, 272)
;GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
;GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
;GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
Global $hLabelStatus = GUICtrlCreateLabel("Status", 49, 286, 148, 17)
Global $hButtonPlus = GUICtrlCreateButton("+", 66, 320, 20, 20)
Global $hButtonMinus = GUICtrlCreateButton("-", 166, 320, 20, 20)
Global $hButtonLeft = GUICtrlCreateButton("L", 96, 320, 20, 20)
Global $hButtonDown = GUICtrlCreateButton("D", 116, 338, 20, 20)
Global $hButtonRight = GUICtrlCreateButton("R", 136, 320, 20, 20)
Global $hButtonUp = GUICtrlCreateButton("U", 116, 302, 20, 20)
Global $Group1 = GUICtrlCreateGroup("Group1", 240, 8, 153, 113)
Global $hRadioSupplies = GUICtrlCreateRadio("Supplies", 248, 24, 113, 17)
Global $hRadioCoins = GUICtrlCreateRadio("Coins", 248, 60, 153, 17)
Global $hRadioProduction = GUICtrlCreateRadio("Production", 248, 96, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
; Added outsiede of Koda as New Ctrl is not in Koda
Global $hListView = _GUICtrlListView_Create($_1, "Num |X   |Y   |Type", 12, 8, 220, 240, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER))
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
_GUICtrlListView_SetColumnWidth($hListView, 0, 50)
_GUICtrlListView_SetColumnWidth($hListView, 1, 50)
_GUICtrlListView_SetColumnWidth($hListView, 2, 50)
_GUICtrlListView_SetColumnWidth($hListView, 3, 50)
_GUICtrlListView_SetInsertMarkColor($hListView, 0)

HotKeySet("{ESC}", "Terminate")
HotKeySet("{INSERT}", "GetClick")
HotKeySet("{DELETE}", "RemoveClick")

; *** Setup ready for first run ***
_GUICtrlListView_AddArray($hListView, $aItems)
LoadArray()
; Initiate LVEx - no count - green insert parameter - no drag image
$iLV_Right_Index = _GUIListViewEx_Init($hListView, $aItems, 0, 0x00FF00)
; Register for sorting, dragging and editing
_GUIListViewEx_MsgRegister()
; Set $iRowCounter to start
$iRowCounter = 0
; Set Blue selection to start
_GUIListViewEx_SelectItem($iRowCounter)
; Set $hRadioSupplies by default
GUICtrlSetState($hRadioSupplies, $GUI_CHECKED)
; All mouse coords are taken from Window sizing.
AutoItSetOption('MouseCoordMode', 0) ;1 is screen/0 is active window

; Main Loop
; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Terminate()
            ExitLoop

        Case $hButtonPlus
            GetClick()

        Case $hButtonMinus
            RemoveClick()

        Case $hButtonUp

        Case $hButtonDown

        Case $hButtonRight

        Case $hButtonLeft


    EndSwitch
    ; Routines for _GUIListViewEx - Functions
    $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error)
    EndIf
    Switch @extended
        Case 0
            ; No event detected
        Case 1
            If $vRet = "" Then
                MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF)
            Else
                _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8)
            EndIf
        Case 2
            If $vRet = "" Then
                MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF)
            Else
                _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8)
            EndIf
        Case 3
            MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF)
        Case 4
            MsgBox($MB_SYSTEMMODAL, "Dragged", "From:To" & @CRLF & $vRet & @CRLF)
    EndSwitch
WEnd

Func SaveArray()
    Local $sMyBox = Null
    $aItems = _GUIListViewEx_ReadToArray($hListView, 0)
    _ArrayDisplay ($aItems, "ArrayWrite", Default, 8)
    ;If $aItems[UBound($aItems)] = "I|0|0|0" Then
    ;   MsgBox($MB_SYSTEMMODAL, "SaveArray", "Matched last line")
;   EndIf
        $sMyBox = MsgBox(4100, "", "Save Y/N")
    If $sMyBox = 6 Then ;6=Yes  7=NO
        _FileWriteFromArray("G:\Documents\AutoIt3\NewFOE-5MArray.txt", $aItems, 0)
    EndIf
EndFunc ;==>SaveArray

Func LoadArray()
    If Not _FileReadToArray("G:\Documents\AutoIt3\NewFOE-5MArray.txt", $aItems, 0, "|") Then
    ;   MsgBox($MB_SYSTEMMODAL,"", @error)
        Dim $aItems[4][4]
    EndIf
    _ArrayDisplay($aItems, "ArrayLoad", Default, 8)
EndFunc ;==>LoadArray

Func GetClick()
    $sSelectedRow = _GUIListViewEx_GetLastSelItem() ; Returns - Return | Index | Row | Column
    $aSelected = GetSelectedItem($sSelectedRow)
    $iRet = $aSelected[0]
    $iIndex = $aSelected[1]
    $iRow = $aSelected[2]
    $iColumn = $aSelected[3]
;   MsgBox($MB_SYSTEMMODAL, "listview item", "Ret  : " & $iRet & @CRLF _
;   & "Index: " & $iIndex & @CRLF _
;   & "Row  : " & $iRow & @CRLF _
;   & "Col  : " & $iColumn)
    $bMouseClick = False
    GetMouseCoords($iMouseX, $iMouseY)
    GUICtrlSetData($hLabelStatus, $iRow+1 & " | " & $iMouseX & " | " & $iMouseY & " | " & $iMouseType)
    _GUICtrlListView_AddSubItem($hListView, $iRow, $iRow+1, 0)
    $aItems[$iRow][0] = $iRow+1
    _GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseX, 1)
    $aItems[$iRow][1] = $iMouseX
    _GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseY, 2)
    $aItems[$iRow][2] = $iMouseY
    _GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseType, 3)
    $aItems[$iRow][3] = $iMouseType

    ;_Check here for end of array and add a line if necessary
    $iRow = $iRow +1
    ;MsgBox($MB_SYSTEMMODAL,"GetClick", "Row " & $iRow & @CRLF _
    ;& "Ubd " & UBound($aItems))
    If UBound($aItems) = $iRow Then
        _ArrayDisplay($aItems)
        _GUIListViewEx_Insert("I|0|0|0")
        _ArrayDisplay($aItems)
        _ArrayAdd($aItems, "I|0|0|0")
        _ArrayDisplay($aItems)
    ;   $aItems = _GUIListViewEx_ReadToArray($hListView)
    ;   $iRow = $iRow +1
    ;   MsgBox($MB_SYSTEMMODAL,"GetClick", "Row " & $iRow & @CRLF _
    ;   & "Ubd " & UBound($aItems))
    ;   _GUICtrlListView_AddArray($hListView, $aItems)
    EndIf
    _GUIListViewEx_SelectItem($iRow)
EndFunc ;==>GetClick

Func RemoveClick()
    $iRow = $iRow -1
    _GUIListViewEx_SelectItem($iRow)
    _GUICtrlListView_AddSubItem($hListView, $iRow, "", 0)
    $aItems[$iRow][0] = ""
    _GUICtrlListView_AddSubItem($hListView, $iRow, "", 1)
    $aItems[$iRow][1] = ""
    _GUICtrlListView_AddSubItem($hListView, $iRow, "", 2)
    $aItems[$iRow][2] = ""
    _GUICtrlListView_AddSubItem($hListView, $iRow, "", 3)
    $aItems[$iRow][3] = ""
    ;_ArrayDisplay($aItems, "AddClick", Default, 8)
    $iMouseX = 0
    $iMouseY = 0
    GUICtrlSetData($hLabelStatus, "Cleared")
EndFunc ;==>RemoveClick

Func GetMouseCoords(ByRef $iMouseX, ByRef $iMouseY)
    $dll = DllOpen("user32.dll")
    While $bMouseClick = False
        Sleep(10) ; This enough to prevent CPU overload <<<<<<<<<<<<<<<<<<<<<<<<
        If _IsPressed("01", $dll) Then
            $MousePos = MouseGetPos()
            ConsoleWrite("Mouse Counter= " & $iRowCounter & " | " & _
                    "X= " & $MousePos[0] & " | " & _
                    "Y= " & $MousePos[1] & " | " & @CRLF)
            $iMouseX = $MousePos[0]
            $iMouseY = $MousePos[1]
            $bMouseClick = True
            While _IsPressed("01", $dll)
                Sleep(10)
            WEnd
        EndIf
    WEnd
    DllClose($dll)
EndFunc ;==>GetMouseCoords

Func GetSelectedItem($SelectedRow)
    Local $Selected
    ;MsgBox($MB_SYSTEMMODAL, "GetSelectedItem", $sSelectedRow)
    $Selected = StringSplit($SelectedRow, "|") ; Returns - Ret[0] Index[1] Row[2] [3]
    Return $Selected
EndFunc ;==>GetSelectedItem

Func Terminate()
    DllClose($dll)
    SaveArray()
    Exit 0
EndFunc ;==>Terminate

 

Link to post
Share on other sites

Yes sorry I had misread your code. Replace the _GUICtrlListView_AddSubItem with functions from the UDF as Melba alluded.

I think the function you need is _GUIListViewEx_Insert or _GUIListViewEx_ChangeItem to set subitem values.

Edited by dmob
Link to post
Share on other sites

dmob - I can do, but that bit of code actually works fine? The issue is with this bit.

When I reach the bottom of the array, I want to add a new line and continue, but when I add 

_GUIListViewEx_Insert("I|0|0|0")

The Listview adds a new line, but blanks all previous content.

If UBound($aItems) = $iRow Then
        _ArrayDisplay($aItems)
        _GUIListViewEx_Insert("I|0|0|0")
        _ArrayDisplay($aItems)
        _ArrayAdd($aItems, "I|0|0|0")
        _ArrayDisplay($aItems)
    EndIf
    _GUIListViewEx_SelectItem($iRow)

 

Link to post
Share on other sites
9 minutes ago, Bruceway said:

but that bit of code actually works fine?

Yes, for the listview display, but that would definitely confuse the UDF as it has no idea of the newly added item/subitems.

As Melba explained, do not mix the listview functions between standard and _GUIListViewEx_ functions, after initialising the UDF.

Edited by dmob
Link to post
Share on other sites

FOUND IT!!!! - Thanks dmob

Have changed the following - Removed  _GUICtrlListView_AddSubItem  & substituted for  _GUiCtrlListViewEx_ChangeItem

and it all works.... (Other than Melba's parameters being the other way round 😛)

GetMouseCoords($iMouseX, $iMouseY)
    GUICtrlSetData($hLabelStatus, $iRow+1 & " | " & $iMouseX & " | " & $iMouseY & " | " & $iMouseType)
    _GUIListViewEx_ChangeItem($iLV, $iRow, 0, $iRow+1)
    ;_GUICtrlListView_AddSubItem($hListView, $iRow, $iRow+1, 0)
    $aItems[$iRow][0] = $iRow+1
    _GUIListViewEx_ChangeItem($iLV, $iRow, 1, $iMouseX)
    ;_GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseX, 1)
    $aItems[$iRow][1] = $iMouseX
    _GUIListViewEx_ChangeItem($iLV, $iRow, 2, $iMouseY)
    ;_GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseY, 2)
    $aItems[$iRow][2] = $iMouseY
    _GUIListViewEx_ChangeItem($iLV, $iRow, 3, $iMouseType)
    ;_GUICtrlListView_AddSubItem($hListView, $iRow, $iMouseType, 3)
    $aItems[$iRow][3] = $iMouseType

Sometimes I am so dumb, it pleases people!!

Link to post
Share on other sites
  • Moderators

Bruceway,

Glad you got your script working.

dmob,

Are you looking for a job as an advisor on the UDF? Thanks for helping out.

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

 

Link to post
Share on other sites
  • Melba23 changed the title to GUIListViewEx - New Version 13 Sep 21

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...