MasterJ Posted April 16, 2014 Posted April 16, 2014 Hi, guys Haven't been here for quite a while now. Started on something simple again to remember everything I knew about AutoIt v3 and immediately got stuck. Please look at my function here and tell me why Listview hangs my gui.. Func _maingui_addList(ByRef $this, $header, $items, $left, $top, $width = Default, $height = Default) #forceref $this Local $headerList[0] Local $headerSizes[0] For $i = 0 To UBound($header) - 1 _ArrayAdd($headerList, $header[$i][0]) _ArrayAdd($headerSizes, $header[$i][1]) Next Local $handle = GUICtrlCreateListView(_ArrayToString($headerList), $this.relLeft + $left, $this.relTop + $top, $width, $height, $LVS_NOSORTHEADER + $LVS_SINGLESEL + $LVS_REPORT, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES + $LVS_EX_TRACKSELECT + $LVS_EX_DOUBLEBUFFER) ControlDisable($this.handle, "", HWnd(_GUICtrlListView_GetHeader($handle))) For $i = 0 To UBound($header) - 1 _GUICtrlListView_SetColumnWidth($handle, $i, $headerSizes[$i]) Next _GUICtrlListView_AddArray($handle, $items) Return $handle EndFunc $header = [["Item name", 300], ["Version", 60], ["Author", 250], ["Description", 650]] $items = [["Intro", 1.0, "masterj", "Default TOC for ME7 Tuner Wizard"]] Basically whenever I try to create even simplest Listview my gui becomes unresponsive and cpu usage starts to be ~25% If I use $WS_EX_COMPOSITED I get listview header shown but ecu usage still gets to ~5%. Need ideas
Moderators Melba23 Posted April 16, 2014 Moderators Posted April 16, 2014 MasterJ,Posting the whole script - or at least a small working reproducer with "even simplest Listview" - would be a good idea. Just showing a function and not the GUI and message loop does not offer a lot to go on. 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
MasterJ Posted April 17, 2014 Author Posted April 17, 2014 Oh, of course https://bitbucket.org/masterjguscius/masterjs-me7-tuner-wizard <- here's my whole project. Please look at the /Imports/MainGui/MainGui.au3 Listview is created via MainGui's method which is called from /Tabs/Bodies/Intro.au3 Basically /Tabs/Bodies/Intro.au3 sends parameters to /Imports/MainGui/MainGui.au3 -> _maingui_addList() Please paste the _maingui_addList() from here instead of original in bitbucket: Func _maingui_addList(ByRef $this, $header, $items, $left, $top, $width = Default, $height = Default) #forceref $this Local $headerList[0] Local $headerSizes[0] For $i = 0 To UBound($header) - 1 _ArrayAdd($headerList, $header[$i][0]) _ArrayAdd($headerSizes, $header[$i][1]) Next Local $handle = GUICtrlCreateListView(_ArrayToString($headerList), $this.relLeft + $left, $this.relTop + $top, $width, $height, $LVS_NOSORTHEADER + $LVS_SINGLESEL + $LVS_REPORT, $LVS_EX_FULLROWSELECT + $LVS_EX_GRIDLINES + $LVS_EX_TRACKSELECT + $LVS_EX_DOUBLEBUFFER) ControlDisable($this.handle, "", HWnd(_GUICtrlListView_GetHeader($handle))) For $i = 0 To UBound($header) - 1 _GUICtrlListView_SetColumnWidth($handle, $i, $headerSizes[$i]) Next _GUICtrlListView_AddArray($handle, $items) Return $handle EndFunc And Just force parameters inside function: $header = [["Item name", 300], ["Version", 60], ["Author", 250], ["Description", 650]] $items = [["Intro", 1.0, "masterj", "Default TOC for ME7 Tuner Wizard"]] $left = $this.relLeft + 10 $top = $this.relTop + 100 $width = 500 $height = 500
MasterJ Posted April 17, 2014 Author Posted April 17, 2014 (edited) Ok, so I have reproduced error perfectly now and attached whole project. Please run Client.au3 and see how ListView only shows header and no Items. Additionally this listview uses ~5% of my i5. Now If we go to Imports/MainGui/MainGui.au3 and at line 41 remove $WS_EX_COMPOSITED extended style then whole gui freezes and starts to use ~25% of my cpu. Please help me to fix this, because it is kind of blocker now to my project. Thanks ME7Wizard.rar Edited April 17, 2014 by MasterJ
Moderators Melba23 Posted April 17, 2014 Moderators Posted April 17, 2014 MasterJ,I see you are using AutoitObject in this script - I have no experience of using that UDF so I am afraid I cannot help 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
MasterJ Posted April 17, 2014 Author Posted April 17, 2014 AutoItObject emulates OOP Basically you create objects and work with them instead of procedural style of coding. But anyway, only problem here is listview, which is in Imports/MainGui/MainGui.au3 @ 41 line (function _maingui_addList) If I use list instead of listview everything works as expected... So only thing here is to somehow find out why that particular control hangs gui...
Moderators Melba23 Posted April 17, 2014 Moderators Posted April 17, 2014 MasterJ,AutoItObject emulates OOPI am quite well aware of what the UDF does, thanks. 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
MasterJ Posted April 17, 2014 Author Posted April 17, 2014 Ok, so _GUICtrlListView_Create actually creates listview perfectly. So maybe there's bug in original control creation?
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