Jump to content

Listview flicker when in tab item


Go to solution Solved by Kilmatead,

Recommended Posts

Posted (edited)

Then up to now, the simplest and fastest is.

Locking the GUI in tandem with using _GUICtrlListView_BeginUpdate and _GUICtrlListView_EndUpdate.

Func PopulateLV()
    Local $hTimer = TimerInit()
    _GUICtrlListView_BeginUpdate ($hLV)
    GUISetState(@SW_LOCK)
    For $i = 0 To 1000
        GUICtrlCreateListViewItem($sLVI, $hLV)
    Next
    GUISetState(@SW_UNLOCK)
    _GUICtrlListView_EndUpdate( $hLV)
    MsgBox(0, "Time Difference", TimerDiff($hTimer) / 1000)
EndFunc   ;==>PopulateLV

EDIT:

Adding the update function halves the timer at least.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted
Interesting as it may accelerate in the case of not using the TAB.
I have not tried yet but can not wait until I do the test on several of my programs.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Wonder if anyone knows why this does not work?

Func PopulateLV()
    Local $hTimer = TimerInit()
    _GUICtrlListView_BeginUpdate($hLV)
    ;GUISetState(@SW_LOCK)
    $hwnh = _WinAPI_GetDlgItem($Gui, $hLV) ; Get handle of ListView
    _WinAPI_LockWindowUpdate($hwnh) ; Lock ListView 
    For $i = 0 To 1000
        GUICtrlCreateListViewItem($sLVI, $hLV)
    Next
    _WinAPI_LockWindowUpdate(Null)
    ;GUISetState(@SW_UNLOCK)
    _GUICtrlListView_EndUpdate($hLV)
    MsgBox(0, "Time Difference", TimerDiff($hTimer))
EndFunc   ;==>PopulateLV

Just passing the handle of listview instead of parent gui.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted
  On 2/23/2015 at 11:26 AM, JohnOne said:

I'm wondering now if _WinAPI_LockWindowUpdate and GUISetState(@SW_LOCK) are actually the same thing.

 

I started using the API version in general because it works reliably for all windows (especially useful for hiding the ugly "send" machinations applied to 3rd-party programmes), and (with the additions of regional invalidation) allows a more granular control over what's happening.  Also, whenever I use the API I'm learning something - using native commands is more for "general" use.  90% of the UDF's such as  _GUICtrlListView_BeginUpdate are really just wrappers for direct API calls anyway, so it's useful to dig through them and learn "how" they do what they do - which things like GUISetState hide for the sake of simplicity.

Posted

Found another way to make it even quicker 90% of the time, maybe it's skipping an API call.

Func PopulateLV()
    Local $hTimer = TimerInit()
    _GUICtrlListView_BeginUpdate($hLV)
    _SendMessage($Gui, $WM_SETREDRAW, False)
    For $i = 0 To 1000
        GUICtrlCreateListViewItem($sLVI, $hLV)
    Next
    _SendMessage($Gui, $WM_SETREDRAW, True)
    _GUICtrlListView_EndUpdate($hLV)
    MsgBox(0, "Time Difference", TimerDiff($hTimer))
EndFunc   ;==>PopulateLV

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted
  Quote

I'm not sure that is entirely true, as far as windows OS is concerned, all "controls" are just child windows.

 

You're right, have'nt used the function enough (or at all) to test...

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Posted

indeed faster

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

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...