Jump to content

GUIListViewEx - New Version 21 May 22


Recommended Posts

  • Replies 660
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

[NEW VERSION] - 21 May 22 Fixed: The _SelectItem function was not correctly clearing earlier selections when SingleSel style was used. And the selection made using the function was not reflected

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

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

Posted Images

  • Moderators

Champak,

I need a reproducer script if you want me to do anything more debugging - sorry.

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
  • Moderators

Champak,

Here is the UDF Example 6 script using a separate handler for WM_NOTIFY and it works fine for me:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <EditConstants.au3>

#include <File.au3>
#include <Misc.au3>
#include <String.au3>
#include <Array.au3>

#include "GUIListViewEx.au3"

Global  $iYellow = "0xFFFF00", _
        $iLtBlue = "0xCCCCFF", _
        $iGreen = "0x00FF00", _
        $iBlack = "0x000000", _
        $iRed = "0xFF0000", _
        $iBlue = "0x0000FF", _
        $iWhite = "0xFFFFFF"

Global $sRet

$hGUI = GUICreate("Coloured ListView Example", 1000, 510)

; Create ListView
GUICtrlCreateLabel("Full row select - right click item for colour options", 10, 10, 400, 20)
$cLV_1 = GUICtrlCreateListView("Zero Column|One Column|Two Column|Three Column", 10, 30, 480, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))

_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
For $i = 0 To 3
    _GUICtrlListView_SetColumnWidth($cLV_1, $i, 100)
Next

; Create array and fill listview
Global $aLVArray_1[6][4]
For $i = 0 To 5
    $sData = "Item " & $i & "-0"
    $aLVArray_1[$i][0] = $sData
    For $j = 1 To 3
        $sData &= "|SubItem " & $i & "-" & $j
        $aLVArray_1[$i][$j] = "SubItem " & $i & "-" & $j
    Next
    GUICtrlCreateListViewItem($sData, $cLV_1)
Next

; Initiate ListView = sort on column click - editable headers - header colours - user colours
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 0, 0, True, 1 + 8 + 32 + 16)

; Set column edit status
_GUIListViewEx_SetEditStatus($iLVIndex_1, 1)                   ; Default = standard text edit
_GUIListViewEx_SetEditStatus($iLVIndex_1, 2, 2, "1|2|3", 1)    ; 2 = Read-only combo
_GUIListViewEx_SetEditStatus($iLVIndex_1, 3, 3)                ; 3 = DTP

; Create colour array - 0-based to fit ListView content
Global $aLVCol_1[6][4] = [[$iYellow & ";" & $iBlue], _          ; Format TxtCol;BkCol
                          ["", ";" & $iGreen, $iRed & ";"], _   ; Use leading/trailing ; to indicate if single colour is TxtCol or BkCol
                          [";", "",  $iWhite & ";" & $iBlack]]  ; Default (or no change) can be ";" or ""
; Load colour array into ListView
_GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1)

; Set header data
Global $aHdrData[][] = [["Tom",               "Dick",              "Harry",           "Fred"], _                ; As colour is enabled, these will replace original titles
                         ["0xFF8080;0x8888FF", "0xFEFEFE;0x000000", "",                "0xFFFF00;0x00FF80"], _  ; Col 2 will use default colours
                         ["",                  "",                  @TAB & "H1|H2|H3", ""], _                   ; Col 2 readonly combo; Col 1 & 3 text
                         [0,                   0,                   100,               0]]                      ; Col 2 not resizeable - fixed 100 pixel width

;Global $aHdrData[][] = [[Default, "", "",  ""], _
;                       ["", Default, "",  ""], _
;                       ["", "", "",  Default], _
;                       [0,  0,  Default, 0]]
_GUIListViewEx_LoadHdrData($iLVIndex_1, $aHdrData)

; Create context menu for native ListView
$mContextmenu = GUICtrlCreateContextMenu($cLV_1)
$mWhtTxt = GUICtrlCreateMenuItem("White text", $mContextmenu)
$mYelTxt = GUICtrlCreateMenuItem("Yellow text", $mContextmenu)
$mBluTxt = GUICtrlCreateMenuItem("Cyan text", $mContextmenu)
$mGrnTxt = GUICtrlCreateMenuItem("Green text", $mContextmenu)
$mBlkTxt = GUICtrlCreateMenuItem("Black text", $mContextmenu)
GUICtrlCreateMenuItem("", $mContextmenu)
$mWhtFld = GUICtrlCreateMenuItem("White field", $mContextmenu)
$mRedFld = GUICtrlCreateMenuItem("Red field", $mContextmenu)
$mBluFld = GUICtrlCreateMenuItem("Blue field", $mContextmenu)
$mGrnFld = GUICtrlCreateMenuItem("Green field", $mContextmenu)
$mBlkFld = GUICtrlCreateMenuItem("Black field", $mContextmenu)
GUICtrlCreateMenuItem("", $mContextmenu)
$mDefTxt = GUICtrlCreateMenuItem("Default txt", $mContextmenu)
$mDefFld = GUICtrlCreateMenuItem("Default field", $mContextmenu)
$mDefBoth = GUICtrlCreateMenuItem("Default both", $mContextmenu)

; Create empty UDF ListView
GUICtrlCreateLabel("Single cell select - use controls below for colour options", 510, 10, 400, 20)
$cLV_2 = _GUICtrlListView_Create($hGUI, "", 510, 30, 480, 260, BitOr($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $WS_BORDER))
_GUICtrlListView_SetExtendedListViewStyle($cLV_2, $LVS_EX_FULLROWSELECT)
; Initiate to get index - empty array passed with no cols so initially set for 1D return array - user coloured items and headers + single cell select
$iLVIndex_2 = _GUIListViewEx_Init($cLV_2, "", 0, 0, True, 32 + 1024) ; 16 +
; Set required colours for ListView elements - change = pink field
Local $aSelCol[4] = [Default, "0xFFCCCC", Default, Default]
_GUIListViewEx_SetDefColours($iLVIndex_2, $aSelCol)

; Create buttons for LH ListView

GUICtrlCreateGroup("", 10, 300, 480, 160)

GUICtrlCreateLabel("Up/Down", 25, 320, 80, 20, $SS_CENTER)
$cUp = GUICtrlCreateButton("Up", 25, 340, 80, 30)
$cDown = GUICtrlCreateButton("Down", 25, 380, 80, 30)

GUICtrlCreateLabel("Ins/Del", 150, 320, 80, 20, $SS_CENTER)
$cIns = GUICtrlCreateButton("Ins", 150, 340, 80, 30)
$cDel = GUICtrlCreateButton("Del", 150, 380, 80, 30)

GUICtrlCreateLabel("Ins/Del Spec", 275, 320, 80, 20, $SS_CENTER)
$cInsSpec = GUICtrlCreateButton("Insert Spec", 275, 340, 80, 30)
$cDelSpec = GUICtrlCreateButton("Delete Spec", 275, 380, 80, 30)

GUIStartGroup()
$cRad_Row = GUICtrlCreateRadio(" Row", 160, 425, 40, 20)
GUICtrlSetState($cRad_Row, $GUI_CHECKED)
$cRad_Col = GUICtrlCreateRadio(" Col", 220, 425, 40, 20)
$cSpecChoose = GUICtrlCreateInput(0, 275, 420, 80, 30)
GUICtrlSetFont($cSpecChoose, 18)
GUICtrlCreateUpdown($cSpecChoose, BitOr($UDS_WRAP, $UDS_ALIGNRIGHT))
GUICtrlSetLimit(-1, 9, 0)

GUICtrlCreateLabel("Read", 400, 320, 80, 20, $SS_CENTER)
$cContent = GUICtrlCreateButton("Content", 400, 340, 80, 30)
$cColour = GUICtrlCreateButton("Colour", 400, 380, 80, 30)
$cHeaders = GUICtrlCreateButton("Headers", 400, 420, 80, 30)

; Create colour controls for UDF ListView

GUICtrlCreateGroup("", 510, 300, 480, 160)

GUICtrlCreateLabel("Row", 525, 320, 80, 20, $SS_CENTER)
$cColRow = GUICtrlCreateInput(0, 525, 340, 80, 30, $ES_READONLY)
GUICtrlSetFont($cColRow, 18)
GUICtrlCreateUpdown($cColRow, BitOr($UDS_WRAP, $UDS_ALIGNRIGHT))
GUICtrlSetLimit(-1, 9, 0)

GUICtrlCreateLabel("Column", 640, 320, 80, 20, $SS_CENTER)
$cColCol = GUICtrlCreateInput(0, 640, 340, 80, 30, $ES_READONLY)
GUICtrlSetFont($cColCol, 18)
GUICtrlCreateUpdown($cColCol, BitOr($UDS_WRAP, $UDS_ALIGNRIGHT))
GUICtrlSetLimit(-1, 9, 0)

GUICtrlCreateLabel("Colour", 770, 320, 80, 20, $SS_CENTER)
$cColVal = GUICtrlCreateInput("0x000000", 770, 340, 80, 30, $ES_READONLY)
GUICtrlSetFont($cColVal, 11)
$cColChoose = GUICtrlCreateButton("Select Colour", 770, 380, 80, 30)

GUICtrlCreateLabel("Text/Field", 900, 320, 80, 20)
GUIStartGroup()
$cRad_Txt = GUICtrlCreateRadio(" Text", 900, 340, 80, 20)
GUICtrlSetState($cRad_Txt, $GUI_CHECKED)
$cRad_Fld = GUICtrlCreateRadio(" Field", 900, 380, 80, 20)
GUIStartGroup()

$cSetCol = GUICtrlCreateButton("Set Colour", 525, 380, 195, 30)

$cNewSel = GUICtrlCreateButton("Selected Cell in Orange", 525, 420, 150, 30)
$cDefSel = GUICtrlCreateButton("Selected Cell in  Blue", 700, 420, 150, 30)

; Create additional buttons
$cSave = GUICtrlCreateButton("Save LH ListView", 340, 470, 150, 30)
$cLoad = GUICtrlCreateButton("Load RH ListView", 510, 470, 150, 30)
GUICtrlSetState($cLoad, $GUI_DISABLE)
$cExit = GUICtrlCreateButton("Exit", 880, 470, 110, 30)

; If colours used then this function must be run BEFORE GUISetState
_GUIListViewEx_MsgRegister(False)

GUIRegisterMsg(0x004E, "_WM_NOTIFY_Handler") ; $WM_NOTIFY)

GUISetState()

;_GUIListViewEx_SetEditKey("^2D")

MsgBox(0, "Dragging", "You can drag and reorder the headers on the left-hand ListView" & @CRLF & "<----------------------------")

While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE, $cExit
            Exit

        Case $cSave
            _GUIListViewEx_SaveListView($iLVIndex_1, "Save.lvs")
            GUICtrlSetState($cLoad, $GUI_ENABLE)
        Case $cLoad
            _GUIListViewEx_LoadListView($iLVIndex_2, "Save.lvs") ; But return now forced to 2D

        Case $cUp
            _GUIListViewEx_SetActive($iLVIndex_1)
            _GUIListViewEx_Up()

        Case $cDown
            _GUIListViewEx_SetActive($iLVIndex_1)
            _GUIListViewEx_Down()

        Case $cIns
            ; Insert row/col
            _GUIListViewEx_SetActive($iLVIndex_1)
            If GUICtrlRead($cRad_Row) = $GUI_CHECKED Then
                _GUIListViewEx_Insert("New Row")
            Else
                _GUIListViewEx_InsertCol("New Col")
            EndIf

        Case $cDel
            ; Delete row/col
            _GUIListViewEx_SetActive($iLVIndex_1)
            If GUICtrlRead($cRad_Row) = $GUI_CHECKED Then
                _GUIListViewEx_Delete()
            Else
                _GUIListViewEx_DeleteCol()
            EndIf

        Case $cInsSpec
            ; Insert spec row/col
            $iValue = GUICtrlRead($cSpecChoose)
            If GUICtrlRead($cRad_Row) = $GUI_CHECKED Then
                _GUIListViewEx_InsertSpec($iLVIndex_1, $iValue, "Spec Row")
            Else
                _GUIListViewEx_InsertColSpec($iLVIndex_1, $iValue, "Spec Col")
            EndIf

        Case $cDelSpec
            ; Delete spec row/col
            $iValue = GUICtrlRead($cSpecChoose)
            If GUICtrlRead($cRad_Row) = $GUI_CHECKED Then
                _GUIListViewEx_DeleteSpec($iLVIndex_1, $iValue)
            Else
                _GUIListViewEx_DeleteColSpec($iLVIndex_1, $iValue)
            EndIf

        Case $cContent
            $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1)
            _ArrayDisplay($aRet, "", Default, 8)
        Case $cColour
            $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 2)
            _ArrayDisplay($aRet, "", Default, 8)
        Case $cHeaders
            $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 4)
            _ArrayDisplay($aRet, "", Default, 8)

        Case $cColChoose
            $sRet = _ChooseColor(2 , 0, 0, $hGUI)
            ; Check valid colour returned
            If $sRet <> -1 Then
                GUICtrlSetData($cColVal, $sRet)
            EndIf
        Case $cSetCol
            ; Read colour
            $sColSet = GUICtrlRead($cColVal)
            ; Set as text or field
            If GUICtrlRead($cRad_Txt) = $GUI_CHECKED Then
                $sColSet &= ";"
            Else
                $sColSet = ";" & $sColSet
            EndIf
            ; Read location
            $iRow = GUICtrlRead($cColRow)
            $iCol = GUICtrlRead($cColCol)
            ; Set colour
            _GUIListViewEx_SetColour($iLVIndex_2, $sColSet, $iRow, $iCol)

        Case $cNewSel
            ; Set orange field & black text for single cell selection = other colours unchanged
            Local $aSelCol[4] = ["", "", "0x000000", "0xFF8000"]
            _GUIListViewEx_SetDefColours($iLVIndex_2, $aSelCol)
        Case $cDefSel
            ; Reset default white on blue for single cell selection - other colours unchanged
            Local $aSelCol[4] = ["", "", Default, Default]
            _GUIListViewEx_SetDefColours($iLVIndex_2, $aSelCol)

        Case $mWhtTxt To $mDefBoth
            ; Check context menu items
            _SetColour($iMsg)

    EndSwitch

    $vRet = _GUIListViewEx_EventMonitor()
    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
            Local $aRet = StringSplit($vRet, ":")
            MsgBox($MB_SYSTEMMODAL, "Dragged", "From ListView " & $aRet[1] & @CRLF & "To ListView " & $aRet[2])
    EndSwitch

WEnd

Func _SetColour($iCID)

    ; Get information on where last right click occurred within ListView
    Local $aContext = _GUIListViewEx_ContextPos()
    If @error Then
        Return
    EndIf

    ; Set new colour required
    Local $sColSet = "", $aColArray, $aSplit, $fDef = False
    Switch $iCID
        Case $mWhtTxt
            $sColSet = $iWhite & ";" ; Text colour followed by ";"
        Case $mYelTxt
            $sColSet = $iYellow & ";"
        Case $mBluTxt
            $sColSet = $iLtBlue & ";"
        Case $mGrnTxt
            $sColSet = $iGreen & ";"
        Case $mBlkTxt
            $sColSet = $iBlack & ";"
        Case $mWhtFld
            $sColSet = ";" & $iWhite ; Field colour preceded by ";"
        Case $mRedFld
            $sColSet = ";" & $iRed
        Case $mBluFld
            $sColSet = ";" & $iBlue
        Case $mGrnFld
            $sColSet = ";" & $iGreen
        Case $mBlkFld
            $sColSet = ";" & $iBlack
        Case $mDefTxt
            ; Get current colours
            $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2)
            ; Extract current colours
            $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";")
            ; Create required setting
            $sColSet = ";" & $aSplit[2]
            ; Set default flag
            $fDef = True
        Case $mDefFld
            $aColArray = _GUIListViewEx_ReturnArray($aContext[0], 2)
            $aSplit = StringSplit($aColArray[$aContext[1]][$aContext[2]], ";")
            $sColSet = $aSplit[1] & ";"
            $fDef = True
        Case $mDefBoth
            $sColSet = ";"
    EndSwitch

    If $sColSet Then
        ; Reset to default if needed
        If $fDef Then
            _GUIListViewEx_SetColour($aContext[0], ";", $aContext[1], $aContext[2])
        EndIf
        ; Set required item colour
        _GUIListViewEx_SetColour($aContext[0], $sColSet, $aContext[1], $aContext[2])
    EndIf

EndFunc

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

    $iRet = _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)

    Return $iRet

EndFunc

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

Thanks. I figured out the issue, I don't know if I missed it somewhere but you need to call  _GUIListViewEx_MsgRegister before registering your own NOTIFY. I generally do all my registers at the top of my script except this _GUIListViewEx_MsgRegister. I guess it technically makes sense for _GUIListViewEx_WM_NOTIFY_Handler to work, but I don't see how that would interrupt all the other things on NOTIFY because they should still be returned through the call...oh well. May be worth mentioning in the help file.

Link to post
Share on other sites
  • Moderators

Champak,

Ah yes - that would explain the behaviour you saw.

The latest change to the UDF changed the behaviour of the _MsgRegister function. If you use "False" as the parameter, the function unregisters the message completely, so of course in your case the earlier handler would have been unregistered and nothing worked. In your case what was needed was to use "Default" - then the function does nothing and your original handler would have remained registered.

I take your point about mentioning things like this, but the UDF is getting so complex that I fear that the Guide would become absolutely HUGE - few enough people read it as it is, making it even larger would deter potential users even more.

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

So, Turns out I did have the actual latest version of the udf.  It was updated again since the last time I downloaded it.  Downloaded and used latest version and issue was resolved.  Sorry for the false alarm.

 

Edited by MattHiggs
Link to post
Share on other sites
  • 1 month later...

I'm having trouble figuring out how to set updated content for combo drop downs. Due to the structure of my previous content I didn't realize what was happening until now. I was using _GUIListViewEx_SetEditStatus() to update combo items, but I realized it was updating the entire column, not just the cell I need. I tried using _GUIListViewEx_ChangeItem(), but it is not working feeding a delaminated string, it only works with a simple string.

Is the way I currently have it working the only way updating combo boxes can happen?

Link to post
Share on other sites
  • Moderators

Champak,

As you have discovered, you can only alter the dropdown content for whole columns, not individual elements. My reply to a previous question along these lines read:

Quote

I would suggest using the array returned by the _EventMonitor function after a successful edit to check if the selection was valid for that particular row - and if not use the _GUIListViewEx_ChangeItem function to reset the original value (also found in the returned array) and pop up a MsgBox to warn the user. That is why I added the ability to check the edited values to the UDF.

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

I have problem with the unwanted item highlight when ListView has checkboxes.

To demonstrate the problem you can add " +32" flag to _GUIListViewEx_Init function in GLVEx_Example_1.au3

image.png.b4caf224ea2cf597a4af19f5f3356caf.png

Now start checking checkboxes and uncheck and click on the ListView item in any column position.

image.png.00abadecb733e477130444d0376c25a7.png

Do you know how to fix it?

Link to post
Share on other sites
  • Moderators

mandriospo,

I see the problem - looking into it.

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
  • Moderators

mandriospo,

That was fun! See if this does the trick for you: GUIListViewEx_Mod.au3

M23

Edited by Melba23
Updated file

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

Now it's better. Now only 1 row can be selected.

But it's not perfect yet. When I play with the checkboxes and I start checking/unchecking checkboxes then I still can see 2 selected rows at the same time for the short time (like 0.5s).

Link to post
Share on other sites
  • Moderators

mandriospo,

No lag at all for me when altering the checkboxes - the selected item changes immediately. Can you give me a specific sequence which produces the "laggy" behaviour?

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
  • Moderators

mandriospo,

I just tried the example code set to 20 columns and 200 rows - still an immediate selection.

Do you have colour or single-cell selection in your ListView? That forces the UDF to redraw the ListView using AutoIt code rather than leaving it all to Windows. If this is the case, try adding the $LVS_EX_DOUBLEBUFFER extended style - that has been shown to help reduce flicker.

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
  • Moderators

maniootek,

I believe you! Now delete that attachment immediately to save space!

But you have not posted any code - just an image of one of the UDF examples. Please let me have the code you used to produce the ListView in that video and I will see if I can reproduce the problem.

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
13 minutes ago, Melba23 said:

I believe you! Now delete that attachment immediately to save space!

No need, this is not an attachment, it is only link to youtube vide (before I use to attach mp4 file instead, now I am smarter)

 

14 minutes ago, Melba23 said:

But you have not posted any code

I thought I posted code before but here is it:

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

#include "GUIListViewEx_Mod.au3"

#include <Array.au3>

GUIListViewEx_TEST()

Func GUIListViewEx_TEST()
    Global $aHeaders[][] = [["Symbol"], ["Nazwa"], ["EAN"], ["Producent"], ["Ilość"], ["Cena Zakupu"], ["Stan"], ["Pod klienta"], ["Średnia cena"], ["Blabla1"], ["BlaBla2"], ["Blabla3"], ["BlaBla4"], ["Blabla5"]]
    Local $sHeaders = _ArrayToString($aHeaders, "blabla", -1, -1, "|", 0, 0)

    Local $hGUI = GUICreate(Default, 1000, 800)
    $g_idListView = GUICtrlCreateListView($sHeaders, 10, 10, 990, 740)

    Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)
    _GUICtrlListView_SetExtendedListViewStyle($g_idListView, $iExListViewStyle)

    Local $aResult[0][Ubound($aHeaders) - 1]
    For $i = 0 To 100
        _ArrayAdd($aResult, $sHeaders)
        GUICtrlCreateListViewItem($sHeaders, $g_idListView)
    Next
    ;AutoFitGui($hGUI, $g_idListView, $aResult)

    Local $iLV_Index = _GUIListViewEx_Init($g_idListView, $aResult, 0, 0, True, 32 + 512)

    _GUIListViewEx_MsgRegister(True, False, False)

    Local $vRet
    GUISetState(@SW_SHOW)

    Local $vRet

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
            $vRet = _GUIListViewEx_EventMonitor()
    WEnd
EndFunc

 

Link to post
Share on other sites
  • Moderators

maniootek,

OK, I can see a very short hesitation when the checkboxes are actioned - as opposed to the instantaneous reaction when items are selected. The reason is simple - Windows is dealing with the latter, but the checkbox code is deal with by an AutoIt coded message handler. This handler must detect a click on an item, determine if checkboxes are in use, if they are then check if the click was on the checkbox, and if so set a flag to be actioned in the script idle loop by the _EventMonitor function, which clears the previous selection and selects the newly clicked item. Quite a convoluted chain, but the only way I could find to prevent your original problem of multiple selections.

So it looks as if you are stuck with that small delay - sorry about that.

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

Wondering if I could disable auto row selecting when checking/unchecking checkbox just as it's done by default when creating ListView control in AutoIt.

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

#include "GUIListViewEx_Mod.au3"

#include <Array.au3>

GUIListViewEx_TEST()

Func GUIListViewEx_TEST()
    Global $aHeaders[][] = [["Symbol"], ["Nazwa"], ["EAN"], ["Producent"], ["Ilość"], ["Cena Zakupu"], ["Stan"], ["Pod klienta"], ["Średnia cena"], ["Blabla1"], ["BlaBla2"], ["Blabla3"], ["BlaBla4"], ["Blabla5"]]
    Local $sHeaders = _ArrayToString($aHeaders, "blabla", -1, -1, "|", 0, 0)

    Local $hGUI = GUICreate(Default, 1000, 800)
    $g_idListView = GUICtrlCreateListView($sHeaders, 10, 10, 990, 740)

    Local $iExListViewStyle = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_CHECKBOXES)
    _GUICtrlListView_SetExtendedListViewStyle($g_idListView, $iExListViewStyle)

    Local $aResult[0][Ubound($aHeaders) - 1]
    For $i = 0 To 100
        _ArrayAdd($aResult, $sHeaders)
        GUICtrlCreateListViewItem($sHeaders, $g_idListView)
    Next

    GUISetState(@SW_SHOW)


    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
EndFunc

 

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

    No registered users viewing this page.

×
×
  • Create New...