Jump to content

Recommended Posts

Posted

Hi, guys  :sorcerer:

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
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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

Posted (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 by MasterJ
  • Moderators
Posted

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

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
Posted

MasterJ,

AutoItObject emulates OOP

I am quite well aware of what the UDF does, thanks. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...