Jump to content

[SOLVED] ListView flicker with Modern GUI UDF


mpower
 Share

Recommended Posts

Hi guys,

So I am facing an issue with my Listview control flickering like crazy when using the Modern GUI UDF.

I understand that the reson is because Listviews do not play nice with the $WS_EX_COMPOSITED extended style which is necessary to prevent the rest of the GUI components flickering on resizing.

I am looking for suggestions on how I can overcome the flickering issue without having to remove the Listview header (as I need the header to allow column resizing and sorting).

The reproducer is here and the lightly modified Modern GUI UDF is attached as a zip (I added $WS_CLIPCHILDREN and $WS_EX_COMPOSITED to the _Metro_CreateGUI() function in order to stop flickering of other controls like buttons/labels/toggles etc).

;!Highly recommended for improved overall performance and responsiveness of the GUI effects etc.! (after compiling):
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/so /rm /pe

;Required if you want High DPI scaling enabled. (Also requries _Metro_EnableHighDPIScaling())
#AutoIt3Wrapper_Res_HiDpi=y
#include-once
#NoTrayIcon
#include "MetroGUI-UDF\MetroGUI_UDF.au3"
#include <GuiListView.au3>


$gui = _Metro_CreateGUI("example", 800, 600, -1, -1, True)
;Add/create control buttons to the GUI
$Control_Buttons = _Metro_AddControlButtons(True, True, True, True, False) ;CloseBtn = True, MaximizeBtn = True, MinimizeBtn = True, FullscreenBtn = True, MenuBtn = True

;Set variables for the handles of the GUI-Control buttons. (Above function always returns an array this size and in this order, no matter which buttons are selected.
$GUI_CLOSE_BUTTON = $Control_Buttons[0]
$GUI_MAXIMIZE_BUTTON = $Control_Buttons[1]
$GUI_RESTORE_BUTTON = $Control_Buttons[2]
$GUI_MINIMIZE_BUTTON = $Control_Buttons[3]
$GUI_FULLSCREEN_BUTTON = $Control_Buttons[4]
$GUI_FSRestore_BUTTON = $Control_Buttons[5]
;======================================================================================================================================================================

$Button1 = _Metro_CreateButtonEx("Add new item(s)", 20, 20, 130, 50)
$Button2 = _Metro_CreateButtonEx("Edit item(s)", 170, 20, 130, 50)


$ListView2 = GUICtrlCreateListView("", 0, 86, 800, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
_GUICtrlListView_SetExtendedListViewStyle($ListView2, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_GRIDLINES, $LVS_EX_SUBITEMIMAGES, $LVS_EX_FLATSB))

For $i = 0 to 8
    _GUICtrlListView_AddColumn($ListView2, "col " &$i)
Next
_GUICtrlListView_SetBkColor($ListView2, 0xF3F3F3)
_GUICtrlListView_SetTextBkColor($ListView2, 0xF3F3F3)

;Set resizing options for the controls so they don't change in size or position. This can be customized to match your gui perfectly for resizing. See AutoIt Help file.
GUICtrlSetResizing($Button1, 768 + 2 + 32)
GUICtrlSetResizing($Button2, 768 + 2 + 32)
GUICtrlSetResizing($ListView2, 102)


GUISetState(@SW_SHOW)

While 1
    _Metro_HoverCheck_Loop($gui) ;This hover check has to be added to the main While loop, otherwise the hover effects won't work.
    $nMsg = GUIGetMsg()
    Switch $nMsg
        ;=========================================Control-Buttons===========================================
        Case $GUI_EVENT_CLOSE, $GUI_CLOSE_BUTTON
            _Metro_GUIDelete($gui) ;Delete GUI/release resources, make sure you use this when working with multiple GUIs!
            Exit
        Case $GUI_MAXIMIZE_BUTTON
            GUISetState(@SW_MAXIMIZE)
        Case $GUI_RESTORE_BUTTON
            GUISetState(@SW_RESTORE)
        Case $GUI_MINIMIZE_BUTTON
            GUISetState(@SW_MINIMIZE)
        Case $GUI_FULLSCREEN_BUTTON, $GUI_FSRestore_BUTTON
            _Metro_FullscreenToggle($gui, $Control_Buttons)
    EndSwitch
WEnd

Any suggestions would be greately appreciated.

Cheers!

MetroGUI-UDF.zip

Edited by mpower
solution posted by me
Link to comment
Share on other sites

  • 2 weeks later...

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

×
×
  • Create New...