-
Posts
16 -
Joined
-
Last visited
Everything posted by Anthony72
-
Hi all, Update with custom size Thank UEZ ;coded by UEZ 2011 UpDate Anthony72 #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Global Const $hGUI = GUICreate("Display PNG Image in picture control update", 600, 250) Local $X = 10, $Y = 10, $W = 580, $H = 230, $pngFile = "Img.png" Local $idGUICtrlCreatePic = _PNG_To_GUICtrlCreatePic( $X, $Y, $W, $H, $pngFile) GUISetState() While True $msg = GUIGetMsg() Switch $msg Case $idGUICtrlCreatePic GUICtrlDelete ( $idGUICtrlCreatePic) MsgBox(0, "Information", "PNG image was clicked") _PNG_To_GUICtrlCreatePic( $X, $Y, $W, $H, $pngFile) Case $GUI_EVENT_CLOSE GUIDelete( $hGUI) Exit EndSwitch WEnd Func _PNG_To_GUICtrlCreatePic( $X="", $Y="", $W="", $H="", $pngFile="") Local $idPic = GUICtrlCreatePic("", $X, $Y) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile( $pngFile) Local $hBitmap_Scaled = _GDIPlus_ImageResize( $hImage, $W, $H) ;resize image Local $Bmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap( $hBitmap_Scaled) _WinAPI_DeleteObject(GUICtrlSendMsg( $idPic, 0x0172, $IMAGE_BITMAP, $Bmp)) _WinAPI_DeleteObject( $Bmp) _GDIPlus_ImageDispose( $hImage) _GDIPlus_Shutdown() Return $idPic EndFunc
-
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.
-
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
-
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. 🟦 #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
-
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. #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
-
Good evening Well almost. I'm not the author, I'm far from the best, I'm doing my best
-
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... #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
-
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
-
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.
-
-
Effectively ... I'm trying to remove focus from the ListView in order to remove this blue bar but without success, I need a last little help after I'm done with this function. #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 $sRet, $aRetMem $hGUI = GUICreate("ListView Example_6 Light", 660, 330) ; Create ListView GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit ComboBox (RJ-45) etc...", 10, 10, 400, 20) $cLV_1 = GUICtrlCreateListView("Country|Reference|Not use|Not use", 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 ; Créer des Colonnes et des Lignes Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1[$vCols][$vRows] $sData = "RJ-45 color order USA|Blue,Green,Orange,Brown" $aLVArray_1[0][0] = $sData GUICtrlCreateListViewItem($sData, $cLV_1) $sData = "Standard TV USA|NTSC" $aLVArray_1[1][0] = $sData GUICtrlCreateListViewItem($sData, $cLV_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) $cContent = GUICtrlCreateButton("Content", 100, 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 $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_Edit( $hLV, $iIndexLV, $iRow, $iCol) ;~ ConsoleWrite("Line=" & @ScriptLineNumber & @TAB & "$iRow = "&$iRow &", $iCol = "& $iCol &@CRLF) Local $sCombo_Fill ; Select correct combo fill depending on row/col Switch $iRow Case 0 Switch $iCol Case 0 $sCombo_Fill = "RJ-45 color order USA|RJ-45 color order EUROPE" Case 1 $sCombo_Fill = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" EndSwitch Case 1 Switch $iCol Case 0 $sCombo_Fill = "Standard TV USA|Standard TV EUROPE" Case 1 $sCombo_Fill = "NTSC|Pal/Secam/NTSC" EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetPos. 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) ; WinMove( $hCombo_Dialog, "", 150, 100, $aLVPos[2], $aLVPos[3]) X, Y, W, H ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[0]) ; $cCombo = GUICtrlCreateCombo("", 0, 0, 200, 20) ; 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 worked a little on the code you gave me and it's pretty good. I find myself facing the width problem with column 0 and not understood how to solve the problem and make it clean. Do you have a solution for optimal operation? Thanks to you. #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 $sRet, $aRetMem $hGUI = GUICreate("ListView Example_6 Light", 660, 330) ; Create ListView GUICtrlCreateLabel("ComboBox - $vRow, $vCol for edit ComboBox (RJ-45) etc...", 10, 10, 400, 20) $cLV_1 = GUICtrlCreateListView("Country|Reference|Not use|Not use", 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 ; Créer des Colonnes et des Lignes Global $vCols = 6, $vRows = 4 ; Create array and fill listview Global $aLVArray_1[$vCols][$vRows] $sData = "RJ-45 color order USA|Blue,Green,Orange,Brown" $aLVArray_1[0][0] = $sData GUICtrlCreateListViewItem($sData, $cLV_1) $sData = "Standard TV USA|NTSC" $aLVArray_1[1][0] = $sData GUICtrlCreateListViewItem($sData, $cLV_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) $cContent = GUICtrlCreateButton("Content", 100, 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 $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_Edit( $hLV, $iIndexLV, $iRow, $iCol) ;~ ConsoleWrite("Line=" & @ScriptLineNumber & @TAB & "$iRow = "&$iRow &", $iCol = "& $iCol &@CRLF) Local $sCombo_Fill ; Select correct combo fill depending on row/col Switch $iRow Case 0 Switch $iCol Case 0 $sCombo_Fill = "RJ-45 color order USA|RJ-45 color order EUROPE" Case 1 $sCombo_Fill = "Blue,Green,Orange,Brown|Blue,Orange,Green,Brown" EndSwitch Case 1 Switch $iCol Case 0 $sCombo_Fill = "Standard TV USA|Standard TV EUROPE" Case 1 $sCombo_Fill = "NTSC|Pal/Secam/NTSC" EndSwitch EndSwitch ; Retrieve the position x, y and size (width and height) of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetPos. 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] +2 $W = $aRect[2]-$aRect[0] $H = $aRect[3]-$aRect[1] 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) ; WinMove( $hCombo_Dialog, "", 150, 100, $aLVPos[2], $aLVPos[3]) X, Y, W, H ; Move GUI 2 Combo OK Local $aLVPos = WinGetClientSize( $hCombo_Dialog) $cCombo = GUICtrlCreateCombo( "", 0, 0, $aLVPos[0], $aLVPos[0]) ; $cCombo = GUICtrlCreateCombo("", 0, 0, 200, 20) ; Fill combo with required elements GUICtrlSetData( $cCombo, $sCombo_Fill, _GUICtrlListView_GetItemText( $hLV, $iRow, $iCol)) 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
-
That's pretty much it, I can't wait to test your code. I'm also looking for how to remove the blue highlight from a line. For the rest I can manage. I'm also into DIY, I have a radiator that no longer heats up.
-
Yes indeed I did not see the error and I did not find how to edit here is a very simple test code or when I choose "Standard TV EUROPE" I can have the choice between "NTSC or Pal/Secam/ NTSC" in the right place.
-
Hello everyone, I'm new to /forum.com and old to /forum.fr I would like to thank Melba23 for his work on the UDF of "GUIListViewEx.au3", very nice work. And as my presence is new I would like to ask for a small option that could make this beautiful project grow. Well let's get started, we have a lot of Functions that only deal with Columns, for example: Func _GUIListViewEx_SetEditStatus($iLV_Index, $vCol, $iMode = 1, $vParam1 = Default, $vParam2 = Default) But not the Rows, which made me come to this topic and not another because I want to be able to modify the content per ComboBox row with different content on the fly and according to a value to be updated. Thanks for reading me. ;~ Func _GUIListViewEx_SetEditStatus($iLV_Index, $vRow, $vCol, $iMode = 1, $vParam1 = Default, $vParam2 = Default) For $i = 0 To $aLV_List_Left[0][0] ; ... If $_Unit_of_measurement[$i] = $_Unit Then _GUIListViewEx_SetEditStatus( $iLV_Left_Index, $vRow[$j], 5, , 2, "Blue > Red|Blue < Greeen", 1) If $_Unit_of_measurement[$i] = $_Unit Then _GUIListViewEx_SetEditStatus( $iLV_Left_Index, $vRow[$j], 5, , 2, "Blue < Red|Blue > Greeen", 1) ; ... Next