-
Posts
7,006 -
Joined
-
Days Won
154
Nine last won the day on April 28
Nine had the most liked content!
About Nine

Profile Information
-
Member Title
Demain comme jamais
-
Location
Montréal, Québec, Canada
Recent Profile Visitors
Nine's Achievements
-
Listview replacing, coloring, doubleclick
Nine replied to albertmaathuis's topic in AutoIt General Help and Support
@albertmaathuis Good job on your script. But you should learn how to debug your own code. By putting ConsoleWrite to check the evolution path of the script you would have learned where the issue is. BTW it is quite an obvious problem. On the side note, you should always try to eliminate global variables when possible and you should never hardcode constants when you can use a function that will provide it to you (e.g. UBound). It is just good programming practices. Back to your issue, I will not give you the answer. I will let you debug it by yourself. But I will give you a hint, since the AutoIt error tells you that the color arrays are incorrectly created, you should search in that direction. Put some ConsoleWrite as I already told you and you should discover the nasty culprit rapidly... -
Listview replacing, coloring, doubleclick
Nine replied to albertmaathuis's topic in AutoIt General Help and Support
Here one simple way. You can make it more and more complex as you wish to. Not all exceptions are verified BTW. ps. requires latest version (because of the map) #include <GUIConstants.au3> #include <GuiListView.au3> #include <WinAPISysWin.au3> Opt("MustDeclareVars", True) Global $mColor[], $bDragging, $tDragItem = DllStructCreate($tagNMHDR) Example() Func Example() Local $hGUI = GUICreate("Colored ListView", 700, 250) Local $idListView1 = GUICtrlCreateListView("Number|Number|Number", 5, 5, 300, 150) Local $idListView2 = GUICtrlCreateListView("Number|Number|Number", 350, 5, 300, 150) Local $idButton = GUICtrlCreateButton("Change", 5, 180, 100, 20) GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) GUIRegisterMsg($WM_LBUTTONUP, WM_LBUTTONUP) GUISetState() For $i = 1 To 10 GUICtrlCreateListViewItem($i & '|' & $i & '|' & $i, $idListView1) GUICtrlCreateListViewItem($i & '|' & "OK" & '|' & $i, $idListView2) Next ;init background colors for ListView 1 (could be many of these) Local $aColor[ControlListView($hGUI, "", $idListView1, "GetItemCount")][ControlListView($hGUI, "", $idListView1, "GetSubItemCount")] $aColor[0][1] = 0xFFAAFF $aColor[1][2] = 0x00AA00 $aColor[2][0] = 0xCCCCCC $mColor[$idListView1] = $aColor Local $aColor[ControlListView($hGUI, "", $idListView2, "GetItemCount")][ControlListView($hGUI, "", $idListView2, "GetSubItemCount")] $aColor[2][1] = 0xFFAAFF $aColor[3][2] = 0x00AA00 $aColor[4][0] = 0xCCCCCC $mColor[$idListView2] = $aColor While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idButton $aColor = $mColor[$idListView1] $aColor[5][1] = 0xFF $mColor[$idListView1] = $aColor _WinAPI_RedrawWindow(GUICtrlGetHandle($idListView1)) $aColor = $mColor[$idListView2] $aColor[6][1] = 0xFF $mColor[$idListView2] = $aColor _WinAPI_RedrawWindow(GUICtrlGetHandle($idListView2)) EndSwitch WEnd EndFunc ;==>Example Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) If _WinAPI_GetClassName($tNMHDR.hWndFrom) <> "SysListView32" Then Return $GUI_RUNDEFMSG Switch $tNMHDR.Code 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 ; Paint item and subitem Local $iSubItem = $tCustDraw.iSubItem Local $iItem = $tCustDraw.dwItemSpec If ControlListView($hWnd, "", $tNMHDR.hWndFrom, "IsSelected", $iItem) Then Return $CDRF_DODEFAULT $tCustDraw.clrTextBk = ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] ? ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] : 0xFFFFFF Return $CDRF_NEWFONT Case $NM_DBLCLK Local $tItem = DllStructCreate($tagNMITEMACTIVATE, $lParam) ConsoleWrite("Double click for ListView : " & $tItem.IDFrom & " on item : " & $tItem.Index & " on subitem : " & $tItem.SubItem & @CRLF) Case $LVN_BEGINDRAG Local $tDrag = DllStructCreate($tagNMLISTVIEW, $lParam) $tDragItem.hWndFrom = $tDrag.hWndFrom $tDragItem.IDFrom = $tDrag.IDFrom $tDragItem.Code = $tDrag.Item $bDragging = True EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func WM_LBUTTONUP($hWnd, $iMsg, $wParam, $lParam) If Not $bDragging Then Return $GUI_RUNDEFMSG $bDragging = False Local $tPoint = _WinAPI_GetMousePos() Local $hPoint = _WinAPI_WindowFromPoint($tPoint) If Not $hPoint Then Return $GUI_RUNDEFMSG If _WinAPI_GetClassName($hPoint) <> "SysListView32" Then Return $GUI_RUNDEFMSG If $hPoint = $tDragItem.hWndFrom Then Return $GUI_RUNDEFMSG Local $aColorSrc = $mColor[$tDragItem.IDFrom] Local $idDest = _WinAPI_GetDlgCtrlID($hPoint) Local $aColorDest = $mColor[$idDest] If UBound($aColorSrc, 2) <> UBound($aColorDest, 2) Then Return $GUI_RUNDEFMSG _GUICtrlListView_CopyItems($tDragItem.hWndFrom, $hPoint, True) Local $nDest = UBound($aColorDest) + 1 ReDim $aColorDest[$nDest][UBound($aColorDest, 2)] For $i = 0 To UBound($aColorSrc, 2) - 1 $aColorDest[$nDest - 1][$i] = $aColorSrc[$tDragItem.Code][$i] Next _ArrayDelete($aColorSrc, $tDragItem.Code) $mColor[$tDragItem.IDFrom] = $aColorSrc $mColor[$idDest] = $aColorDest Return $GUI_RUNDEFMSG EndFunc ;==>WM_LBUTTONUP -
Listview replacing, coloring, doubleclick
Nine replied to albertmaathuis's topic in AutoIt General Help and Support
Please provide the code you are working with. So I do not have to create it from scratch. When you post code, please use the method shown in the link. Thanks. -
Listview replacing, coloring, doubleclick
Nine replied to albertmaathuis's topic in AutoIt General Help and Support
Here a working example of one listview with color and double click. You can add as many listviews as you want. I included a map to register all the colors of the different listviews. #include <GUIConstants.au3> #include <GuiListView.au3> Opt("MustDeclareVars", True) Global $idListView, $mColor[] Example() Func Example() Local $hGUI = GUICreate("Colored ListView", 350, 250) $idListView = GUICtrlCreateListView("Number|Number|Number", 5, 5, 300, 150) Local $hListView = GUICtrlGetHandle($idListView) Local $idButton = GUICtrlCreateButton("Change", 5, 180, 100, 20) GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY) GUISetState() For $i = 1 To 50 GUICtrlCreateListViewItem($i & '|' & $i & '|' & $i, $idListView) Next ;init background colors for ListView 1 (could be many of these) Local $aColor[ControlListView($hGUI, "", $idListView, "GetItemCount")][ControlListView($hGUI, "", $idListView, "GetSubItemCount")] $aColor[0][1] = 0xFFAAFF $aColor[1][2] = 0x00AA00 $aColor[2][0] = 0xCCCCCC $mColor[$idListView] = $aColor While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $idButton $aColor = $mColor[$idListView] $aColor[5][1] = 0xFF $mColor[$idListView] = $aColor _WinAPI_RedrawWindow($hListView) EndSwitch WEnd EndFunc ;==>Example Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) Switch $tNMHDR.IDFrom Case $idListView Switch $tNMHDR.Code 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 ; Paint item and subitem Local $iSubItem = $tCustDraw.iSubItem Local $iItem = $tCustDraw.dwItemSpec If ControlListView($hWnd, "", $tNMHDR.hWndFrom, "IsSelected", $iItem) Then Return $CDRF_DODEFAULT $tCustDraw.clrTextBk = ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] ? ($mColor[$tCustDraw.IDFrom])[$iItem][$iSubItem] : 0xFFFFFF Return $CDRF_NEWFONT Case $NM_DBLCLK Local $tItem = DllStructCreate($tagNMITEMACTIVATE, $lParam) ConsoleWrite("Double click for ListView : " & $tItem.IDFrom & " on item : " & $tItem.Index & " on subitem : " & $tItem.SubItem & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY -
Nine reacted to a post in a topic: WebDriver UDF - React-select dropdown list
-
Nine reacted to a post in a topic: WebDriver UDF - React-select dropdown list
-
SOLVE-SMART reacted to a post in a topic: WebDriver UDF - React-select dropdown list
-
Nine reacted to a post in a topic: WebDriver UDF - React-select dropdown list
-
WebDriver UDF - React-select dropdown list
Nine replied to rundak's topic in AutoIt General Help and Support
Interesting. Not familiar with this, mind sharing how to perform it ? nvm, found it, thanks for giving us a good way to find hidden nodes. -
WebDriver UDF - React-select dropdown list
Nine replied to rundak's topic in AutoIt General Help and Support
@Danp2 React-select is quite a different beast. It won't work with standard option select functions. Maybe you could enlighten us how it could be done more elegantly... -
WebDriver UDF - React-select dropdown list
Nine replied to rundak's topic in AutoIt General Help and Support
When you post code, please use the method shown in the link. Here one way : $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='react-select-3-input']") _WD_ElementAction($sSession, $sElement, 'value', "Silver") Local $sAction = '{"actions":[{"type":"key","id":"keyboard_1","actions":[{"type":"keyDown","value":"\uE007"},{"type":"keyUp","value":"\uE007"}]}]}' _WD_Action($sSession, "actions", $sAction) -
jaberwacky reacted to a post in a topic: Help File/Documentation Issues. (Discussion Only)
-
Help File/Documentation Issues. (Discussion Only)
Nine replied to guinness's topic in AutoIt Technical Discussion
@jaberwacky You are right. Doc is mistaken. Also there is a bug in the example of _GUICtrlEdit_SetTabStops. The icon on the status bar is not showing. After debugging, the call to DestroyIcon is the culprit, need to make a tracker... -
pat4005 reacted to a post in a topic: GIF Animation (cached)
-
Help with _Excel_BookAttach and _Excel_BookClose
Nine replied to VRajannagari's topic in AutoIt General Help and Support
Show a runnable snippet of your code, not just a few lines. Then we will be able to trace the problem. When you post code, please use the method shown in the link. -
Danyfirex reacted to a post in a topic: "OrdoWebView2.ocx" WebView2 made simple
-
Maybe remove .\ As far as I tested it, I can use the ocx everywhere like this : #include <WindowsConstants.au3> #include "..\OrdoWebView\OrdoWebView2.au3" Works everywhere, even on full path...
-
SOLVE-SMART reacted to a post in a topic: "OrdoWebView2.ocx" WebView2 made simple
-
Nope, followed the instructions from @Gianni to the letter...
-
SOLVE-SMART reacted to a post in a topic: "OrdoWebView2.ocx" WebView2 made simple
-
Idk if this will make any difference, but when I registered the ocx I was inside the folder where it was located (instead of entering the full path). ps. i did not install the SDK. Just the .7z of Dany pps. you need to run it x86, it does not work x64