Resiak1811 Posted September 18 Posted September 18 (edited) Hello, my problem is that the GUICtrlCreateList (when $GUI_SHOW) is located behind my GUICtrlCreateListView … A few weeks ago (and for many years), everything was working fine, but I updated my script several times in recent weeks and discovered this problem yesterday. I also update the autoit to v3.3.18.0 .. maybe that's the problem ? *I deleted the old backups, so I can't compare them!* Any Idea ? ... just type something in the "1 col - inputtext box" expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsStylesConstants.au3> #include <DateTimeConstants.au3> #include <GuiListView.au3> #include <EditConstants.au3> #include <ComboConstants.au3> #include <GUICtrlComboSetColors.au3> #include <GuiListBox.au3> Main() Func Main() $Child = GUICreate("test", 1025, 460, Default, Default) $Title = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 100, 610, 26) Local $cols = [150, 60, 150, 75, 150] For $i = 0 To UBound($cols) - 1 _GUICtrlListView_SetColumnWidth($Title, $i, $cols[$i]) _GUICtrlListView_JustifyColumn($Title, $i, 2) Next GUICtrlSetState($Title, $GUI_DISABLE) $col1 = GUICtrlCreateInput("", 5, 125, 153, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) $col1hList = GUICtrlCreateList("", 5, 144, 153, 175, $WS_BORDER) GUICtrlSetState($col1hList, $GUI_HIDE) $col2 = GUICtrlCreateInput("", 157, 125, 61, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) $col3 = GUICtrlCreateInput("", 217, 125, 151, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) $col4 = GUICtrlCreateInput("", 367, 125, 76, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) $col5 = GUICtrlCreateInput("", 442, 125, 173, 20, BitOR($ES_AUTOHSCROLL, $ES_CENTER)) $Title2 = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 151, 610, 175, $LVS_NOCOLUMNHEADER) Local $cols = [150, 60, 150, 75, 150] For $i = 0 To UBound($cols) - 1 _GUICtrlListView_SetColumnWidth($Title2, $i, $cols[$i]) _GUICtrlListView_JustifyColumn($Title2, $i, 2) Next ControlDisable($Title2, "", HWnd(_GUICtrlListView_GetHeader($Title2))) _GUICtrlListView_SetExtendedListViewStyle($Title2, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW, $Child) While 1 If _IsFocused($Child, $col1) Then hListbox($Child, $col1, $col1hList, $col2) $InvAjust_MSG = GUIGetMsg() Switch $InvAjust_MSG Case $GUI_EVENT_CLOSE GUISetAccelerators("", $Child) ExitLoop Case $col1hList GUICtrlSetData($col1, GUICtrlRead($col1hList)) GUICtrlSetState($col1hList, $GUI_HIDE) ControlFocus($Child, "", $col2) EndSwitch WEnd GUIDelete($Child) EndFunc ;==>Main Func hListbox($hParent, $hEdit, $hList, $hSaveNextCtrl) GUISetAccelerators("", $hParent) Local $sCurr_Input = "", $iCurrIndex = -1, $hListGUI = -1, _ $hUP = GUICtrlCreateDummy(), $hDOWN = GUICtrlCreateDummy(), $hENTER = GUICtrlCreateDummy(), $hTAB = GUICtrlCreateDummy(), _ $AccelKeys[4][2] = [["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER], ["{TAB}", $hTAB]] GUISetAccelerators($AccelKeys, $hParent) While _IsFocused($hParent, $hEdit) If Not WinActive($hParent) Then ToolTip("") $hListbox_MSG = GUIGetMsg() Switch $hListbox_MSG Case $GUI_EVENT_CLOSE GUISetAccelerators("", $hParent) ExitLoop 2 Case $hUP If $hListGUI <> -1 Then $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = _GUICtrlListBox_GetCount($hList) - 1 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hDOWN If $hListGUI <> -1 Then $iCurrIndex += 1 If $iCurrIndex > _GUICtrlListBox_GetCount($hList) - 1 Then $iCurrIndex = 0 _GUICtrlListBox_SetCurSel($hList, $iCurrIndex) EndIf Case $hENTER, $hTAB If $hListGUI <> -1 And $iCurrIndex <> -1 Then GUICtrlSetData($hEdit, GUICtrlRead($hList)) ElseIf $hListGUI <> -1 And _GUICtrlListBox_GetCount($hList) = 1 Then _GUICtrlListBox_SetCurSel($hList, 0) GUICtrlSetData($hEdit, GUICtrlRead($hList)) EndIf ControlFocus($hParent, "", $hSaveNextCtrl) ExitLoop Case Else If GUICtrlRead($hEdit) <> $sCurr_Input Then CheckInputText($hEdit, $hList) $sCurr_Input = GUICtrlRead($hEdit) $hListGUI = $hList EndIf EndSwitch Sleep(10) WEnd $sCurr_Input = "" $iCurrIndex = -1 $hListGUI = -1 GUISetAccelerators("", $hParent) GUICtrlSetState($hList, $GUI_HIDE) EndFunc ;==>hListbox Func CheckInputText($colvar, $collistvar) Local $sInput = GUICtrlRead($colvar) If $sInput <> "" Then Local $aResult[5] $aResult[0] = "Apple" $aResult[1] = "Banana" $aResult[2] = "Cherry" $aResult[3] = "Date" $aResult[4] = "Elderberry" $hListGUI = 1 Local $sPartialData = "|" For $i = 0 To 4 $sPartialData &= $aResult[$i] & "|" If $i = 15 Then $sPartialData &= "- Too much result -" Next GUICtrlSetState($collistvar, $GUI_SHOW) GUICtrlSetData($collistvar, $sPartialData) Else $sPartialData = "" $iCurrIndex = -1 $hListGUI = -1 GUICtrlSetState($collistvar, $GUI_HIDE) EndIf EndFunc ;==>CheckInputText Func _IsFocused($GUI, $iControlID) Return ControlGetHandle($GUI, '', $iControlID) = ControlGetHandle($GUI, '', ControlGetFocus($GUI)) EndFunc ;==>_IsFocused Thank you in advance for your help Edited September 18 by Resiak1811
Nine Posted September 18 Posted September 18 Your issue is not related with newest version of AutoIt. I have seen that behavior in the past where list views are naturally displayed over other controls. If you want your list box to be displayed over the list view (without having focus), you would need to create a child window for that specific listbox (hide and show the window instead of the listbox). Also, creating a secondary GUI loop in hListbox function is also generating some disturbances. In my case, your script is crashing under certain conditions. argumentum 1 “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Resiak1811 Posted September 18 Author Posted September 18 4 hours ago, Nine said: In my case, your script is crashing under certain conditions. in which case ?
Resiak1811 Posted September 18 Author Posted September 18 I had made a backup of my version of AutoIt before the update. So I put the backup folder back and everything is fixed. With v3.3.15.0 (Beta) = everything works with v3.3.18.0 = I have this bug described earlier
Nine Posted September 18 Posted September 18 There is a exitloop 2 in secondary GUI loop that makes your script crash on my side... “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Nine Posted September 18 Posted September 18 3 minutes ago, Resiak1811 said: With v3.3.15.0 (Beta) = everything works It's too far back. I can't remember when it has started. Anyway I provided you a solution with recent versions but you can decide to stay in this old version. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Resiak1811 Posted September 18 Author Posted September 18 oh the exitloop 2 it's because its a part of another func (but trunk) for this example.. sorry about that what is strange is with the old version, if i test my own example, i have this error : #include <WindowsStylesConstants.au3> (error: can't open include file) It seems that between version 3.3.15.0 and version 3.3.18.0 this file was created, maybe the bug come from that file whatever thanks for your other solution. Nine 1
Solution pixelsearch Posted Sunday at 05:18 PM Solution Posted Sunday at 05:18 PM @Resiak1811 Hi For the record, as soon as "beta - autoit-v3.3.15.1 (Map management)" was released on May 2020, then the listbox wouldn't appear over your listview #2 (tested) . Probably Jon changed some internal behavior starting 3.3.15.1 If you want your 1st script to run on AutoIt 3.3.16.1 (and probably on 3.3.18.0) then this simple change should do it : ; $Title2 = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 151, 610, 175, $LVS_NOCOLUMNHEADER) $Title2 = GUICtrlCreateListView("1 col|2 col|3 col|4 col|5 col", 5, 151, 610, 175, BitOr($LVS_NOCOLUMNHEADER, $WS_CLIPSIBLINGS)) Tested on AutoIt 3.3.16.1 : it works fine when $WS_CLIPSIBLINGS is present, it doesn't work without it (on 3.3.16.1) To be compatible with any AutoIt version, here are the 5 include files I used : #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListBox.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Its not the 1st time this $WS_CLIPSIBLINGS style solves issues when controls overlap, let's hope it will solve your issue too, fingers crossed ! Resiak1811 and argumentum 1 1 "I think you are searching a bug where there is no bug... don't listen to bad advice."
Resiak1811 Posted Tuesday at 08:48 AM Author Posted Tuesday at 08:48 AM thanks pixel, i will test that this afternoon (with version 3.3.18.0)
Resiak1811 Posted Tuesday at 08:55 PM Author Posted Tuesday at 08:55 PM thanks again pixel ! everything works as expected now with the version 18 pixelsearch 1
pixelsearch Posted Tuesday at 11:26 PM Posted Tuesday at 11:26 PM Glad it worked I got a few others scripts with controls that overlap (label & label, pic & label, button & label) and each time $WS_CLIPSIBLINGS applied to the correct control (usually the biggest one) solved the issue. Please note how the order of creation of the 2 overlapping controls can be important in some cases. For example your actual script works because the 2 controls are created in this order : $col1hList = GUICtrlCreateList(...) ... $Title2 = GUICtrlCreateListView(..., $WS_CLIPSIBLINGS) But if you reverse the order of creation of these 2 overlapping controls, then it won't work anymore : $Title2 = GUICtrlCreateListView(..., $WS_CLIPSIBLINGS) ... $col1hList = GUICtrlCreateList(...) So in case you'll have to reuse $WS_CLIPSIBLINGS in another script because of 2 overlapping control, then always have in mind that the order of creation of the 2 controls can be important in some cases. Personal tests helped me to find out what seems to work : 1) Create the smallest control 1st (the listbox in your case) 2) Create the biggest control (which overlaps) after, and apply the $WS_CLIPSIBLINGS to it (the listview in your case) argumentum 1 "I think you are searching a bug where there is no bug... don't listen to bad advice."
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