Jump to content

GUIListViewEx - BugFix Version 6 Apr 24


Melba23
 Share

Recommended Posts

  • 2 weeks later...
  • Moderators

bourny,

You need to do something like this to detect item "checking":

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

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

$cLV = GUICtrlCreateListView("Item         ", 10, 10, 200, 300)
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_CHECKBOXES)
$hLV = GUICtrlGetHandle($cLV)

For $i = 0 to 9
    GUICtrlCreateListViewItem("Item " & $i, $cLV)
Next

GUISetState()

GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)

    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "HwndFrom"))
    $iCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
        Case $hLV
            Switch $iCode
                Case $LVN_ITEMCHANGED
                    Local $tInfo = DllStructCreate($tagNMLISTVIEW, $lParam)
                    Local $iItem = DllStructGetData($tInfo, "Item")

                    If _GUICtrlListView_GetItemChecked($hLV, $iItem) Then
                        ConsoleWrite(_GUICtrlListView_GetItemText($hLV, $iItem) & " Checked" & @CRLF)
                    Else
                        ConsoleWrite(_GUICtrlListView_GetItemText($hLV, $iItem) & " Unchecked" & @CRLF)
                    EndIf
            EndSwitch
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc

But you do not need to add this to the UDF code - just create your own handler as above, do not register $WM_NOTIFY using the UDF function (set the relevant parameter of _GUIListViewEx_MsgRegister to False) and then call the UDF handler function (_GUIListViewEx_WM_NOTIFY_Handler) from within your own handler.

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

jloyzaga,

You do not need the UDF to do what you want - a standard ListView will allow multiple selections.

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

hi  @Melba23 , i try  to use  example 3 , and modify for  understund , i create  a script 

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

#include "GUIListViewEx.au3"


Opt("GuiOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 128)

Global  $iEditMode = 23
_gui()

Func _gui()

$Form4 = GUICreate("Form4", 991, 598, 302, 218)
$List1 = GUICtrlCreateListView("Tom|Dick", 192, 64, 665, 357)
_GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($List1, 0, 93)
_GUICtrlListView_SetColumnWidth($List1, 1, 93)
_GUICtrlListView_SetInsertMarkColor($List1, 0)
; Create array
$aLV_List_Left = _GUIListViewEx_ReadToArray($List1, 1) ; Note count element

; Initiate GLVEx - no array passed - count parameter set - default insert mark colour (black) - drag image
$iLV_Left_Index = _GUIListViewEx_Init($List1, $aLV_List_Left, 1, 0, True)
; All columns editable
_GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")

GUISetState(@SW_SHOW)

; Register for editing 7 dragging
_GUIListViewEx_MsgRegister()

; Set neither ListView as active
_GUIListViewEx_SetActive(0)


$aRet = _GUIListViewEx_EditOnClick($iEditMode)



EndFunc

but not  work , where  i  mistake  ?

thankz  alot  , very  powerful udf i hope  in the  future  will be insert in core of  autoit3

 

Link to comment
Share on other sites

  • Moderators

faustf,

If you are trying to create a ListView with some blank lines you need to add them to the ListView - and set up an idle loop to look for the edit:

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

#include "GUIListViewEx.au3"

Opt("GuiOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 128)

Global $iEditMode = 23
_gui()

While 1
    Sleep(10)
    $aRet = _GUIListViewEx_EditOnClick($iEditMode)
WEnd


Func _gui()

    $Form4 = GUICreate("Form4", 991, 598, 302, 218)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    $List1 = GUICtrlCreateListView("Tom|Dick", 192, 64, 665, 357)
    _GUICtrlListView_SetExtendedListViewStyle($List1, $LVS_EX_FULLROWSELECT)
    _GUICtrlListView_SetColumnWidth($List1, 0, 93)
    _GUICtrlListView_SetColumnWidth($List1, 1, 93)

    ; Initiate GLVEx - no array passed - count parameter set - default insert mark colour (black) - drag image
    $iLV_Left_Index = _GUIListViewEx_Init($List1, "", 1, 0, True)
    ; All columns editable
    _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")
    ; Insert blank rows
    For $i = 0 To 9
        _GUIListViewEx_Insert("")
    Next

    GUISetState(@SW_SHOW)

    ; Register for editing & dragging
    _GUIListViewEx_MsgRegister()

EndFunc   ;==>_gui

Func _Exit()
    Exit
EndFunc

All clear?

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

hi  i try to use  for insert in my script ,  but  not  work properly  ,

i have  a big  script  wit many include , therfore,  i before i  scompose  and use  simply script , for understund , how  work , and  ask support (thankz again for help )

so,   i create a  custom listview and i call  listview_ok  ,

Func _ListView_OK($text, $left, $top, $width, $height, $Column)

    Global $vName = GUICtrlCreateListView($text, $left, $top, $width, $height)
    _GUICtrlListView_SetExtendedListViewStyle($vName, BitOR($LVS_EX_INFOTIP, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) ; questa stringa fa la griglia stile excel

    Local $aColumn = StringSplit($Column, "_")

    For $I = 1 To UBound($aColumn) - 1
        _GUICtrlListView_AddColumn($vName, $aColumn[$I], $aColumn[($I + 1)]) 
        $I += 1
    Next
    Return $vName

EndFunc   ;==>_ListView_OK

with  this  udf  i create  fast with  option  , that  usally i use  in my project.

i have  create also a principal  program .

In this program ......  i click over the  button  and  open a  popup  with  2 listview_ok

Local $aNumb_cat = StringRegExp(GUICtrlRead($SITIWEB_NewItem_Input4), '[\d]*', $STR_REGEXPARRAYGLOBALMATCH)
    Local $iID_CAT_prod = _Remove_BlankIN_Array($aNumb_cat)
    Local $iLastrecord_Array = $iID_CAT_prod[UBound($iID_CAT_prod) - 1]
    Local $aResult = _eBay_GetCategorySpecifics($iLastrecord_Array)
    Local $iOffset = 1
    $u = UBound($aResult)
    Local $res[$u][2], $n
    ;_ArrayDisplay($aResult)
    For $i = 0 To UBound($aResult) - 1
        ;Local $iPosition = StringInStr($aResult[$i], "<Name>")
        If StringInStr($aResult[$i], "<Name>") = 1 Or StringInStr($aResult[$i], "<NameRecommendation><Name>") Then
            $res[$n][0] = StringRegExpReplace($aResult[$i], '<Name>(.*)', "$1")
            $n += 1
            ;_ArrayDisplay($res,'1')
        ElseIf StringInStr($aResult[$i], "<Value>") Then
            $res[$n][1] = StringRegExpReplace($aResult[$i], '<Value>(.*)', "$1")
            $n += 1
            ;_ArrayDisplay($res,'2')
        EndIf

        ;MsgBox(0, '', $aResult[$i])
    Next



    $SITIWEB_NewItem_Opzioni_Form3 = GUICreate($GUI_Lang[217], 805, 727, 302, 124) ; opzioni
    $SITIWEB_NewItem_Opzioni_Group1 = GUICtrlCreateGroup($GUI_Lang[218], 0, 7, 804, 537) ; opzioni standar
    $SITIWEB_NewItem_Opzioni_List1 = _ListView_OK("", 5, 22, 793, 487, "Famiglia_150_Opzioni_150_SKU_50_Immagini_350")
    Local $k_for = 0, $h_for = 0, $t_for = 1
    #cs
    For $g = 0 To UBound($res) - 1
        ;MsgBox(0,'',$res[0][0])
        ;MsgBox(0,'',$res[0][1])
        If StringInStr($res[$k_for][$h_for], '<NameRecommendation>') <> 0 Then
            Local $sString = StringReplace($res[$k_for][$h_for], "<NameRecommendation>", "")
            $res[$k_for][$h_for] = $sString
            _GUICtrlListView_AddItem($SITIWEB_NewItem_Opzioni_List1, $res[$k_for][$h_for], 0)
        Else
            _GUICtrlListView_AddItem($SITIWEB_NewItem_Opzioni_List1, $res[$k_for][$h_for], 0)


        ElseIf StringInStr($res[$k_for][$h_for], '<ValueRecommendation>') <> 0Then
            Local $sString = StringReplace($res[$k_for][$h_for], "<ValueRecommendation>", "")
            $res[$k_for][$h_for] = $sString
            _GUICtrlListView_AddSubItem($SITIWEB_NewItem_Opzioni_List1, 0, "Row 1: Col 2", 1, 1)
        Else
            _GUICtrlListView_AddSubItem($SITIWEB_NewItem_Opzioni_List1, 0, "Row 1: Col 2", 1, 1)
        EndIf




    Next
     #ce


    $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True)
    ; All columns editable
    _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")
    $SITIWEB_NewItem_Opzioni_Button2 = GUICtrlCreateButton($GUI_Lang[12], 722, 515, 75, 21) ; inserisci
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $SITIWEB_NewItem_Opzioni_Group2 = GUICtrlCreateGroup($GUI_Lang[219], 0, 544, 804, 177) ; opzioni custum
    $SITIWEB_NewItem_Opzioni_List2 = _ListView_OK("", 5, 562, 793, 123, "Famiglia_150_Opzioni_150_SKU_50_Immagini_350")
    $SITIWEB_NewItem_Opzioni_Button1 = GUICtrlCreateButton($GUI_Lang[12], 721, 693, 75, 21) ; inserisci
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    For $i = 0 To 9
        _GUIListViewEx_Insert("")
    Next
    GUISetState(@SW_SHOW)
    ; Register for editing & dragging
    _GUIListViewEx_MsgRegister()
    $_deleteForm = $SITIWEB_NewItem_Opzioni_Form3
    GUISetOnEvent($GUI_EVENT_CLOSE, _Chiudi_multi)
EndFunc

and  at  end  of  first  program i  insert

While 1

    Sleep(10)
$aRet = _GUIListViewEx_EditOnClick($iEditMode)
WEnd

the  first prblem (little) is   open a popup , and  appear  in 9 row the checkbox  and  other is  blank , is possible not  appear a check box???

the  second  problem is  not  work , i try to click over the blank cell , start to change color  but not  start editable , and  return immidiatly withe

i do some  mistake ???

thankz alot

 

 

Link to comment
Share on other sites

i  answer me for  second problem

Local $aNumb_cat = StringRegExp(GUICtrlRead($SITIWEB_NewItem_Input4), '[\d]*', $STR_REGEXPARRAYGLOBALMATCH)
    Local $iID_CAT_prod = _Remove_BlankIN_Array($aNumb_cat)
    Local $iLastrecord_Array = $iID_CAT_prod[UBound($iID_CAT_prod) - 1]
    Local $aResult = _eBay_GetCategorySpecifics($iLastrecord_Array)
    Local $iOffset = 1
    $u = UBound($aResult)
    Local $res[$u][2], $n
    ;_ArrayDisplay($aResult)
    For $i = 0 To UBound($aResult) - 1
        ;Local $iPosition = StringInStr($aResult[$i], "<Name>")
        If StringInStr($aResult[$i], "<Name>") = 1 Or StringInStr($aResult[$i], "<NameRecommendation><Name>") Then
            $res[$n][0] = StringRegExpReplace($aResult[$i], '<Name>(.*)', "$1")
            $n += 1
            ;_ArrayDisplay($res,'1')
        ElseIf StringInStr($aResult[$i], "<Value>") Then
            $res[$n][1] = StringRegExpReplace($aResult[$i], '<Value>(.*)', "$1")
            $n += 1
            ;_ArrayDisplay($res,'2')
        EndIf

        ;MsgBox(0, '', $aResult[$i])
    Next



    $SITIWEB_NewItem_Opzioni_Form3 = GUICreate($GUI_Lang[217], 805, 727, 302, 124) ; opzioni
    $_deleteForm = $SITIWEB_NewItem_Opzioni_Form3
    GUISetOnEvent($GUI_EVENT_CLOSE, _Chiudi_multi)

    $SITIWEB_NewItem_Opzioni_Group1 = GUICtrlCreateGroup($GUI_Lang[218], 0, 7, 804, 537) ; opzioni standar
    $SITIWEB_NewItem_Opzioni_List1 = _ListView_OK("", 5, 22, 793, 487, "Famiglia_150_Opzioni_150_SKU_50_Qtt._50_Immagini_350")
    Local $k_for = 0, $h_for = 0, $t_for = 1
    #cs
    For $g = 0 To UBound($res) - 1
        ;MsgBox(0,'',$res[0][0])
        ;MsgBox(0,'',$res[0][1])
        If StringInStr($res[$k_for][$h_for], '<NameRecommendation>') <> 0 Then
            Local $sString = StringReplace($res[$k_for][$h_for], "<NameRecommendation>", "")
            $res[$k_for][$h_for] = $sString
            _GUICtrlListView_AddItem($SITIWEB_NewItem_Opzioni_List1, $res[$k_for][$h_for], 0)
        Else
            _GUICtrlListView_AddItem($SITIWEB_NewItem_Opzioni_List1, $res[$k_for][$h_for], 0)


        ElseIf StringInStr($res[$k_for][$h_for], '<ValueRecommendation>') <> 0Then
            Local $sString = StringReplace($res[$k_for][$h_for], "<ValueRecommendation>", "")
            $res[$k_for][$h_for] = $sString
            _GUICtrlListView_AddSubItem($SITIWEB_NewItem_Opzioni_List1, 0, "Row 1: Col 2", 1, 1)
        Else
            _GUICtrlListView_AddSubItem($SITIWEB_NewItem_Opzioni_List1, 0, "Row 1: Col 2", 1, 1)
        EndIf




    Next
     #ce



    $SITIWEB_NewItem_Opzioni_Button2 = GUICtrlCreateButton($GUI_Lang[12], 722, 515, 75, 21) ; inserisci
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $SITIWEB_NewItem_Opzioni_Group2 = GUICtrlCreateGroup($GUI_Lang[219], 0, 544, 804, 177) ; opzioni custum
    $SITIWEB_NewItem_Opzioni_List2 = _ListView_OK("", 5, 562, 793, 123, "Famiglia_150_Opzioni_150_SKU_50_Qtt._50_Immagini_350")
    $SITIWEB_NewItem_Opzioni_Button1 = GUICtrlCreateButton($GUI_Lang[12], 721, 693, 75, 21) ; inserisci
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True)
    ; All columns editable
    _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")
    For $i = 0 To 9
        _GUIListViewEx_Insert("")
    Next
    GUISetState(@SW_SHOW)
    ; Register for editing & dragging
    _GUIListViewEx_MsgRegister()


    ;MsgBox(0, '', '1309')





    ;_ArrayDisplay($res, 'fine')
    ;   _ArrayDisplay($aResult)
    ;   (?i)<Value>(.*?)\n
EndFunc   ;==>_Taglie_colori

:D

Link to comment
Share on other sites

  • Moderators

faustf,

You expect me to offer assistance when all you offer is 2 random functions and a very garbled description of the problem? I know my crystal ball is pretty good at times, but I draw the line at this. You need to provide some runnable code showing the problem - i am afraid the UDF is far too complex to debug with what you have posted.

if you code it correctly, it works:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#include <GUIListViewEx.au3>

Global $iEditMode = 23

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

$cList1 = _ListView_OK("", 5, 22, 690, 200, "Famiglia_150_Opzioni_150_SKU_50_Immagini_350")
$cList2 = _ListView_OK("", 5, 250, 690, 200, "Famiglia_150_Opzioni_150_SKU_50_Immagini_350")

; Initiate ListViews
$iLV1_Index = _GUIListViewEx_Init($cList1)
$iLV2_Index = _GUIListViewEx_Init($cList2)
; Set all columns editable
_GUIListViewEx_SetEditStatus($iLV1_Index, "*")
_GUIListViewEx_SetEditStatus($iLV2_Index, "*")
; Insert blank rows
For $i = 0 To 9 ; Adjust number as required
    _GUIListViewEx_InsertSpec($iLV1_Index, -1, "")
    _GUIListViewEx_InsertSpec($iLV2_Index, -1, "")
Next

GUISetState()

; Register required message
_GUIListViewEx_MsgRegister(True, False, False, False)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    $aRet = _GUIListViewEx_EditOnClick($iEditMode)

WEnd

Func _ListView_OK($text, $left, $top, $width, $height, $Column)

    Global $vName = GUICtrlCreateListView($text, $left, $top, $width, $height)
    _GUICtrlListView_SetExtendedListViewStyle($vName, BitOR($LVS_EX_INFOTIP, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES)) ; questa stringa fa la griglia stile excel

    Local $aColumn = StringSplit($Column, "_")

    For $I = 1 To UBound($aColumn) - 1
        _GUICtrlListView_AddColumn($vName, $aColumn[$I], $aColumn[($I + 1)])
        $I += 1
    Next
    Return $vName

EndFunc   ;==>_ListView_OK

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

Hi Melba23,

I'm trying to set some text/background colour of my listview.

$aLV = _GUIListViewEx_ReadToArray($myListView, 0)
$iLV = _GUIListViewEx_Init($myListView, $aLV, 0, 0, False, 32 )

_GUIListViewEx_SetColour($iLV, "0xA0A0A0;0xC0C0C0", 2, 2)

$myListView is a handle of a filled listview (30+ items)

Am I missing something?

Thanks for your help,
A-Jay

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Link to comment
Share on other sites

 

how  is possbile colored one stripe  of listview gray and second  withe ???

i tryed  to use  for  understund  how  work them , but nothing

;       $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True)
        $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True,1 + 8 + 16 + 32)
        ; All columns editable
        _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")

        _GUIListViewEx_LoadColour($SITIWEB_NewItem_Opzioni_List1, "0x00FF00")
                Local $aSelCol[5] = ["0x00FF00", "0xFFCCCC", "0x00FF00", "0x00FF00","0x00FF00"]
_GUIListViewEx_SetDefColours($SITIWEB_NewItem_Opzioni_List1, $aSelCol)
        #cs
            For $i = 0 To 9
            _GUIListViewEx_Insert("")
            Next
        #ce
_GUIListViewEx_MsgRegister()
        GUISetState(@SW_SHOW)
        ; Register for editing & dragging  va messo sempre per ultimo
        _GUIListViewEx_MsgRegister()

 

Edited by faustf
Link to comment
Share on other sites

i  answer me    sorry  :)

i rewrite  some part of  code  and  for  colored a stripe i use  this  "trick" simply and fast

_GUICtrlListView_BeginUpdate($SITIWEB_NewItem_Opzioni_List1)
            GUICtrlCreateListViewItem($res[$g][0] & "|" & $res[$g][1], $SITIWEB_NewItem_Opzioni_List1)  <----- Add item in listview
            If Not Mod($g, 2) Then
                ;Even
                GUICtrlSetBkColor(-1, 0xffffff)
            Else
                ;Odd
                GUICtrlSetBkColor(-1, 0xe6e6e6)
            EndIf
        Next
        _GUICtrlListView_EndUpdate($SITIWEB_NewItem_Opzioni_List1)

 

Link to comment
Share on other sites

hi @Melba23  , i modify little bi my script , and  now  i have  a issue

the script

Func _Taglie_colori_opzioni()
    GUISetState(@SW_DISABLE, $hMainGUI)
    GUISetCursor(15, 1) ; mouse clessidra

    If $control_push_options = 0 Then
        $control_push_options = 1
        Local $aNumb_cat = StringRegExp(GUICtrlRead($SITIWEB_NewItem_Input4), '[\d]*', $STR_REGEXPARRAYGLOBALMATCH)
        Local $iID_CAT_prod = _Remove_BlankIN_Array($aNumb_cat)
        Local $iLastrecord_Array = $iID_CAT_prod[UBound($iID_CAT_prod) - 1]
        Local $aResult = _eBay_GetCategorySpecifics($iLastrecord_Array)
        Local $iOffset = 1
        $u = UBound($aResult)
        Local $res[$u][2], $n
        ;_ArrayDisplay($aResult)
        For $i = 0 To UBound($aResult) - 1
            ;Local $iPosition = StringInStr($aResult[$i], "<Name>")
            If StringInStr($aResult[$i], "<Name>") = 1 Or StringInStr($aResult[$i], "<NameRecommendation><Name>") Then
                $res[$n][0] = StringRegExpReplace($aResult[$i], '<Name>(.*)', "$1")
                $n += 1
                ;_ArrayDisplay($res,'1')
            ElseIf StringInStr($aResult[$i], "<Value>") Then
                $res[$n][1] = StringRegExpReplace($aResult[$i], '<Value>(.*)', "$1")
                $n += 1
                ;_ArrayDisplay($res,'2')
            EndIf

            ;MsgBox(0, '', $aResult[$i])
        Next

        Local $path_jpg = GUICtrlRead($SITIWEB_NewItem_Input5)
        Global $aJpg_repath = StringSplit($path_jpg, "\")

        $SITIWEB_NewItem_Opzioni_Form3 = GUICreate($GUI_Lang[217], 805, 727, 302, 124, -1, $WS_EX_TOPMOST) ; opzioni
        $_deleteForm = $SITIWEB_NewItem_Opzioni_Form3
        GUISetOnEvent($GUI_EVENT_CLOSE, _Chiudi_multi)

        $SITIWEB_NewItem_Opzioni_Group3 = GUICtrlCreateGroup($GUI_Lang[221], 0, 0, 476, 159) ;"Immagini Sul Server"
        $SITIWEB_NewItem_Opzioni_List3 = _ListView_OK("", 6, 16, 374, 136, "Descrizione_350")
        _FTP_Lista($sRemote_dir & $aJpg_repath[7], $SITIWEB_NewItem_Opzioni_List3)

        $SITIWEB_NewItem_Opzioni_Button3 = GUICtrlCreateButton($GUI_Lang[222], 386, 133, 77, 21) ; copia
        ;$SITIWEB_NewItem_Opzioni_Button4 = GUICtrlCreateButton("---->", 419, 19, 27, 21)
        ;$SITIWEB_NewItem_Opzioni_Button5 = GUICtrlCreateButton("<----", 386, 19, 27, 21)
        $SITIWEB_NewItem_Opzioni_Button2 = GUICtrlCreateButton($GUI_Lang[12], 741, 9, 61, 21) ; Inserisci
        $SITIWEB_NewItem_Opzioni_Label1 = GUICtrlCreateLabel($GUI_Lang[223], 504, 17, 196, 17) ;Quante Opzioni Custom desideri inserire?
        $SITIWEB_NewItem_Opzioni_Input1 = GUICtrlCreateInput("3", 702, 9, 33, 21)




        $SITIWEB_NewItem_Opzioni_Group1 = GUICtrlCreateGroup($GUI_Lang[218], 0, 159, 804, 567) ; opzioni standar
        $SITIWEB_NewItem_Opzioni_List1 = _ListView_OK("", 5, 173, 793, 539, "Famiglia_150_Opzioni_150_SKU_50_Qtt._50_Immagini_365")
        ;GUIRegisterMsg($WM_NOTIFY, "_edita_listview") ; funzione per ordinare le listview modificate

        ;$vLISTview_da_passare = $SITIWEB_NewItem_Opzioni_List1
        ;$hGui_foreditlistview = $SITIWEB_NewItem_Opzioni_Form3
        ;GUIRegisterMsg($WM_NOTIFY, "_edita_listview")


        ;$SITIWEB_NewItem_Opzioni_Button2 = GUICtrlCreateButton($GUI_Lang[220], 722, 511, 75, 21) ; Immagini
        ;GUICtrlSetOnEvent($SITIWEB_NewItem_Opzioni_Button2, _Foto_X_opzioni)
        GUICtrlSetOnEvent($SITIWEB_NewItem_Opzioni_Button3, _Copia_link_clipboard)
        GUICtrlSetOnEvent($SITIWEB_NewItem_Opzioni_Button2, _Attiva_opzioni_custom)

        GUICtrlCreateGroup("", -99, -99, 1, 1)
        ;$SITIWEB_NewItem_Opzioni_Group2 = GUICtrlCreateGroup($GUI_Lang[219], 0, 544, 804, 177) ; opzioni custum
        ;$SITIWEB_NewItem_Opzioni_List2 = _ListView_OK("", 5, 562, 793, 123, "Famiglia_150_Opzioni_150_SKU_50_Qtt._50_Immagini_380")
        $SITIWEB_NewItem_Opzioni_Button1 = GUICtrlCreateButton($GUI_Lang[12], 716, 128, 75, 21) ; inserisci
        ;GUICtrlCreateGroup("", -99, -99, 1, 1)
        GUICtrlSetOnEvent($SITIWEB_NewItem_Opzioni_Button1, _Formatta_opzioni_custom)

        $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True)
        ;       $iLV_Left_Index = _GUIListViewEx_Init($SITIWEB_NewItem_Opzioni_List1, "", 1, 0, True,1 + 8 + 16 + 32)
        ; All columns editable
        _GUIListViewEx_SetEditStatus($iLV_Left_Index, "*")

        GUISetState(@SW_SHOW)
        ; Register for editing & dragging  va messo sempre per ultimo
        _GUIListViewEx_MsgRegister()

        Local $k_for = 0, $h_for = 0, $t_for = 1, $p = 0, $Q = 0
        $res = _Remove_BlankIN_Array2D($res)

        For $g = 0 To UBound($res) - 1

            If StringInStr($res[$g][0], '<NameRecommendation>') <> 0 Then
                Local $sString = StringReplace($res[$g][0], "<NameRecommendation>", "")
                $res[$g][0] = $sString

            EndIf
            If StringInStr($res[$g][1], '<ValueRecommendation>') <> 0 Then
                Local $sString = StringReplace($res[$g][1], "<ValueRecommendation>", "")
                $res[$g][1] = $sString
            EndIf

            _GUICtrlListView_BeginUpdate($SITIWEB_NewItem_Opzioni_List1)
            GUICtrlCreateListViewItem($res[$g][0] & "|" & $res[$g][1], $SITIWEB_NewItem_Opzioni_List1)
            If Not Mod($g, 2) Then
                ;Even
                GUICtrlSetBkColor(-1, 0xffffff)
            Else
                ;Odd
                GUICtrlSetBkColor(-1, 0xe6e6e6)
            EndIf
        Next
        _GUICtrlListView_EndUpdate($SITIWEB_NewItem_Opzioni_List1)

    Else
        MsgBox(0, 'Info', 'Hai già premuto il tasto attendi')

    EndIf
    GUISetCursor(2, 1) ; mouse puntatore
    ;_ArrayDisplay($res, 'fine')

EndFunc   ;==>_Taglie_colori_opzioni

and  this is  a  error 

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
"E:\_GESTIONALE_NEW\include\GUIListViewEx.au3" (4412) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aGLVEx_SrcArray[$aLocation[0] + 1][$aLocation[1]] = $sItemNewText
^ ERROR
->19:08:36 AutoIt3.exe ended.rc:1

you have some suggestions???

thankz  :)

 

Link to comment
Share on other sites

  • Moderators

ajag,

At a guess you have not registered the required Windows messages using _GUIListViewEx_MsgRegister BEFORE any colour operations - as it specifies in the guide I wrote:

Quote

Finally you will need to register some Windows messages so that the UDF can intercept various key and mouse events and determine the correct actions to take. This is done via _GUIListViewEx_MsgRegister note that if using coloured items, this function must be run before calling GUISetState to display the GUI in which the ListView appears.

Just to prove it works:

#include <GUIConstantsEx.au3>

#include <GUIListViewEx.au3>

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

$cLV = GUICtrlCreateListView("", 10,10, 400, 200)
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT)
For $i = 0 To 3
    _GUICtrlListView_AddColumn ($cLV, "", 90)
Next
For $i = 0 To 9
    GUICtrlCreateListViewItem("Item 0-" & $i & "|SubItem 1-" & $i & "|SubItem 2-" & $i & "|SubItem 3-" & $i, $cLV)
Next

GUISetState()

; Register required message BEFORE any colour actions
_GUIListViewEx_MsgRegister()

$aLV = _GUIListViewEx_ReadToArray($cLV, 0)
$iLV = _GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 32)
$iRet = _GUIListViewEx_SetColour($iLV, "0xFFFF00;0xFF0000", 2, 2)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

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

  • Moderators

faustf,

I repeat what I posted above:

Quote

You expect me to offer assistance when all you offer is 2 random functions and a very garbled description of the problem? I know my crystal ball is pretty good at times, but I draw the line at this. You need to provide some runnable code showing the problem - i am afraid the UDF is far too complex to debug with what you have posted.

However, I am prepared to make a guess at what might be the problem in each case:

- In the first of the 2 "problem snippets" you have used _GUIListViewEx_SetDefColours to try and set the colour for different rows - this is despite the clear description of the function in its header as:

Sets default colours for user colour/single cell select enabled ListViews

So as the function would never do what you want, why are you surprised when it does not?

- In the second "problem snippet" you initiate the listView and then use GUICtrlCreateListViewItem to add items to it. Once the ListView is initiated you need to use the UDF functions to manipulate the ListView data so that UDF is aware of the changes you have made. As you have coded it, the UDF thinks that the ListView is empty as it does not recognise the added items - it is therefore hardly surprising that the UDF fails when subsequently asked to act on this "invisible" content.

Over the next few days I am rather busy with other activities, but I will try and produce an example which shows you how to use the UDF to do what I think you want to 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

  • Moderators

faustf,

In fact I do not believe it is that difficult:

#include <GUIConstantsEx.au3>

#include <GUIListViewEx.au3>

; Set array to give alternate line colouring
Global $aColArray[10][4] = [[";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF"], _
                            [";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6"], _
                            [";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF"], _
                            [";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6"], _
                            [";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF"], _
                            [";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6"], _
                            [";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF"], _
                            [";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6"], _
                            [";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF", ";0xFFFFFF"], _
                            [";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6", ";0xE6E6E6"]]

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

$cLV = GUICtrlCreateListView("", 10,10, 400, 300)
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT)
; Add columns
For $i = 0 To 3
    _GUICtrlListView_AddColumn ($cLV, "", 90)
Next
; Add data
For $i = 0 To 9
    GUICtrlCreateListViewItem("Item 0-" & $i & "|SubItem 1-" & $i & "|SubItem 2-" & $i & "|SubItem 3-" & $i, $cLV)
Next

; Register required message BEFORE any colour actions
_GUIListViewEx_MsgRegister()

; Read the current ListView content
$aLV = _GUIListViewEx_ReadToArray($cLV, 0)
; Inititate the ListView using that content
$iLV = _GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 32)
; Load the required ListView colour array
_GUIListViewEx_LoadColour($iLV, $aColArray)
; Set all columns editable
_GUIListViewEx_SetEditStatus($iLV, "*")

; Only show ListView once all the above is complete
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

    ; Allow editing
    $aRet = _GUIListViewEx_EditOnClick()
    ; Allow colour resets after edit
    _GUIListViewEx_ColourEvent()

WEnd

Does that help?

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

  • 1 month later...

Hello Melba23,

as previously stated I already like the UDF, no doubt.
I face a small issue and I can't see if this is a design or a understanding issue.

Let's take example1:

Might it be possible to have a drag and drop with checkboxes between the listview?

As soon As I disable the checkboxes it works as expected.

Is there something I need to enable a drag/drop with checkboxes?

Currently I use a button ">" and "<" to get around this, but a drag drop would be nice to have.

I you say ( I searched the code/posts but found no real trace) : by design. I'm fine.

 

 

Edited by Tankbuster
Link to comment
Share on other sites

  • Moderators

Tankbuster,

It was an early design choice not to allow dragging to/from checkbox-enabled ListViews - basically because carrying over the existing checkbox state was complicating the code too much. Amending the code to allow drag/drop between checkbox-enabled ListViews is relatively easy, but any previously-checked dragged items would lose their checked state when dropped.

Given that limitation, is it worth doing? I have a new version of the UDF just about ready to release (probably next week as we have family visiting this weekend) so I could incorporate it if you wished.

M23

Edit: Looking at the new code, I might be able to remove that limitation - but do not hold your breath!

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

Oh and may I ask one additional question.

What would be the best way to init a complete ListView handled by the UDF? For some sort of Dynamic rebuild without first deleting the items one by one with _GUIListViewEx_DeleteColSpec

Like reset the array used onthe init? AND/Or recall the INIT method?
 

 

Link to comment
Share on other sites

  • Melba23 changed the title to GUIListViewEx - BugFix Version 6 Apr 24

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