Jump to content

GUIListViewEx - New Version 21 May 22


Recommended Posts

lol, would you believe I stopped at the last page because I thought I got all the pertinent information....and what do you know, the last page had the exact info that would have helped lol. READ EVERYTHING!!!! smh. Thanks, all good now.

Edited by Champak
Link to post
Share on other sites
  • Melba23 changed the title to GUIListViewEx - New Version 13 Apr 22
  • 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

[NEW VERSION] - 13 Apr 22

Changed: If completely emptying and reloading a ListView with user colour enabled, the WM_NOTIFY handler must be unregistered before the process is started and reregistered once it is over. To this end the parameters ofĀ Ā _GUIListViewEx_MsgRegister now take one of 3 possible values:

  • True = Register handler
  • False = Unregister handler
  • Default = Do nothing

This permits any of the handlers to be un/reregistered without affecting the state of the others. The most obvious use is the un/reregistering ofĀ WM_NOTIFY as described above, but other scenarios could be envisaged.

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

Ā 

Link to post
Share on other sites
  • 2 weeks later...

In my latest project I thought I neededĀ your "GUIListViewEx.au3" because of the single cell selection capability (not complete row). It started out quite nice, but then IĀ struggledĀ with what you call ā€œProgrammatically select row - and item if single selection availableā€ (Func _GUIListViewEx_SelectItem). I boiled my problem down to the example code below.

What I want to have is a ListView that has always only one cell selected. It works fine when I just click into the ListView cells. But when I try to select the cell via Func _GUIListViewEx_SelectItem() then I end up with multiple cells selected.

I had a brief look into your Func _GUIListViewEx_SelectItem() and, without understanding all of it, I suspect that the instruction _GUICtrlListView_SetItemSelected($hLVHandle, -1, False) doesn’t do what it is supposed to do in single cell selection mode.

Any ideas from this forum how I could possible sail around this problem would be highly welcome.

Ā 

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx.au3"
#include <Array.au3> ; Just for display in example

; Create GUI
Local $hGUI = GUICreate("My Example", 340, 160)

; Create LV
Local $sLV = "A|B|C"
Local $cLV = _GUICtrlListView_Create($hGUI, $sLV, 8, 8, 320, 100, BitOR($LVS_REPORT, $LVS_SINGLESEL))
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cLV, 0, 100)
_GUICtrlListView_SetColumnWidth($cLV, 1, 100)
_GUICtrlListView_SetColumnWidth($cLV, 2, 100)

; Create Button
Local $idButton = GUICtrlCreateButton("A1", 130, 115, 80, 40)

; Fill LV
Local $aLV[3][3] = [["A1","B1","C1"],["A2","B2","C2"],["A3","B3","C3"]]
_GUICtrlListView_AddArray($cLV, $aLV)
_GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 64+128+256+512+1024)
            ; + 64    - No external drag
            ; + 128   - No external drop
            ; + 256   - No delete on external drag/drop
            ; + 512   - No internal drag/drop
            ; + 1024  - Single cell highlight (forces single row selection)

_GUIListViewEx_MsgRegister() ; Register GUIListViewEx
GUISetState(@SW_SHOW, $hGUI)

;=== Gui loop
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButton
            Switch GUICtrlRead($idButton)
                Case "A1"
                    _GUIListViewEx_SelectItem(0, 0) ; Select cell "A1"
                    GUICtrlSetData($idButton, "C3") ; next command
                Case "C3"
                    ; Unfortunately, this selects cell "C3" ADDITIONALLY to "A1"
                    ; Because of a bug in Func _GUIListViewEx_SelectItem() ???
                    _GUIListViewEx_SelectItem(2, 2) ; Select cell "C3"
                    GUICtrlSetData($idButton, "Clear") ; next command
                Case "Clear"
                    ; Remove all current highlighting
                    ; This is an instruction out of Func _GUIListViewEx_SelectItem()
                    ; According to AutoIt Help it wont work:
                    ; "If the listview is using the control style $LVS_SINGLESEL,
                    ;  setting $iIndex to -1 will not select all of the items."
                    _GUICtrlListView_SetItemSelected($cLV, -1, False)
                    GUICtrlSetData($idButton, "Exit") ; next command
                Case "Exit"
                    ExitLoop
            EndSwitch ; button
    EndSwitch ; GUIGetMsg

    ;$vRet = _GUIListViewEx_EventMonitor()
WEnd ; Gui loop

; Exit
GUIDelete($hGUI)
Exit

Ā 

Link to post
Share on other sites
  • Moderators

PowerJack,

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

PowerJack,

The problem was caused because when "single cell" is used the ListView is owner-drawn and the UDF was relying on a stored column valueĀ to set the highlight when redrawing the content which wasĀ being altered by other sections of this perhaps overly complex script. I have rewritten the "_SelectItem" and "_HighLight" functions and the "_WM_NOTIFY" handler to use another stored valueĀ  and your script now responds correctly.

I am still looking into how I might clear all selections, but that I see as a lesser problem.

Have a play and see if this new version of the UDF works to your satisfaction - and if I have broken anything else, which is not uncommon! And comments from any other readersĀ are always welcome too.

Ā 

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

Ā 

Link to post
Share on other sites

@Melba23,

Problem of unwanted multiple selectionsĀ solved.
Thank your for your fast response and fix.

I am still looking for a proper solution to remove any selection in the ListView (the idea of the "Clear" command in my example).
My not very elegant solution would beĀ to remove the complete ListView and create it new.

Link to post
Share on other sites
  • Moderators

PowerJack,

Try this version.Ā I have amended the _SelectItem function to allow for a total clearance when the $iRow parameter is set to -1:

Ā 

Ā 

So your script wouldĀ read:

Case "Clear"
    _GUIListViewEx_SelectItem(-1) ; Unselect all cells
    GUICtrlSetData($idButton, "Exit") ; next command

I have written the function to deal with all possible cases:

  • Standard MultiSel
  • StandardĀ SingleSel
  • Forced SingleSel with single cell selection

Have fun trying to break it!

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

Ā 

Link to post
Share on other sites

Thank you for the update @Melba23.

The -1 in the _SelectItem function is really helpful.

Now to your challenge ("Try to break it!")...Ā šŸ˜‰

Top 1:Ā _GUIListViewEx_GetLastSelItem()
This function is totally ignorant regarding your latest changes.
You can verify this by running my new example below, press the move button several times and have a look at the status line at the bottom.
If you click into the cell directly then the function _GetLastSelItem()Ā  deliversĀ the right result.

Top 2: Still getting multiple selections in some cases
This is a strange one and I think it has something to do with my "Reload" scenario.
Please try to reproduce it by...

  • Run my example (cell A1 is selected).
  • Click into the C3 cell and then press the Reload button.
    Sometimes it happens at the first time, sometime I have to click C3+Reload several times
  • The problem is that at one point in time I end up having A1 and C3 selected.
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx_Mod.au3"

; Create GUI
Local $hGUI = GUICreate("My Example", 340, 190)

; Create LV
Local $sLV = "A|B|C"
Local $cLV = _GUICtrlListView_Create($hGUI, $sLV, 8, 8, 320, 100, BitOR($LVS_REPORT, $LVS_SINGLESEL))
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cLV, 0, 100)
_GUICtrlListView_SetColumnWidth($cLV, 1, 100)
_GUICtrlListView_SetColumnWidth($cLV, 2, 100)

; Create Buttons
Local $idButMove    = GUICtrlCreateButton("Move", 30, 115, 80, 40)
Local $idButClear   = GUICtrlCreateButton("Clear", 120, 115, 80, 40)
Local $idButReload  = GUICtrlCreateButton("Reload", 210, 115, 80, 40)
Local $idLabel      = GUICtrlCreateLabel("Selection: ", 8, 165, 180, 20)

; Fill LV
Local $aLV[3][3] = [["A1","B1","C1"],["A2","B2","C2"],["A3","B3","C3"]]
_GUICtrlListView_AddArray($cLV, $aLV)
_GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 64+128+256+512+1024)
            ; + 64    - No external drag
            ; + 128   - No external drop
            ; + 256   - No delete on external drag/drop
            ; + 512   - No internal drag/drop
            ; + 1024  - Single cell highlight (forces single row selection)

_GUIListViewEx_MsgRegister() ; Register GUIListViewEx
GUISetState(@SW_SHOW, $hGUI)

; Select first cell
Local $iRow=0, $iCol=0
_GUIListViewEx_SelectItem($iRow, $iCol)


;=== Gui loop
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop

        Case $idButMove ; select next cell
            $iCol = Mod($iCol+1,3)
            If $iCol=0 Then $iRow = Mod($iRow+1,3)
            _GUIListViewEx_SelectItem($iRow, $iCol) ; Select cell

        Case $idButClear
             _GUIListViewEx_SelectItem(-1) ; Unselect all cells
             $iRow = 0
             $iCol = 0

        Case $idButReload ; reload LV
            _GUICtrlListView_DeleteAllItems($cLV)
            _GUIListViewEx_Close()
            _GUICtrlListView_AddArray($cLV, $aLV)
            _GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 64+128+256+512+1024)
            $iRow = 0
            $iCol = 0
            _GUIListViewEx_SelectItem($iRow, $iCol) ; Select first cell

    EndSwitch ; GUIGetMsg

    GUICtrlSetData($idLabel, "Selected: " & _GUIListViewEx_GetLastSelItem())
            ; ==> Delimited string ListViewIndex|Row|Col

    ;$vRet = _GUIListViewEx_EventMonitor()
WEnd ; Gui loop

GUIDelete($hGUI)
Exit

Ā 

Link to post
Share on other sites
  • Moderators

PowerJack,

Second one was easy - the first took a bit of detective work. But I think I have solved both of the problems you found:

Ā 

Over to you again!

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

Ā 

Link to post
Share on other sites

@Melba23,

works like a charm. Thank your for your help.
I might come back as my current Au3 project grows.

Btw, have you ever thought about aĀ _GUICtrlListView_FindText() equivalent in Ex that can return rowĀ as well as column, similar to _GUIListViewEx_GetLastSelItem()?
I have done this as a user function Ā but it is certainly not so elegant like your stuff.

Link to post
Share on other sites
  • Moderators

PowerJack,

Glad I could help.

Quote

Ā _GUICtrlListView_FindText() equivalent

I would useĀ _GUIListViewEx_ReturnArray to get the ListView content into an array which can beĀ searched easily.

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 21 May 22
  • Moderators

[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 in theĀ _GetLastSelItem function.Ā 

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

Ā 

Link to post
Share on other sites
  • 3 weeks later...

I'm unable to get the header color to work in my script. I tried your example 6 and that is not working either. I uncommented the set header color part in your example and commented out the default header right below it.

I found this example in this thread and it works, so I don't know what's going on with the example you have or my script.

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

#include "GUIListViewEx.au3"

Global $GUI_Listview[1][2], $iModulID = 0

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

$cMove = GUICtrlCreateButton("Move", 10, 450, 80, 30)

;Listview
$GUI_Listview[$iModulID][0] = GUICtrlCreateListView("", 900, 0, 780, 90) ;,$LVS_SORTDESCENDING)

;Fügt der Listview Spaltennamen hinzu
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "EndSZ A", 100)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Port A", 50)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "LSZ", 35)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "OrdnNR", 60)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Port B", 50)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "EndSZ B", 100)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Betrieb", 60)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Status", 50)
_GUICtrlListView_AddColumn($GUI_Listview[$iModulID][0], "Pegel", 70)

;Test Data
For $i = 1 To 2
    Local $sData = "Item: "&$i&"|1|2|3|4|5|6|7|8"
    GUICtrlCreateListViewItem($sData, $GUI_Listview[$iModulID][0])
Next
Local $aLV = _GUIListViewEx_ReadToArray($GUI_Listview[$iModulID][0], 0)

; ListView UDF >> Initiate ListView
$GUI_Listview[$iModulID][1] = _GUIListViewEx_Init($GUI_Listview[$iModulID][0], $aLV, 0, 0, False, 16 + 32 + 64 + 128)

; ListView UDF >> If colours used then this function must be run BEFORE GUISetState
_GUIListViewEx_MsgRegister()

; Set required colours for ListView elements - (Normal text, Normal field, Selected text, Selected field)
;Local $aSelCol[4] = [$GUIBKCOLOR_FONT_TEXT, $GUIBKCOLOR_MAIN_SECOND, $GUIBKCOLOR_MAIN_SECOND, $GUIBKCOLOR_FONT_TEXT]
Local $aSelCol[4] = ["0x999b9d", "0x303443", "0x303443", "0x999b9d"]
_GUIListViewEx_SetDefColours($GUI_Listview[$iModulID][1], $aSelCol)


; Set header data
;Local $sHeaderColor = $GUIBKCOLOR_FONT_TEXT&";"&$GUIBKCOLOR_MAIN_SECOND
Local $sHeaderColor = "0xFF0000;0x00FF00"
Local $aHdrData[][] = [["Tom", "Dick", "Harry", "Fred", "Fred", "Fred", "Fred", "Fred", "Fred"], _              ; As colour is enabled, these will replace original titles
                            [$sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor, $sHeaderColor], _
                            ["", "", "", "", "", "", "", "", ""], _
                            [0,0,0,0,0,0,0,0,0]]
Local $sTest = _GUIListViewEx_LoadHdrData($GUI_Listview[$iModulID][1], $aHdrData)


GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cMove
            GUICtrlSetPos($GUI_Listview[$iModulID][0], 10, 10)
    EndSwitch

WEnd

Ā 

Link to post
Share on other sites
  • Moderators

Champak,

The Example 6 script is not colouring headers because for some reason the required value (+ 16 Ā  Ā - User coloured header) has not been set in the _Init function call. Set it to read like this:

$iLVIndex_1 = _GUIListViewEx_Init($cLV_1, $aLVArray_1, 0, 0, True, 1 + 8 + 32 + 16)

and the headers work as expected.

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, got it working, but it's failing later.

Basically I previously saved a list I was working on, and now that I adjusted the code to color the headersĀ I can't load the saved list. It is failing at

_WinAPI_RedrawWindow($aGLVEx_Data[$iLV_Index][0]) under the functionĀ __GUIListViewEx_RedrawWindow.

No error or exiting, everything just stops working, I've waited 10 minutes.

Also, is there a way to not make the header fonts bold when they are colored?

Edited by Champak
Link to post
Share on other sites
  • Moderators

Champak,

Was the saved ListView initialised with the same parameters as the one into you you are trying to reload the data? If not, then I doubt very much if it will work. Can you let me have a copy of the saved data and the creation and initialisation lines of your ListViews - I will try and see what might be the problem.

As to the header font - look at line #3686 in the UDF whereĀ the header font is set toĀ 600Ā ($FW_SEMIBOLD). Change that value of you wish - although there must have been some reason I went for that particular setting when I wrote that section.

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

I'm having a problem with WM_NOTIFY. I've setĀ _GUIListViewEx_MsgRegister(False) and putĀ _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam) in my WM_NOTIFY and nothing that works on notification will work. No errors, the functions just don't work. I stripped the notify down to the bare minimum just to pass it through to listnotify to see if I'm getting anything and still no colors. Once I change the listRegister to default true and comment out the wm_notify all the colors kick in. Am I calling it incorrectly? I tried putting the call both at the beginning and the end of the functions in my wm_notify and still nothing.

Ā 

GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')

_GUIListViewEx_MsgRegister(False)

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

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

#cs
    $test = _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)
    Return $test
#ce

#cs
    _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)
    Return $GUI_RUNDEFMSG
#ce

EndFunc   ;==>WM_NOTIFY

Ā 

Ā 

Link to post
Share on other sites
  • Moderators

Champak,

From the Guide included with the UDF:

Quote

Note that the UDF handler should be called as the final action of the existing handler and the return value should be that returned from the UDF handler - this is particularly important when any colour functionality is used.

So if you change the line to read:

Return _GUIListViewEx_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)

you should get the colours.

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

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