Moderators Melba23 Posted January 16 Author Moderators Posted January 16 Anthony72, Which "blue bar"? The one in the combo or rhte one on the ListView? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Anthony72 Posted January 16 Posted January 16 (edited) ListeView Edited January 16 by Anthony72 Ajout de capture d'écran My UDF GuiStatusBar facile
Moderators Melba23 Posted January 16 Author Moderators Posted January 16 Antony72, Then you are looking at an owner-drawn ListView - which you can produce by using my UDF. Look at the right ListView in Example 6 - the only highlight is in the cell you actually select. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Nine Posted January 16 Posted January 16 I don't want to interfere here but (based on french forum of AutoIt) I believe he wants to remove all reference to selected rows when he launches a "SelectClear" on the ListView. So all blue lines are removed. I had to do something similar in one of my scripts, maybe it will help (or maybe not) : Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = $tCustDraw.dwDrawStage If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = $tCustDraw.iSubItem Local $iItem = $tCustDraw.dwItemSpec If ControlListView($hWnd, "", $tNMHDR.hWndFrom, "IsSelected", $iItem) Then Return $CDRF_DODEFAULT ... Return $CDRF_NEWFONT “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Anthony72 Posted January 17 Posted January 17 (edited) 5 hours ago, Nine said: I don't want to interfere here but (based on french forum of AutoIt) I believe he wants to remove all reference to selected rows when he launches a "SelectClear" on the ListView. So all blue lines are removed. I had to do something similar in one of my scripts, maybe it will help (or maybe not) : Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam) Local $iDrawStage = $tCustDraw.dwDrawStage If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iSubItem = $tCustDraw.iSubItem Local $iItem = $tCustDraw.dwItemSpec If ControlListView($hWnd, "", $tNMHDR.hWndFrom, "IsSelected", $iItem) Then Return $CDRF_DODEFAULT ... Return $CDRF_NEWFONT Hello Melba23, NINE, yes that’s right, I probably worded my request poorly. I found a piece of code but it creates an additional function which I find cumbersome, I really have to put it in a "Func WM_NOTIFY" or can I put it after the code of a single function? Which would be much lighter and more fluid. Edited January 17 by Anthony72 My UDF GuiStatusBar facile
Moderators Melba23 Posted January 17 Author Moderators Posted January 17 Anthony72, In that case I would do something like the following when you want to clear the selections: ; Read current content from UDF $aContent = _GUIListViewEx_ReturnArray($iLV_Index) ; Clear ListView from UDF _GUIListViewEx_Close($iLV_Index) ; Delete all items with NON-UDF function <<<<<<<<<<<<<<<<<<<< _GUICtrlListView_DeleteAllItems($hListView) ; Re-initiate ListView with saved array $iLV_Index = _GUIListViewEx_Init($hListView, $aContent [plus whatever other parameters you need]) ; Activate ListView _GUIListViewEx_SetActive($iLV_Index) As long as your ListView is not enormous that will not take overlong. Note the use of a non-UDF function in there - use the correct parameter in the various calls! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Anthony72 Posted January 17 Posted January 17 (edited) Spoiler expandcollapse popup#include <GuiListBox.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> ;~ #include "GUIListViewEx.au3" #include ".\GUIListViewEx\GUIListViewEx.au3" $hGUI = GUICreate("ListView Example_6 Light", 660, 330) ; Create ListView GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit Multi ComboBox's) etc...", 10, 10, 400, 20) $cLV_1 = GUICtrlCreateListView("Col 0|Col 1|Col 2|Col 3", 10, 30, 640, 260, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($cLV_1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth($cLV_1, $i, 158) Next ; Create Cols & Rows Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1[$vCols][$vRows] $aLVArray_1[0][0] = "RJ-45 color order USA|RJ-45 color order EUROPE|RJ-45 color order ASIA" $aLVArray_1[0][2] = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" $aLVArray_1[1][0] = "Standard TV USA|Standard TV EUROPE" $aLVArray_1[1][2] = "NTSC|Pal/Secam|Pal/Secam/NTSC" $aLVArray_1[2][1] = "Black|White|Yellow|Green|Red|Blue" $aLVArray_1[3][2] = "50 HZ|55 hZ|60 hZ|120 hZ|144 hZ" $aLVArray_1[4][0] = "Janvier|Février|Mars|Avril|Mai|Juin|Juillet|Août|Septembre|Octobre|Novembre|Décembre" $aLVArray_1[5][3] = "Lundi|Mardi|Mercredi|Jeudi|Vendredi|Samedi|Dimanche" _Combo_Set( $cLV_1, $vRows, $vCols, $aLVArray_1) ; Initiate ListView = sort on column click - editable headers $iLVIndex_1 = _GUIListViewEx_Init( $cLV_1, $aLVArray_1, 0, 0, True, 1 + 8 + 32) ; + 16 ; Set column edit status _GUIListViewEx_SetEditStatus( $iLVIndex_1, "0", 9, _Combo_Edit) ; Call function when double clicked _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "2", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "3", 9, _Combo_Edit) $cContent = GUICtrlCreateButton("Content", 100, 295, 80, 30) $cLVArray = GUICtrlCreateButton("LVArray", 200, 295, 80, 30) $cHeaders = GUICtrlCreateButton("Headers", 300, 295, 80, 30) _GUIListViewEx_MsgRegister() GUISetState() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cContent $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1) _ArrayDisplay($aRet, "$cContent", Default, 8) Case $cLVArray _ArrayDisplay( $aLVArray_1, "$aLVArray_1", Default, 8) Case $cHeaders $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 4) _ArrayDisplay($aRet, "$cHeaders", Default, 8) EndSwitch $vRet = _GUIListViewEx_EventMonitor() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 Local $aRet = StringSplit($vRet, ":") MsgBox($MB_SYSTEMMODAL, "Dragged", "From ListView " & $aRet[1] & @CRLF & "To ListView " & $aRet[2]) EndSwitch WEnd Func _Combo_Set( $hLV, $iRow, $iCol, $vValue) Local $vRet = "", $vValueCombo = "" For $i = 0 To $iCol -1 $vRet = "" $vValueCombo = "" For $j = 0 To $iRow -1 $vRet = StringLeft( $vValue[$i][$j], StringInStr( $vValue[$i][$j], "|") -1) $vValueCombo &= $vRet & "|" Next If $vValueCombo <> "" Or $vRet = "" Then GUICtrlCreateListViewItem( $vValueCombo, $hLV) Next EndFunc Func _Combo_Edit( $hLV, $iIndexLV, $iRow, $iCol) Local $a_LVArray = $aLVArray_1 ; External Global Array to Local Local $sCombo_Fill Switch $iRow Case 0 To UBound( $a_LVArray, $UBOUND_ROWS) -1 Switch $iCol Case 0 To UBound( $a_LVArray, $UBOUND_COLUMNS) -1 $sCombo_Fill = $a_LVArray[ $iRow][ $iCol] EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) Local $aPos = ControlGetPos( $hGUI, "", $hLV) ;~ ConsoleWrite( "Line=" & @ScriptLineNumber & @TAB & "Position: " & $aPos[0] & ", " & $aPos[1] & ", Size: " & $aPos[2] & ", " & $aPos[3] &@CRLF) $aRect = _GUICtrlListView_GetSubItemRect( $hLV, $iRow, $iCol) $X = $aPos[0]+$aRect[0] +2 $Y = $aPos[1]+$aRect[1] +1 ;~ $W = $aRect[2]-$aRect[0] $W = _GUICtrlListView_GetColumnWidth($hLV, $iCol) $H = $aRect[3]-$aRect[1] +2 ;~ ConsoleWrite( "Line=" & @ScriptLineNumber & @TAB & "$hLV=" & $hLV & ", $iRow=" & $iRow & ", $iCol=" & $iCol & StringFormat(", Subitem Rectangle "&$iRow&","&$iCol&" OK : [%d, %d, %d, %d]", $X, $Y, $W, $Y)&@CRLF) ; Create combo dialog $hCombo_Dialog = GUICreate( "", $W, $H, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) ; Attach window to the desktop (always on bottom) _WinAPI_SetParent( $hCombo_Dialog, $hGUI) ; Move GUI 2 WinMove( $hCombo_Dialog, "", $X, $Y, $W, $H) ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[0]) ; Fill combo with required elements GUICtrlSetData( $cCombo, $sCombo_Fill, _GUICtrlListView_GetItemText( $hLV, $iRow, $iCol)) ; ---> ------------------------------------------------------------------------------------------------------------------- ;~ _GUIListViewEx_BlockReDraw( $cLV_1, True) ; True = Prevent redrawing during Insert/Delete/Change calls GUICtrlSetState( $cLV_1, $GUI_NOFOCUS) ;~ ConsoleWrite( "Line=" & @ScriptLineNumber & @TAB & GUICtrlRead( GUICtrlRead( $cLV_1)) &@CRLF) ;~ For $i = 0 To _GUICtrlListView_GetColumnCount( $hLV) ;~ _GUIListViewEx_SetColour( $cLV_1, ";" , $iRow, $i) ; ";" <= par Default > ";" & $iWhite <=Par couleur ;~ Next WinActivate( $hCombo_Dialog, "") ;~ _GUIListViewEx_BlockReDraw( $cLV_1, False) ; False = Allow future redrawing and force a redraw ; <--- ------------------------------------------------------------------------------------------------------------------- GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, WinActive( $hCombo_Dialog) GUIDelete( $hCombo_Dialog) Return Case $cCombo ExitLoop EndSwitch WEnd ; Change ListView element to match selection _GUIListViewEx_ChangeItem( $iIndexLV, $iRow, $iCol, GUICtrlRead( $cCombo)) GUIDelete( $hCombo_Dialog) EndFunc Hello Melba23, I have just done a big update of the code, I am almost finished, all I have to do is look at your code but I want to avoid breaking the ListView each time a cell is refreshed for example Edited January 17 by Anthony72 Code update My UDF GuiStatusBar facile
Anthony72 Posted January 17 Posted January 17 Here I have arrived at the goal, I know Melba23's UDF by heart now. Thanks to NINE who also offered to help me. Looking forward... expandcollapse popup#include <GuiListBox.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> #include "GUIListViewEx.au3" ;~ #include ".\GUIListViewEx\GUIListViewEx.au3" $hGUI = GUICreate("ListView Example_6 MultiComBoxX's", 660, 330) ; Create ListView GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit Multi ComboBox's) etc...", 10, 10, 400, 20) $idListview_1 = GUICtrlCreateListView("Col 0|Col 1|Col 2|Col 3", 10, 30, 640, 260, BitOR( $LVS_SINGLESEL, $LVS_SHOWSELALWAYS)) ; $iD $hListView_1 = ControlGetHandle( $hGUI, "", $idListview_1) _GUICtrlListView_SetExtendedListViewStyle( $idListview_1, BitOR( $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) ; BitOR( $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth( $idListview_1, $i, 158) Next ; Create Cols & Rows Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1[$vCols][$vRows] $aLVArray_1[0][0] = "RJ-45 color order USA|RJ-45 color order EUROPE|RJ-45 color order ASIA" $aLVArray_1[0][2] = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" $aLVArray_1[1][0] = "Standard TV USA|Standard TV EUROPE" $aLVArray_1[1][2] = "NTSC|Pal/Secam|Pal/Secam/NTSC" $aLVArray_1[2][1] = "Black|White|Yellow|Green|Red|Blue" $aLVArray_1[3][2] = "50 HZ|55 hZ|60 hZ|120 hZ|144 hZ" $aLVArray_1[4][0] = "Janvier|Février|Mars|Avril|Mai|Juin|Juillet|Août|Septembre|Octobre|Novembre|Décembre" $aLVArray_1[5][3] = "Lundi|Mardi|Mercredi|Jeudi|Vendredi|Samedi|Dimanche" _Combo_Array( $idListview_1, $aLVArray_1, $vRows, $vCols) ; ; Initiate ListView = sort on column click - editable headers $iLVIndex_1 = _GUIListViewEx_Init( $idListview_1, $aLVArray_1, 0, 0, True, 8 + 256 +512) ; + 16 ; Set column edit status _GUIListViewEx_SetEditStatus( $iLVIndex_1, "0", 9, _Combo_Edit) ; Call function when double clicked ;~ _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1") ; "0;2;3" _GUIListViewEx_SetEditStatus( $iLVIndex_1, "2", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "3", 9, _Combo_Edit) $cContent = GUICtrlCreateButton("Content", 100, 295, 80, 30) $cLVArray = GUICtrlCreateButton("LVArray_1", 200, 295, 80, 30) $cHeaders = GUICtrlCreateButton("Headers", 300, 295, 80, 30) GUISetState() _GUIListViewEx_MsgRegister() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cContent $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1) _ArrayDisplay($aRet, "$cContent", Default, 8) Case $cLVArray _ArrayDisplay( $aLVArray_1, "$aLVArray_1", Default, 8) Case $cHeaders $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 4) _ArrayDisplay($aRet, "$cHeaders", Default, 8) EndSwitch $vRet = _GUIListViewEx_EventMonitor() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 Local $aRet = StringSplit($vRet, ":") MsgBox($MB_SYSTEMMODAL, "Dragged", "From ListView " & $aRet[1] & @CRLF & "To ListView " & $aRet[2]) EndSwitch WEnd Func _Combo_Array( $hLV, $vValue, $iRow, $iCol) Local $vRet = "", $vValueCombo = "" For $i = 0 To $iCol -1 $vRet = "" $vValueCombo = "" For $j = 0 To $iRow -1 $vRet = StringLeft( $vValue[$i][$j], StringInStr( $vValue[$i][$j], "|") -1) $vValueCombo &= $vRet & "|" Next If $vValueCombo <> "" Or $vRet = "" Then GUICtrlCreateListViewItem( $vValueCombo, $hLV) Next EndFunc Func _Combo_Edit( $hLV, $iIndexLV, $iRow, $iCol) _GUIListViewEx_BlockReDraw( $idListview_1, True) ; True = Prevent redrawing during Insert/Delete/Change calls Local $a_LVArray = $aLVArray_1 ; <=== External Global Array to Local Local $sCombo_Fill Switch $iRow Case 0 To UBound( $a_LVArray, $UBOUND_ROWS) -1 Switch $iCol Case 0 To UBound( $a_LVArray, $UBOUND_COLUMNS) -1 $sCombo_Fill = $a_LVArray[ $iRow][ $iCol] EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) Local $aPos = ControlGetPos( $hGUI, "", $hLV) $aRect = _GUICtrlListView_GetSubItemRect( $hLV, $iRow, $iCol) $X = $aPos[0]+$aRect[0] +2 $Y = $aPos[1]+$aRect[1] +1 $W = _GUICtrlListView_GetColumnWidth($hLV, $iCol) $H = $aRect[3]-$aRect[1] +2 ; Create combo dialog $hCombo_Dialog = GUICreate( "", $W, $H, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) ; Attach window to the desktop (always on bottom) _WinAPI_SetParent( $hCombo_Dialog, $hGUI) ; Move GUI 2 WinMove( $hCombo_Dialog, "", $X, $Y, $W, $H) ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[1]) ; Fill combo with required elements GUICtrlSetData( $cCombo, $sCombo_Fill, _GUICtrlListView_GetItemText( $hLV, $iRow, $iCol)) GUISetState() ControlClick( $hCombo_Dialog, "", $cCombo, "left", 1, $aLVPos[0]-5, $aLVPos[1]-5) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, WinActive( $hCombo_Dialog) GUIDelete( $hCombo_Dialog) Return Case $cCombo ExitLoop EndSwitch WEnd ; Change ListView element to match selection _GUIListViewEx_ChangeItem( $iIndexLV, $iRow, $iCol, GUICtrlRead( $cCombo)) ControlListView( $hGUI, "", $idListview_1, "DeSelect", $iRow) _GUICtrlListView_SetItemFocused( $hListView_1, $iRow, False) _GUIListViewEx_BlockReDraw( $idListview_1, False) ; False = Allow future redrawing and force a redraw GUIDelete( $hCombo_Dialog) EndFunc MultiComBoxX's.au3 My UDF GuiStatusBar facile
Moderators Melba23 Posted January 18 Author Moderators Posted January 18 Antony72, Quote Here I have arrived at the goal Great! Quote I know Melba23's UDF by heart now Probably better then me then! M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Anthony72 Posted January 23 Posted January 23 Good evening On 1/18/2024 at 10:08 AM, Melba23 said: Great! Well almost. On 1/18/2024 at 10:08 AM, Melba23 said: Probably better then me then! I'm not the author, I'm far from the best, I'm doing my best My UDF GuiStatusBar facile
Anthony72 Posted January 23 Posted January 23 I would like to be able to update the position of a Drag and Drop of rows and columns in $aLVArray_1 [$vCols][$vRows] So far I haven't found a solution. expandcollapse popup#include <GuiListBox.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> ;~ #include "GUIListViewEx.au3" #include ".\GUIListViewEx\GUIListViewEx.au3" Global $iYellow = "0xFFFF00", _ $iLtBlue = "0xCCCCFF", _ $iGreen = "0x00FF00", _ $iBlack = "0x000000", _ $iRed = "0xFF0000", _ $iBlue = "0x0000FF", _ $iWhite = "0xFFFFFF" $hGUI = GUICreate("ListView Example_6 MultiComBoxX's", 660, 330) ; Create ListView $idLabel_1 = GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit Multi ComboBox's) etc...", 10, 10, 400, 20) $idLabel_2 = GUICtrlCreateLabel("From Index= , Row= , Col= ", 10, 295, 150, 15) $idLabel_3 = GUICtrlCreateLabel("To Index= , Row= , Col= ", 10, 310, 150, 15) $idListview_1 = GUICtrlCreateListView("Col 0|Col 1|Col 2|Col 3", 10, 30, 640, 260, BitOR( $LVS_EDITLABELS, $LVS_SINGLESEL)) ; $iD $hListView_1 = ControlGetHandle( $hGUI, "", $idListview_1) _GUICtrlListView_SetExtendedListViewStyle( $idListview_1, BitOR( $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth( $idListview_1, $i, 158) Next ;~ ; Create Cols & Rows Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1 [$vCols][$vRows] $aLVArray_1[0][0] = "RJ-45 color order USA|RJ-45 color order EUROPE|RJ-45 color order ASIA" $aLVArray_1[0][2] = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" $aLVArray_1[1][0] = "Standard TV USA|Standard TV EUROPE" $aLVArray_1[1][2] = "NTSC|Pal/Secam|Pal/Secam/NTSC" $aLVArray_1[2][1] = "Black|White|Yellow|Green|Red|Blue" $aLVArray_1[3][2] = "50 HZ|55 hZ|60 hZ|120 hZ|144 hZ" $aLVArray_1[4][0] = "Janvier|Février|Mars|Avril|Mai|Juin|Juillet|Août|Septembre|Octobre|Novembre|Décembre" $aLVArray_1[5][3] = "Lundi|Mardi|Mercredi|Jeudi|Vendredi|Samedi|Dimanche" _Combo_Array( $idListview_1, $aLVArray_1, $vRows, $vCols) ; ; Initiate ListView = sort on column click - editable headers $iLVIndex_1 = _GUIListViewEx_Init( $idListview_1, $aLVArray_1, 0, 0, True, 8 + 32 + 256) ; $iLVIndex_1 = _GUIListViewEx_Init( $idListview_1, $aLVArray_1, 0, 0, True, 8 + 256 +512) ; + 16 ; Set column edit status _GUIListViewEx_SetEditStatus( $iLVIndex_1, "0", 9, _Combo_Edit) ; Call function when double clicked ;~ _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1") ; "0;2;3" _GUIListViewEx_SetEditStatus( $iLVIndex_1, "2", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "3", 9, _Combo_Edit) $cContent = GUICtrlCreateButton("Content", 180, 295, 80, 30) ; $iMode - 0 = Content of ListView $sCheckboxes = GUICtrlCreateButton("Checkboxes", 280, 295, 80, 30) ; 1 - State of the checkboxes ; 2 - User colours (if initialised) ; 3 - Content of ListView forced to 2D for saving $cLVArray = GUICtrlCreateButton("LVArray_1", 380, 295, 80, 30) ; $cHeaders = GUICtrlCreateButton("Headers", 480, 295, 80, 30) ; 4 - ListView header titles ; 5 - Header colours (if initialised) GUISetState() _GUIListViewEx_MsgRegister() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cContent $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 0) ; $iMode - 0 = Content of ListView _ArrayDisplay($aRet, "$cContent", Default, 8) Case $sCheckboxes $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 1) ; 1 - State of the checkboxes _ArrayDisplay($aRet, "$cContent", Default, 8) Case $cLVArray _ArrayDisplay( $aLVArray_1, "$aLVArray_1", Default, 8) Case $cHeaders $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 4) ; 4 - ListView header titles _ArrayDisplay($aRet, "$cHeaders", Default, 8) EndSwitch $vRet = _GUIListViewEx_EventMonitor() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 Local $aRet = StringSplit($vRet, ":") MsgBox($MB_SYSTEMMODAL, "Dragged", "From "&$vDrag&@CR&" ListView " & $aRet[1] & @CRLF & "To ListView " & $aRet[2]) ControlCommand( $hGUI, "", $cLVArray, "SendCommandID") ; ---> ------------------------------------------------------------------------------------------------------------------- ; <--- ------------------------------------------------------------------------------------------------------------------- Case 9 If $vRet = "" Then Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) $vDrag = $vRet[0]&"|"&$vRet[1]&"|"&$vRet[2] GUICtrlSetData( $idLabel_2, "From Index=" & $vRet[0] &", Row="& $vRet[1] &", Col="& $vRet[2]) ; [ListView index, zero-based row, zero-based col] ;~ GUICtrlSetData( $idLabel_3, "To Index=" & $vRet[0] &", Row="& $vRet[1] &", Col="& $vRet[2]) ; [ListView index, zero-based row, zero-based col] EndIf EndSwitch WEnd Func _Combo_Array( $hLV, $vValue, $iRow, $iCol) Local $vRet = "", $vValueCombo = "" For $i = 0 To $iCol -1 $vRet = "" $vValueCombo = "" For $j = 0 To $iRow -1 $vRet = StringLeft( $vValue[$i][$j], StringInStr( $vValue[$i][$j], "|") -1) $vValueCombo &= $vRet & "|" Next If $vValueCombo <> "" Or $vRet = "" Then GUICtrlCreateListViewItem( $vValueCombo, $hLV) Next EndFunc Func _Combo_Edit( $hLV, $iIndexLV, $iRow, $iCol) _GUIListViewEx_BlockReDraw( $idListview_1, True) ; True = Prevent redrawing during Insert/Delete/Change calls Local $a_LVArray = $aLVArray_1 ; <=== External Global Array to Local Local $sCombo_Fill Switch $iRow Case 0 To UBound( $a_LVArray, $UBOUND_ROWS) -1 Switch $iCol Case 0 To UBound( $a_LVArray, $UBOUND_COLUMNS) -1 $sCombo_Fill = $a_LVArray[ $iRow][ $iCol] EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) Local $aPos = ControlGetPos( $hGUI, "", $hLV) $aRect = _GUICtrlListView_GetSubItemRect( $hLV, $iRow, $iCol) $X = $aPos[0]+$aRect[0] +2 $Y = $aPos[1]+$aRect[1] +1 $W = _GUICtrlListView_GetColumnWidth($hLV, $iCol) $H = $aRect[3]-$aRect[1] +2 ; Create combo dialog $hCombo_Dialog = GUICreate( "", $W, $H, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) ; Attach window to the desktop (always on bottom) _WinAPI_SetParent( $hCombo_Dialog, $hGUI) ; Move GUI 2 WinMove( $hCombo_Dialog, "", $X, $Y, $W, $H) ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[1]) ; Fill combo with required elements GUICtrlSetData( $cCombo, $sCombo_Fill, _GUICtrlListView_GetItemText( $hLV, $iRow, $iCol)) GUISetState() ControlClick( $hCombo_Dialog, "", $cCombo, "left", 1, $aLVPos[0]-5, $aLVPos[1]-5) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, WinActive( $hCombo_Dialog) GUIDelete( $hCombo_Dialog) Return Case $cCombo ExitLoop EndSwitch WEnd ; Change ListView element to match selection _GUIListViewEx_ChangeItem( $iIndexLV, $iRow, $iCol, GUICtrlRead( $cCombo)) _GUIListViewEx_SetColour( $iLVIndex_1, $iRed&";"&$iYellow, $iRow, $iCol) ; _GUIListViewEx_SetColour( $iLV_Index, $sColSet, $iRow, $iCol) ControlListView( $hGUI, "", $idListview_1, "DeSelect", $iRow) _GUICtrlListView_SetItemFocused( $hListView_1, $iRow, False) _GUIListViewEx_BlockReDraw( $idListview_1, False) ; False = Allow future redrawing and force a redraw GUIDelete( $hCombo_Dialog) EndFunc My UDF GuiStatusBar facile
Moderators Melba23 Posted January 24 Author Moderators Posted January 24 Antony72, That was fun! You can now get start/end details of a "drag/drop" row from the returned event notification in Mode 4. And I have added a new Mode 6 for a column reorder event which shows the original and new ordering. You need to amend your script a bit to access the new data: Case 4 Local $aRet = StringSplit($vRet, ":") MsgBox($MB_SYSTEMMODAL, "Drag Event", "Row " & $aRet[3] & " dragged to row "& $aRet[4]) ControlCommand( $hGUI, "", $cLVArray, "SendCommandID") Case 6 MsgBox($MB_SYSTEMMODAL, "Column Reorder", $vRet) And here is the amended UDF: GUIListViewEx_Drag.au3 Let me know what you think. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Anthony72 Posted January 25 Posted January 25 Hi Melba23, Nice work So I added support for rows without any problem but here I am stuck. No matter how much I debug, I don't see the problem, probably an oversight, but I really don't see my error. Grrrrr that blue selection bar. 🟦 expandcollapse popup#include <GuiListBox.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <StaticConstants.au3> #include <UpDownConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <Misc.au3> #include <String.au3> #include <Array.au3> ;~ #include "GUIListViewEx.au3" #include ".\GUIListViewEx\GUIListViewEx.au3" Global $iYellow = "0xFFFF00", _ $iLtBlue = "0xCCCCFF", _ $iGreen = "0x00FF00", _ $iBlack = "0x000000", _ $iRed = "0xFF0000", _ $iBlue = "0x0000FF", _ $iWhite = "0xFFFFFF" $hGUI = GUICreate("ListView Example_6 MultiComBoxX's", 660, 330) ; Create ListView $idLabel_1 = GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit Multi ComboBox's) etc...", 10, 10, 400, 20) $idLabel_2 = GUICtrlCreateLabel("From Index= , Row= , Col= ", 10, 295, 150, 15) $idLabel_3 = GUICtrlCreateLabel("To Index= , Row= , Col= ", 10, 310, 150, 15) $idListview_1 = GUICtrlCreateListView("Col 0|Col 1|Col 2|Col 3", 10, 30, 640, 260, BitOR( $LVS_EDITLABELS, $LVS_SINGLESEL)) ; $iD $hListView_1 = ControlGetHandle( $hGUI, "", $idListview_1) _GUICtrlListView_SetExtendedListViewStyle( $idListview_1, BitOR( $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP)) For $i = 0 To 3 _GUICtrlListView_SetColumnWidth( $idListview_1, $i, 158) Next ;~ ; Create Cols & Rows Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1 [$vCols][$vRows] $aLVArray_1[0][0] = "RJ-45 color order USA|RJ-45 color order EUROPE|RJ-45 color order ASIA" $aLVArray_1[0][2] = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" $aLVArray_1[1][0] = "Standard TV USA|Standard TV EUROPE" $aLVArray_1[1][2] = "NTSC|Pal/Secam|Pal/Secam/NTSC" $aLVArray_1[2][1] = "Black|White|Yellow|Green|Red|Blue" $aLVArray_1[3][2] = "50 HZ|55 hZ|60 hZ|120 hZ|144 hZ" $aLVArray_1[4][0] = "Janvier|Février|Mars|Avril|Mai|Juin|Juillet|Août|Septembre|Octobre|Novembre|Décembre" $aLVArray_1[5][3] = "Lundi|Mardi|Mercredi|Jeudi|Vendredi|Samedi|Dimanche" ;~ _ArrayDisplay( $aLVArray_1) _Combo_Array( $idListview_1, $aLVArray_1, $vRows, $vCols) ; ; Initiate ListView = sort on column click - editable headers $iLVIndex_1 = _GUIListViewEx_Init( $idListview_1, $aLVArray_1, 0, 0, True, 8 + 32 + 256) ; $iLVIndex_1 = _GUIListViewEx_Init( $idListview_1, $aLVArray_1, 0, 0, True, 8 + 256 +512) ; + 16 ; Set column edit status _GUIListViewEx_SetEditStatus( $iLVIndex_1, "0", 9, _Combo_Edit) ; Call function when double clicked ;~ _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "1") ; "0;2;3" _GUIListViewEx_SetEditStatus( $iLVIndex_1, "2", 9, _Combo_Edit) _GUIListViewEx_SetEditStatus( $iLVIndex_1, "3", 9, _Combo_Edit) $cContent = GUICtrlCreateButton("Content", 180, 295, 80, 30) ; $iMode - 0 = Content of ListView $sCheckboxes = GUICtrlCreateButton("Checkboxes", 280, 295, 80, 30) ; 1 - State of the checkboxes ; 2 - User colours (if initialised) ; 3 - Content of ListView forced to 2D for saving $cLVArray = GUICtrlCreateButton("LVArray_1", 380, 295, 80, 30) ; $cHeaders = GUICtrlCreateButton("Headers", 480, 295, 80, 30) ; 4 - ListView header titles ; 5 - Header colours (if initialised) GUISetState() _GUIListViewEx_MsgRegister() While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE Exit Case $cContent $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 0) ; $iMode - 0 = Content of ListView _ArrayDisplay($aRet, "$cContent", Default, 8) Case $sCheckboxes $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 1) ; 1 - State of the checkboxes _ArrayDisplay($aRet, "$cContent", Default, 8) Case $cLVArray _ArrayDisplay( $aLVArray_1, "$aLVArray_1", Default, 8) Case $cHeaders $aRet = _GUIListViewEx_ReturnArray($iLVIndex_1, 4) ; 4 - ListView header titles _ArrayDisplay($aRet, "$cHeaders", Default, 8) EndSwitch $vRet = _GUIListViewEx_EventMonitor() If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then ;~ MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 Local $aRet = StringSplit($vRet, ":") ;~ _ArrayDisplay( $aRet) Local $iRows = UBound( $aLVArray_1, $UBOUND_ROWS)-1, $iCols = UBound( $aLVArray_1, $UBOUND_COLUMNS)-1 Local $aExtract = _ArrayExtract( $aLVArray_1, $aRet[3], $aRet[3], 0, $iCols) _ArrayDelete( $aLVArray_1, $aRet[3]) _ArrayInsert($aLVArray_1, $aRet[4], $aExtract) GUICtrlSetData( $idLabel_3, "Row " & $aRet[3] & " dragged to row "& $aRet[4]) ControlCommand( $hGUI, "", $cLVArray, "SendCommandID") ; Get Array $cLVArray Case 6 ; ---> ------------------------------------------------------------------------------------------------------------------- Local $aRet = StringSplit($vRet, "-") ;~ _ArrayDisplay( $aRet) ;~ ConsoleWrite( "$aRet[1]="&$aRet[1]& ", $aRet[2]="&$aRet[2] &@CRLF) Local $Array1 = StringSplit( StringTrimLeft( $aRet[1], 4), "|") ; 0,1,2,3 Local $Array2 = StringSplit( StringTrimLeft( $aRet[2], 4), "|") ; 3,0,1,2 ;~ _ArrayDisplay( $Array1, "Return Before") ;~ _ArrayDisplay( $Array2, "Return After") ; Local $iRows = UBound( $aLVArray_1, $UBOUND_ROWS), $iCols = UBound( $aLVArray_1, $UBOUND_COLUMNS) Local $aRet[$iRows][$iCols] ; [6][4] ;~ _ArrayDisplay( $aRet, "$aRet") For $i = 0 To $iRows-1 ; 5 For $j = 0 To $iCols-1 ; 3 $aRet[$i][$j] = $aLVArray_1[ $i][ $Array1[$j]] ConsoleWrite( "[" & $i &"]["& $j &"], $aRet = "& $aRet[$i][$j] & @CRLF) ;~ ConsoleWrite( "[" & $i &"]["& $j &"], $aLVArray_1 = "& $aLVArray_1[$i][$j] & @CRLF&@CRLF) Next Next $aLVArray_1 = $aRet ;~ _ArrayDisplay( $aRet, "$aRet") ;~ _ArrayDisplay( $aLVArray_1, "$aLVArray_1") ControlCommand( $hGUI, "", $cLVArray, "SendCommandID") ; Get Array $cLVArray ; <--- ------------------------------------------------------------------------------------------------------------------- Case 9 If $vRet = "" Then Else ;~ _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) $vDrag = $vRet[0]&"|"&$vRet[1]&"|"&$vRet[2] GUICtrlSetData( $idLabel_2, "From Index=" & $vRet[0] &", Row="& $vRet[1] &", Col="& $vRet[2]) ; [ListView index, zero-based row, zero-based col] EndIf EndSwitch WEnd Func _Combo_Array( $hLV, $vValue, $iRow, $iCol) Local $vRet = "", $vValueCombo = "" For $i = 0 To $iCol -1 $vRet = "" $vValueCombo = "" For $j = 0 To $iRow -1 $vRet = StringLeft( $vValue[$i][$j], StringInStr( $vValue[$i][$j], "|") -1) $vValueCombo &= $vRet & "|" Next If $vValueCombo <> "" Or $vRet = "" Then GUICtrlCreateListViewItem( $vValueCombo, $hLV) Next EndFunc Func _Combo_Edit( $hLV, $iIndexLV, $iRow, $iCol) _GUIListViewEx_BlockReDraw( $idListview_1, True) ; True = Prevent redrawing during Insert/Delete/Change calls Local $a_LVArray = $aLVArray_1 ; <=== External Global Array to Local Local $sCombo_Fill Switch $iRow Case 0 To UBound( $a_LVArray, $UBOUND_ROWS) -1 Switch $iCol Case 0 To UBound( $a_LVArray, $UBOUND_COLUMNS) -1 $sCombo_Fill = $a_LVArray[ $iRow][ $iCol] EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) Local $aPos = ControlGetPos( $hGUI, "", $hLV) $aRect = _GUICtrlListView_GetSubItemRect( $hLV, $iRow, $iCol) $X = $aPos[0]+$aRect[0] +2 $Y = $aPos[1]+$aRect[1] +1 $W = _GUICtrlListView_GetColumnWidth($hLV, $iCol) $H = $aRect[3]-$aRect[1] +2 ; Create combo dialog $hCombo_Dialog = GUICreate( "", $W, $H, -1, -1, BitOR($WS_POPUP, $WS_SYSMENU), $WS_EX_TOOLWINDOW+$WS_EX_TOPMOST) ; Attach window to the desktop (always on bottom) _WinAPI_SetParent( $hCombo_Dialog, $hGUI) ; Move GUI 2 WinMove( $hCombo_Dialog, "", $X, $Y, $W, $H) ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[1]) ; Fill combo with required elements GUICtrlSetData( $cCombo, $sCombo_Fill, _GUICtrlListView_GetItemText( $hLV, $iRow, $iCol)) GUISetState() ControlClick( $hCombo_Dialog, "", $cCombo, "left", 1, $aLVPos[0]-5, $aLVPos[1]-5) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, WinActive( $hCombo_Dialog) GUIDelete( $hCombo_Dialog) Return Case $cCombo ExitLoop EndSwitch WEnd ; Change ListView element to match selection _GUIListViewEx_ChangeItem( $iIndexLV, $iRow, $iCol, GUICtrlRead( $cCombo)) _GUIListViewEx_SetColour( $iLVIndex_1, $iRed&";"&$iYellow, $iRow, $iCol) ; _GUIListViewEx_SetColour( $iLV_Index, $sColSet, $iRow, $iCol) ControlListView( $hGUI, "", $idListview_1, "DeSelect", $iRow) _GUICtrlListView_SetItemFocused( $hListView_1, $iRow, False) _GUIListViewEx_BlockReDraw( $idListview_1, False) ; False = Allow future redrawing and force a redraw GUIDelete( $hCombo_Dialog) EndFunc My UDF GuiStatusBar facile
Anthony72 Posted January 25 Posted January 25 If only #include <Array.au3> could be updated" I already did this just in case... #include <Array.au3> Local $aArray[4][4] For $i = 0 To 3 For $j = 0 To 3 $aArray[$i][$j] = $i & $j Next Next _ArrayDisplay($aArray, "Original") _ArrayRowMove( $aArray, 3, 0) _ArrayDisplay( $aArray, "Return Rows") _ArrayColMove( $aArray, 2, 3) _ArrayDisplay( $aArray, "Return Cols") Func _ArrayRowMove(ByRef $aArray, $iStart, $iEnd) Local $iRows = UBound( $aArray, $UBOUND_ROWS)-1, $iCols = UBound( $aArray, $UBOUND_COLUMNS)-1 Local $aExtract = _ArrayExtract( $aArray, $iStart, $iStart, 0, $iCols) _ArrayDelete( $aArray, $iStart) _ArrayInsert( $aArray, $iEnd, $aExtract) EndFunc Func _ArrayColMove(ByRef $aArray, $iStart, $iEnd) Local $iRows = UBound( $aArray, $UBOUND_ROWS)-1, $iCols = UBound( $aArray, $UBOUND_COLUMNS)-1 Local $aExtract = _ArrayExtract( $aArray, 0, $iRows, $iStart, $iStart) _ArrayColDelete( $aArray, $iStart) _ArrayColInsert( $aArray, $iEnd) For $i = 0 To $iRows $aArray[$i][$iEnd] = $aExtract[$i] Next EndFunc My UDF GuiStatusBar facile
Moderators Melba23 Posted January 25 Author Moderators Posted January 25 Anthony72, Quote here I am stuck No matter how much I debug, I don't see the problem Stuck with what? Since you started posting about my UDF you constantly say you have problems without clearly explaining what the problems are. So please just explain (en francais si tu veux) exactly what it is that you need to do and what is not happening as you wish. From the scripts you have posted above you appear to be having problems with the column reordering - but what is not to your liking? You have the old and new column order returned from the UDF - it is up to you to do as you wish with that information. And what are these "new" array functions that you have suddenly introduced? What do they have to do with my UDF? Please start explaining your problems in more details or I am going to stop offering assistance as I have no real idea what it is that you are seeking to achieve. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Anthony72 Posted January 25 Posted January 25 I apologize, I seemed to have made that clear, I'm sorry. It's the reorganization of the "Columns" that is causing me problems, I can't get the correct correspondence. I put this code so that it could be useful to someone, I also apologize for the off-topic, it can be deleted. My UDF GuiStatusBar facile
Moderators Melba23 Posted January 25 Author Moderators Posted January 25 Antony72, Quote It's the reorganization of the "Columns" that is causing me problems, I can't get the correct correspondence And once again you do not explain in detail. What "correspondence" are you talking about? The ListView obviously reflects what you have done in reordering the columns and the _EventMonitor tells you the old and new order. Just what is is that is not working for you? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
queensoft Posted January 30 Posted January 30 (edited) See SOLUTION below!!! I'm struggling with 2 problems: 1. How do I update a sub-item of a ListView? Using your example GLVEx_Example_1.au3 Add a button / line of code that changes one single item (cell), let's say column 2, row 2. Right now, I'm using this: _GUICtrlListView_SetItem($cListView_Left, "xxxx", 2, 2) And it works, the new value shows in the proper cell. Also _GUICtrlListView_GetItemTextArray works perfectly on that roe, it returns the new value "xxxx". Later edit: this does NOT work for me, am I doing something wrong?? _GUIListViewEx_ChangeItem($cListView_Left, 2, 2, 'xxxxxx') But here comes problem 2. 2. Drag & drop ANY line/row (not just row 2, updated above). The "xxxx" value disappears and is replaced with the original value. If I use the standard edit function (double click > $iMode - 1 = Editable using manual input, - 2 = Editable using combo) - everything is OK, values are kept after drag&drop. Thank you. SOLUTION: I was using $cListView_Left - $cListView_Left = GUICtrlCreateListView("............ Correct way is to use $iLV_Left_Index = _GUIListViewEx_Init($cListView_Left,.......... And, of course, solution to 1. is to use proper custom function from UDF: _GUIListViewEx_ChangeItem($iLV_Left_Index, Edited January 30 by queensoft
Moderators Melba23 Posted January 30 Author Moderators Posted January 30 queensoft, I wish all the UDF problems were solved by the OP! M23 SOLVE-SMART, queensoft and ioa747 2 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
queensoft Posted January 30 Posted January 30 (edited) New question: how do I accept only some values into a cell? Examples: - accept only numbers (any, inside an interval....) / letters - accept only values from combo (right now, I can enter any text, even tough $iMode - 2 = Editable using combo) Is there an automatic way, already in place in the UDF? Or should I manually check, using _GUIListViewEx_EventMonitor? And question 2: can I add icons to first column? Thank you. Edited January 30 by queensoft
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now