Jump to content

New _ArrayDisplay Beta code - comments and suggestions welcomed


Melba23
 Share

Recommended Posts

  • Moderators

AZJIO,

Look at the post above yours. ;)

New file now uploaded - I have checked the downloaded file and it is good for me. :)

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

Just a cometic suggestion: Align to the right the first column

; Fill listview
    Local $cItem
    For $i = 0 To UBound($avArrayText) - 1
        $cItem = GUICtrlCreateListViewItem($avArrayText[$i], $cListView)
        If $iAlt_Color Then
            GUICtrlSetBkColor($cItem, $iAlt_Color)
        EndIf
    Next
    Local Const $_ARRAYCONSTANT_LVM_FIRST = 0x1000
    Local Const $_ARRAYCONSTANT_LVM_SETCOLUMNW = ($_ARRAYCONSTANT_LVM_FIRST + 96)
    Local Const $_ARRAYCONSTANT_tagLVCOLUMN = "uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal"
    Local Const $_ARRAYCONSTANT_LVCF_FMT = 0x0001
    Local $tColumn = DllStructCreate($_ARRAYCONSTANT_tagLVCOLUMN)
    DllStructSetData($tColumn, "Mask", $_ARRAYCONSTANT_LVCF_FMT)
    DllStructSetData($tColumn, "Fmt", 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Align Left: 0, Right: 1, Center: 2
    Local $pColumn = DllStructGetPtr($tColumn)
    GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_LVM_SETCOLUMNW, 0, $pColumn) ; Align the 1st Column zero based index
    GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_WM_SETREDRAW, 1, 0)
Link to comment
Share on other sites

  • Moderators

AZJIO,

Thanks again - I have made it more generic: :)

$sHeader = StringReplace($sHeader, $sCurr_Separator, $sAD_Separator)
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

GaRydelaMer,

Nice idea - but I am not adding all that just for cosmetic reasons. ;)

AZJIO,

Your header error opened a whole can of worms with column ranges - I think I have it working now. :sweating:

Same response as above for the flag idea - too complex for a debugging tool. ;)

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

Hi,

Yet another new Beta in the first post with headers working correctly - for me at least. ;)

M23

Edit: And that is me done on this UDF for today. Any further suggestions can wait until after dinner, the footy and some sleep! :bye:

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

Melba23

When I asked more or less than the number of columns, then the problem

1|2|3 - good

1|2 - poorly

1|2|3|4 - poorly

_______________

Right alignment. Quite easily implemented.

; Fill listview
    Local $cItem
    For $i = 0 To UBound($avArrayText) - 1
        $cItem = GUICtrlCreateListViewItem($avArrayText[$i], $cListView)
        If $iAlt_Color Then
            GUICtrlSetBkColor($cItem, $iAlt_Color)
        EndIf
    Next
    $flagRA = 1 ; !!!
    If $flagRA Then
        Local Const $_ARRAYCONSTANT_LVM_FIRST = 0x1000
        Local Const $_ARRAYCONSTANT_LVM_SETCOLUMNW = ($_ARRAYCONSTANT_LVM_FIRST + 96)
        Local Const $_ARRAYCONSTANT_tagLVCOLUMN = "uint Mask;int Fmt;int CX;ptr Text;int TextMax;int SubItem;int Image;int Order;int cxMin;int cxDefault;int cxIdeal"
        Local Const $_ARRAYCONSTANT_LVCF_FMT = 0x0001
        Local $tColumn = DllStructCreate($_ARRAYCONSTANT_tagLVCOLUMN)
        DllStructSetData($tColumn, "Mask", $_ARRAYCONSTANT_LVCF_FMT)
        DllStructSetData($tColumn, "Fmt", 1) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Align Left: 0, Right: 1, Center: 2
        Local $pColumn = DllStructGetPtr($tColumn)
        For $i = 1 To $iSubItem_End - $iSubItem_Start + 1 ; (????????)
            GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_LVM_SETCOLUMNW, $i, $pColumn) ; Align the 1st Column zero based index
        Next
    EndIf
    GUICtrlSendMsg($cListView, $_ARRAYCONSTANT_WM_SETREDRAW, 1, 0)

Array to test

Global $aArray[10][3]
For $i = 0 To UBound($aArray) - 1
    For $j = 0 To UBound($aArray, 2) - 1
        $aArray[$i][$j] = StringReplace(StringFormat("%0" & Random(0, 9, 1) & "d", "0"), "0", Random(0, 9, 1), 0, 2)
    Next
Next
; _ArrayDisplay_Beta($aArray, Default, "7|1:3")
_ArrayDisplay_Beta($aArray, Default, "7")
Edited by AZJIO
Link to comment
Share on other sites

I've made a tool to display an ADO recordset in a Listview :

ADO field type: Number column align to right

ADO field type: text column align to left

ADO field type: Date column align to center

It's just cometic, and the first column in this case are not in the source array, it's just an index of the source array (not on item identifier).

Link to comment
Share on other sites

  • Moderators

AZJIO,

You have convinced me! I have added your code - but made it so that the $iColAlign flag can be set to either 2 or 4 and thus set right or center alignment. ;)

I fixed the custom column header problem - there is now a check that the passed header has the correct number of items or the default headers are substituted. Interestingly the original function had the same bug, but as I had never used custom headers I had never realised it. :)

All,

New Beta code in the first post. I do not intend to add any more features to the UDF - so please limit future comments to any bugs that you have found. :)

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

Melba23

Call($sUserFunc, $avArray, $aiCurItems, $cListView, $hGUI)

I updated a test example. I made to test _UserFunc. Now ListView can change. I changed the color of selected items
 

I fixed the custom column header problem

 
If the array has three columns, then I must point out three names. My idea is that I can point to one or two or four columns and it will properly show

Edited by AZJIO
Link to comment
Share on other sites

  • Moderators

AZJIO,

 

My idea is that I can point to one or two or four columns and it will properly show

Fixed - custom items used from column 0 until they run out (with no error if there are too many) and then default headers inserted to the end. :)

I need convincing that there should be more parameters for the User function - changing the colour of selected items does not seem that essential. Any really "killer" ideas that might persuade me? :huh:

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

Hi,

Yet another Beta version in the first post with the amended header code. :)

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

Melba23

 

I need convincing that there should be more parameters for the User function - changing the colour of selected items does not seem that essential. Any really "killer" ideas that might persuade me? 

Get array elements available after using ArrayDisplay. I do not see any obstacles. Why add to the function ArrayDisplay another function that can be called separately in the following lines.
The ability to handle directly ListView seems more productive.

1. You can highlight a string with specific values

2. Make the selected column (_GUICtrlListView_SetSelectedColumn)

3. Sort (_GUICtrlListView_SimpleSort)

4. Change the style (_GUICtrlListView_SetExtendedListViewStyle)

#include <GuiListView.au3>
#include <ArrayDisplay_Beta_Ru.au3>

Global $aArray[50][3]
For $i = 0 To UBound($aArray) - 1
    For $j = 0 To UBound($aArray, 2) - 1
        $aArray[$i][$j] = StringReplace(StringFormat("%0" & Random(0, 9, 1) & "d", "0"), "0", Random(0, 9, 1), 0, 2)
    Next
Next

_ArrayDisplay_Beta($aArray, 'Sorts in "Col 1"', '22:44', Default, Default, Default, Default, 0xDDFFDD, "_UserFunc")
Func _UserFunc($aArray , $aSelected, $cListView, $hGUI)
    _GUICtrlListView_SimpleSort($cListView, True, 2)
EndFunc

_ArrayDisplay_Beta($aArray, 'Selects the column 1', '22:44', Default, Default, Default, Default, Default, "_UserFunc2")
Func _UserFunc2($aArray , $aSelected, $cListView, $hGUI)
    _GUICtrlListView_SetSelectedColumn($cListView, 2)
EndFunc

_ArrayDisplay_Beta($aArray, 'Marks the red selected items', Default, Default, Default, Default, Default, Default, "_UserFunc3")
Func _UserFunc3($aArray , $aSelected, $cListView, $hGUI)
    _GUICtrlListView_BeginUpdate($cListView)
    Local $aID = _GUICtrlListView_GetSelectedIndices($cListView, True)
    For $i = 1 To $aID[0]
        $iID = _GUICtrlListView_GetItemParam($cListView, $aID[$i])
        GUICtrlSetBkColor($iID, 0xFFCC99)
    Next
    _GUICtrlListView_EndUpdate($cListView)
EndFunc

_ArrayDisplay_Beta($aArray, 'Changes the style', '22:44', Default, Default, Default, Default, 0xFFFFC4, "_UserFunc4")
Func _UserFunc4($aArray , $aSelected, $cListView, $hGUI)
    Static Local $a = 0
    $a += 1
    If $a = 1 Then
        _GUICtrlListView_SetExtendedListViewStyle($cListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP, $LVS_EX_BORDERSELECT, $LVS_EX_CHECKBOXES))
        Local $iWidth = _GUICtrlListView_GetColumnWidth($cListView, 0)
        _GUICtrlListView_SetColumnWidth($cListView, 0, $iWidth + 20)
    Else
        Local $sMsg
        $iCount = _GUICtrlListView_GetItemCount($cListView)
        For $i = 0 To $iCount - 1
            If _GUICtrlListView_GetItemChecked($cListView, $i) Then
                $sMsg &= _GUICtrlListView_GetItemText($cListView, $i, 1) & @CRLF
            EndIf
        Next
        MsgBox(0, ';)', $sMsg, 0, $hGUI)
    EndIf
EndFunc

_ArrayDisplay_Beta($aArray, 'Highlight the number 5', '22:44', Default, Default, Default, Default, Default, "_UserFunc5")
Func _UserFunc5($aArray , $aSelected, $cListView, $hGUI)
    Local $iID, $iCount = _GUICtrlListView_GetItemCount($cListView)
    For $i = 0 To $iCount - 1
        If StringInStr(_GUICtrlListView_GetItemText($cListView, $i, 1), '5') Then
            $iID = _GUICtrlListView_GetItemParam($cListView, $i)
            GUICtrlSetBkColor($iID, 0xFFDDDD)
        EndIf
    Next
EndFunc

.

Edited by AZJIO
Link to comment
Share on other sites

  • Moderators

AZJIO,

You can very easily get the handles of the ArrayDisplay GUI and its ListView by using WinGetHandle and ControlGetHandle within the user function - so I see no need to pass them as parameters. Furthermore, none of the uses you have coded above reflect the basic debugging use of the function. Sorry, but I am not adding further parameters to the function call. :(

All,

New Beta code in first post. There is a deadline of 1800 UTC today for any further comments and suggestions. Thanks to everyone who has contributed so far - even if you did not get quite what you wanted! :D

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

Absolutely perfect :sorcerer:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Melba23

If the dialog box has blocked handler of the parent window, it should block the window itself. Even your example is incorrect.

My interpretation of your choice

_ArrayDisplay($aArray_1D)
; $aSelected[5] = [4, 22, 23, 24, 25]
$aSelected[2] = [22, 25]
_UserFunc($aArray_1D, $aSelected)
Edited by AZJIO
Link to comment
Share on other sites

  • Moderators

AZJIO,

Please tell me what you want changed - because I have no idea what you are complaining about this time. :)

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

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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