Jump to content

GUIListViewEx - BugFix Version 6 Apr 24


Melba23
 Share

Recommended Posts

29 minutes ago, Melba23 said:

SpeedyKiwi,

Welcome to the forum.

I have just tested the _SelectItem function on a ListView and it works fine! So please let me have a short reproductor script that shows the problem and I will investigate further.

M23

Melba23,

Thanks for the quick reply!

Quick and dirty GUI to show what I am doing and seeing. Not sure how to post the code like you guys do yet. Forever Learning.

Unselect_Row.au3

Link to comment
Share on other sites

  • Moderators

SpeedyKiwi,

Looking into it.

To post code you need to  use Code tags - see here how to do 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 comment
Share on other sites

  • Moderators

SpeedyKiwi,

The problem is that you are using user-coloured items - so the normal Windows calls made by the _SelectItem function do not affect the row colouring . I will have to take a look at how the deselection can be done in this case. But my home office is being redecorated starting tomorrow so I am not sure how long this might take - do not hold your breath!

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 comment
Share on other sites

Thanks Melba!

Definitely not a showstopper. Easier to identify if it wasn't selected when there is only one entry. Just have to click the header for a little while to see the color lol.

Thanks again!

-SpeedyKiwi

Link to comment
Share on other sites

  • 4 weeks later...
Posted (edited)

I have a code that saves and loads the date so that all checkboxes are checked, but I don't want to. Can I change the array variables to True and then update the listview and another function is to enter the time into the input? Pressing the all time button will fix all values in the time column

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <AutoItConstants.au3>
#include <StaticConstants.au3>
#include <UpDownConstants.au3>
#include <EditConstants.au3>
#include <FontConstants.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
Global $SAT = 40
$hGUI = GUICreate("Tool", 500, 400)
$cLV_1 = GUICtrlCreateListView("Stt Auto|time|start|End|HD", 10, 30, 485, 330, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))
GUICtrlSetFont(-1, 13, 500, 2, "Arial Unicode MS",5)

_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($cLV_1, 0, 100)
_GUICtrlListView_SetColumnWidth($cLV_1, 1, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 2, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 3, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 4, 90)

; Create array and fill listview
Global $aLVArray_1[$SAT+1][5]
For $i = 0 To $SAT
    $sData = "Auto "& $i&"||ht|6"
    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, 0xFF0000, True,2+ 8 +16 +  32 + 512 + 1024) ; + 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


Global $aLVCol_1[$SAT+1][5] =   [["",$iGreen & ";" & ''], _
                                ['',"",$iGreen & ";" & ''], _
                                ['',"",$iGreen & ";" & '']] ;, _            ; 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 ""

_GUIListViewEx_LoadColour($iLVIndex_1, $aLVCol_1)
_GUIListViewEx_MsgRegister()



$btn = GUICtrlCreateButton('All check',50,370,50,20)
$input = GUICtrlCreateInput('',120,370,50,20)
$Allinput = GUICtrlCreateButton('All time',200,370,50,20)



$tg = 0
GUISetState()
While 1

    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btn
            ;$a = _GUIListViewEx_ReturnArray($iLVIndex_1,1) ; 0 + 1

            ;$a =_GUIListViewEx_ReadToArray($iLVIndex_1)

    Local $hLV = $aGLVEx_Data[$iLVIndex_1][0]

    Local $aData_Colour = $aGLVEx_Data[$iLVIndex_1][2]
    Local $iDim_1 = UBound($aData_Colour, 1)
    Local $aCheck[$iDim_1]

    ; Adjust array depending on mode required

            If $aGLVEx_Data[$iLVIndex_1][6] Then
                For $i = 1 To $iDim_1 - 1
                    $aCheck[$i] = _GUICtrlListView_GetItemChecked($hLV, $i - 1)
                    ;ConsoleWrite($aCheck[$i]&@cr)
                    $aCheck[$i] = True
                Next
                _GUIListViewEx_SetActive($iLVIndex_1)
            EndIf







    ;       If $tg = 0 Then
    ;           _GUIListViewEx_LoadListView($iLVIndex_1, @ScriptDir&'\1.txt')
    ;           $tg = 1
    ;       Else
    ;           _GUIListViewEx_LoadListView($iLVIndex_1, @ScriptDir&'\2.txt')
    ;           $tg = 0
    ;       EndIf
            ;_GUIListViewEx_SaveListView($iLVIndex_1, @ScriptDir&'\2.txt')
            ;_GUIListViewEx_LoadListView($iLVIndex_1, @ScriptDir&'\1.txt')
    EndSwitch

    $vRet = _GUIListViewEx_EventMonitor()
    If @error Then

    EndIf
    Switch @extended
        Case 0
            ; No event detected
        Case 1
                _GUIListViewEx_GetActive()
        Case 2
                _GUIListViewEx_GetActive()

        Case 4
            Local $aRet = StringSplit($vRet, ":")
            MsgBox($MB_SYSTEMMODAL, "Dragged", "From ListView " & $aRet[1] & @CRLF & "To ListView " & $aRet[2])
    EndSwitch

WEnd

 

Edited by Jos
added attached script in a codebox
Link to comment
Share on other sites

  • Moderators

mecartron,

Welcome to the AutoIt forums - and I am delighted that you find my UDF useful.

But I am afraid I have no idea what you are trying to do with this code - my crystal ball is usually pretty reliable, but you have me completely baffled

You say you have code which "saves and loads the date so that all checkboxes are checked" - but where is it? The code you posted does not do anything like that.

"Can I change the array variables to True" - what array?  I notice that you are accessing UDF variables ($aGLVEx_Data) directly - is this what you mean?  If so, then this is a very bad idea. UDFs should only be accessed using the public functions as accessing internal variables as you are doing can very often lead to tears.

"another function is to enter the time into the input? Pressing the all time button will fix all values in the time column". Sorry, not a inkling of what you mean there.

Try explaining in more detail what you want to do and I will do my best to help - but at the moment there is nothing I can do.

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 comment
Share on other sites

Posted (edited)

Sorry my English is not good, so I used google translate, but I solved the problem after carefully studying the examples, thank you for your enthusiasm

Edited by Melba23
Removed quote
Link to comment
Share on other sites

  • Moderators

mecartron,

So pleased you found the solution and that the examples were clear enough to allow you to do so.

M23

P.S. When you reply in future, 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 - I know what I wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation.

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 comment
Share on other sites

Hello Moderators
_GUIListViewEx_SetEditStatus($GList, 2, 2, "1|2|3", 2)
This is the editing structure by selecting a combo, it applies to all rows in a column, so can I change each row to have a different combo?

 

Link to comment
Share on other sites

  • Moderators

mecartron,

My name is Melba23 - Moderator is my role here!

In answer to your question - I am afraid that you cannot define a different combo for each row in a column. But what you can do is to run a user-defined function when double-clicked ($iMode = 9) which then creates a small dialog within which you can display a combo with data determined by the particular row clicked.

Or you can use a single combo with a large data set for the column and then check the returned value and reset the original if the new value is not valid for that row.

Give it a go and come back if you run into problems.

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 comment
Share on other sites

Posted (edited)

hello Melba23 I'm having trouble, is there any example to guide me, I used _GUIListViewEx_SetEditStatus($GList, 2, 9,_Edit) and get error

GUIListViewEx.au3" (3356) : ==> Incorrect number of parameters in function call.:

$vRet = $hUserFunction($hGLVEx_SrcHandle, $iLV_Index, $aLocation[0], $aLocation[1])

Edited by Melba23
Fixed font
Link to comment
Share on other sites

  • Moderators

mecartron,

How about this:

#include <GUIConstantsEx.au3>

#include "GUIListViewEx.au3"

$hGUI = GUICreate("Tool", 500, 400)

$cLV_1 = GUICtrlCreateListView("Stt Auto|time|start|End|HD", 10, 30, 485, 330, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS))

_GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
_GUICtrlListView_SetColumnWidth($cLV_1, 0, 100)
_GUICtrlListView_SetColumnWidth($cLV_1, 1, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 2, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 3, 90)
_GUICtrlListView_SetColumnWidth($cLV_1, 4, 90)

; Create array and fill listview
Global $aLVArray_1[10][5]
For $i = 0 To 9
    $sData = "Auto "& $i&"||ht|6"
    GUICtrlCreateListViewItem($sData, $cLV_1)
Next

; Initiate ListView
$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1)

; Set column edit status
_GUIListViewEx_SetEditStatus($iLVIndex_1, 2, 9, _UserFunc)    ; 9 = User function

_GUIListViewEx_MsgRegister()

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    _GUIListViewEx_EventMonitor()

WEnd

Func _UserFunc($hHandle, $iIndex, $iRow, $iColumn)

    MsgBox($MB_SYSTEMMODAL, "Hi!", "You clicked" & @CRLF & "Row: " & $iRow & @CRLF & "Col: " & $iColumn)

EndFunc

All clear now?

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 comment
Share on other sites

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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