Jump to content

_GUICtrlListView_* Flicker


zackrspv
 Share

Recommended Posts

Is there a way to remove the flicker that occurs when items are added/removed from the list view, when a background iamge is included in the create? DoubleBuffer already is included, but still flickers.

Example is from Help file, only change is the For/Next loop to add items.

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

Example_UDF_Created() ;use UDF built listview

Func Example_UDF_Created()
    Local $GUI, $hImage, $hListView, $aImage
    Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER)

    $GUI = GUICreate("(UDF Created) ListView Set Background Image", 600, 550)

    ;=========================================================================================================
    $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 596, 500, -1, -1, True) ; Last option Calls CoInitializeEx
    ;=========================================================================================================
    _GUICtrlListView_SetExtendedListViewStyle($hListView, $exStyles)
    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

    ; Add columns
    _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
    _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
    _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

    ; Build groups
    _GUICtrlListView_EnableGroupView($hListView)
    _GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1")
    _GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
    _GUICtrlListView_SetItemGroupID($hListView, 0, 1)
    _GUICtrlListView_SetItemGroupID($hListView, 1, 2)
    _GUICtrlListView_SetItemGroupID($hListView, 2, 2)

;~  _GUICtrlListView_SetBkColor ($hListView, $CLR_NONE)
;~  _GUICtrlListView_SetTextColor ($hListView, $CLR_NONE)
;~  _GUICtrlListView_SetTextBkColor ($hListView, $CLR_NONE)

    ; Get the Image
    Local $sURL = "http://www.autoitscript.com/autoit3/files/graphics/autoit9_wall_grey_800x600.jpg"
    Local $sFilePath = @ScriptDir & "\AutoIt.jpg"
    InetGet($sURL, $sFilePath)

    ; Set the Background Image
    _GUICtrlListView_SetBkImage($hListView, $sFilePath)
    $aImage = _GUICtrlListView_GetBkImage($hListView)

    GUISetState()

for $i = 3 to 10
    _GUICtrlListView_AddItem($hListView, "Row "&$i-1&": Col 1", $i)
    _GUICtrlListView_SetItemGroupID($hListView, $i, int(Random(1, 2)))
    sleep(500)
Next
    ConsoleWrite("Background Image: " & $aImage[1]&@CRLF)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    ;=========================================================================================================
    DllCall('ole32.dll', 'long', 'CoUinitialize') ; Must call for each CoInitializeEx call made
    ;=========================================================================================================

    GUIDelete()
    FileDelete($sFilePath)
EndFunc   ;==>Example_UDF_Created
Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Put your GUISetState() after the For/Next loop.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Put your GUISetState() after the For/Next loop.

That will work for the initial build of the GUI, but doesn't help with later updates. Bracket the update with _GUICtrlListView_BeginUpdate() and _GUICtrlListView_EndUpdate() instead.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

That will work for the initial build of the GUI, but doesn't help with later updates. Bracket the update with _GUICtrlListView_BeginUpdate() and _GUICtrlListView_EndUpdate() instead.

:D

does not prevent the flickering when there's an image.

for $i = 3 to 10
    _GUICtrlListView_BeginUpdate($hListView)
    _GUICtrlListView_AddItem($hListView, "Row "&$i-1&": Col 1", $i)
    _GUICtrlListView_SetItemGroupID($hListView, $i, int(Random(1, 2)))
    _GUICtrlListView_EndUpdate($hListView)
    sleep(500)
Next

When put into the script from the help file, the main picture still flashes after each update. Is there no way to make the list view NOT keep retrying the image? I cannot just put the setstate() after the items are added, as this is a live list view, items will be removed/added via remote chat/updates/server queries all the time.

But, i need the image there, so that the list view looks like it has a transparent background.

Now, unless you had a method for that, i need the flicker to stop lol

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

does not prevent the flickering when there's an image.

for $i = 3 to 10
    _GUICtrlListView_BeginUpdate($hListView)
    _GUICtrlListView_AddItem($hListView, "Row "&$i-1&": Col 1", $i)
    _GUICtrlListView_SetItemGroupID($hListView, $i, int(Random(1, 2)))
    _GUICtrlListView_EndUpdate($hListView)
    sleep(500)
Next

When put into the script from the help file, the main picture still flashes after each update. Is there no way to make the list view NOT keep retrying the image? I cannot just put the setstate() after the items are added, as this is a live list view, items will be removed/added via remote chat/updates/server queries all the time.

But, i need the image there, so that the list view looks like it has a transparent background.

Now, unless you had a method for that, i need the flicker to stop lol

No, you are still repeating the Begin/End Update inside the loop. Put that outside the loop:
_GUICtrlListView_BeginUpdate($hListView)
    For $i = 3 To 10
        _GUICtrlListView_AddItem($hListView, "Row " & $i - 1 & ": Col 1", $i)
        _GUICtrlListView_SetItemGroupID($hListView, $i, Random(1, 2, 1))
        Sleep(500)
    Next
_GUICtrlListView_EndUpdate($hListView)

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

No, you are still repeating the Begin/End Update inside the loop. Put that outside the loop:

_GUICtrlListView_BeginUpdate($hListView)
    For $i = 3 To 10
        _GUICtrlListView_AddItem($hListView, "Row " & $i - 1 & ": Col 1", $i)
        _GUICtrlListView_SetItemGroupID($hListView, $i, Random(1, 2, 1))
        Sleep(500)
    Next
_GUICtrlListView_EndUpdate($hListView)

:)

The problem tho, is that when 'EndUpdate' is called, the list still refreshes. Is there no way to stop the flicker from ever happening? Can the list view itself, have a transparent background?

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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