qsek Posted March 11, 2009 Posted March 11, 2009 (edited) Ok, im done with my wisdom and need some serious help.I cant get the Listview to not change when using _GUICtrlListview_DeleteAllItems.It seems that the LVM_DELETEALLITEMS Message will fire WM_PAINT, WM_NCPAINT and WM_ERASEBKGND regardless of what i have tried below.If you look at the code you will see what conditions i have. I cant put the timeintensive anywhere else, they have to be done after deleting the old list.I read this guide http://www.catch22.net/tuts/flicker and tried $LVS_EX_DOUBLEBUFFER, setting $WM_ERASEBKGND 's return to 1.Also i searched for several functions to avoid flickering. You see them commented out and can try them to see the different results.Please notice that using @SW_LOCK is not an option to me casue then after each update my whole GUI will flicker.This is just an example GUI, the real one has much more Controls which will definitely flicker if @SW_LOCK is used)Press the "End" key to refresh the Listexpandcollapse popup#include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #Include <SendMessage.au3> Opt("GUIOnEventMode",1) HotKeySet("{End}", "Refresh") $Gui = GUICreate("TestGUI", 416, 416, 191, 113,BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION)) $Guiplist1 = GUICtrlCreateListView("Name", 8, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) $Guiplist2 = GUICtrlCreateListView("Name", 208, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) For $i = 1 To 10 _GUICtrlListView_InsertItem($Guiplist1, "Result of time intensive Functions "&$i) next GUISetOnEvent($GUI_EVENT_CLOSE, "Exitf") GUISetState() While 1 Sleep(10) WEnd Exit Func Refresh() ;~ _WinAPI_InvalidateRect(GUICtrlGetHandle($Guiplist1), 0, False) ;~ GUISetState(@SW_LOCK,$GUI) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,0,0) ;~ GUICtrlSetState($Guiplist1,$GUI_DISABLE) ;~ _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($Guiplist1)) ;~ GUIRegisterMsg($WM_ERASEBKGND,"NoEraseBkgnd") GUIRegisterMsg($WM_NCPAINT,"NoEraseBkgnd") ;~ GUIRegisterMsg($WM_NOTIFY,"NoEraseBkgnd") _GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($Guiplist1)) Sleep(500) ; this represents some time intensive functions For $i = 1 To 10 Sleep(50) ; this represents some time intensive functions _GUICtrlListView_InsertItem($Guiplist1, "Result of time intensive Functions "&$i,-1,-1,Random(0,100,1)) next GUIRegisterMsg($WM_ERASEBKGND,"") ;~ GUIRegisterMsg($WM_NCPAINT, "") ;~ GUIRegisterMsg($WM_NOTIFY, "") ;~ _GUICtrlListView_EndUpdate(GUICtrlGetHandle($Guiplist1)) ;~ GUICtrlSetState($Guiplist1,$GUI_ENABLE) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,1,0) ;~ GUISetState(@SW_UNLOCK,$GUI) EndFunc Func NoEraseBkgnd() Return 1 EndFunc Func Exitf() Exit EndFuncAny MSDN Guru has an idea?PS: I set the lparam to a random value on purpose. Im using the parameter for a custom index. Edited March 11, 2009 by qsek Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
Achilles Posted March 11, 2009 Posted March 11, 2009 I see your code has begin update and end update... why don't you use them? expandcollapse popup#include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #Include <SendMessage.au3> Opt("GUIOnEventMode",1) HotKeySet("{End}", "Refresh") $Gui = GUICreate("TestGUI", 416, 416, 191, 113,BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION)) $Guiplist1 = GUICtrlCreateListView("Name", 8, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) $Guiplist2 = GUICtrlCreateListView("Name", 208, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) For $i = 1 To 10 _GUICtrlListView_InsertItem($Guiplist1, "Result of time intensive Functions "&$i) next GUISetOnEvent($GUI_EVENT_CLOSE, "Exitf") GUISetState() While 1 Sleep(10) WEnd Exit Func Refresh() ;~ _WinAPI_InvalidateRect(GUICtrlGetHandle($Guiplist1), 0, False) ;~ GUISetState(@SW_LOCK,$GUI) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,0,0) ;~ GUICtrlSetState($Guiplist1,$GUI_DISABLE) _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($Guiplist1)) ;~ GUIRegisterMsg($WM_ERASEBKGND,"NoEraseBkgnd") ;~ GUIRegisterMsg($WM_NCPAINT,"NoEraseBkgnd") ;~ GUIRegisterMsg($WM_NOTIFY,"NoEraseBkgnd") ;~ _SendMessage(GUICtrlGetHandle($Guiplist1), $LVM_DELETEALLITEMS) _GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($Guiplist1)) Sleep(500); this represents some time intensive functions For $i = 1 To 10 Sleep(50); this represents some time intensive functions _GUICtrlListView_InsertItem($Guiplist1, "aResult of time intensive Functions "&$i,-1,-1,Random(0,100,1)) next ;~ GUIRegisterMsg($WM_ERASEBKGND,"") ;~ GUIRegisterMsg($WM_NCPAINT, "") ;~ GUIRegisterMsg($WM_NOTIFY, "") _GUICtrlListView_EndUpdate(GUICtrlGetHandle($Guiplist1)) ;~ GUICtrlSetState($Guiplist1,$GUI_ENABLE) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,1,0) ;~ GUISetState(@SW_UNLOCK,$GUI) EndFunc Func NoEraseBkgnd() Return 1 EndFunc Func Exitf() Exit EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
qsek Posted March 11, 2009 Author Posted March 11, 2009 Simply because begin update and end update has no effect when using _GUICtrlListView_DeleteAllItems. I wouldnt have put in lines which would fix the problem, i tried them all They only seem to work when adding single items. Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
Achilles Posted March 11, 2009 Posted March 11, 2009 Let me get this straight: You push End, the script blanks the listview, then you want it to pause and do it's thinking thing, then it shows the listview with all the items at once (or do you want it to show one at a time?). If so, why does this not work (I changed it a little bit from what I had above): expandcollapse popup#include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #Include <SendMessage.au3> Opt("GUIOnEventMode",1) HotKeySet("{End}", "Refresh") $Gui = GUICreate("TestGUI", 416, 416, 191, 113,BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION)) $Guiplist1 = GUICtrlCreateListView("Name", 8, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) $Guiplist2 = GUICtrlCreateListView("Name", 208, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) For $i = 1 To 10 _GUICtrlListView_InsertItem($Guiplist1, "Result of time intensive Functions "&$i) next GUISetOnEvent($GUI_EVENT_CLOSE, "Exitf") GUISetState() While 1 Sleep(10) WEnd Exit Func Refresh() ;~ _WinAPI_InvalidateRect(GUICtrlGetHandle($Guiplist1), 0, False) ;~ GUISetState(@SW_LOCK,$GUI) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,0,0) ;~ GUICtrlSetState($Guiplist1,$GUI_DISABLE) ;~ GUIRegisterMsg($WM_ERASEBKGND,"NoEraseBkgnd") ;~ GUIRegisterMsg($WM_NCPAINT,"NoEraseBkgnd") ;~ GUIRegisterMsg($WM_NOTIFY,"NoEraseBkgnd") ;~ _SendMessage(GUICtrlGetHandle($Guiplist1), $LVM_DELETEALLITEMS) _GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($Guiplist1)) _GUICtrlListView_BeginUpdate(GUICtrlGetHandle($Guiplist1)) Sleep(500); this represents some time intensive functions For $i = 1 To 10 Sleep(50); this represents some time intensive functions _GUICtrlListView_InsertItem($Guiplist1, "aResult of time intensive Functions "&$i,-1,-1,Random(0,100,1)) next ;~ GUIRegisterMsg($WM_ERASEBKGND,"") ;~ GUIRegisterMsg($WM_NCPAINT, "") ;~ GUIRegisterMsg($WM_NOTIFY, "") _GUICtrlListView_EndUpdate(GUICtrlGetHandle($Guiplist1)) ;~ GUICtrlSetState($Guiplist1,$GUI_ENABLE) ;~ _SendMessage(GUICtrlGetHandle($Guiplist1),$WM_SETREDRAW,1,0) ;~ GUISetState(@SW_UNLOCK,$GUI) EndFunc Func NoEraseBkgnd() Return 1 EndFunc Func Exitf() Exit EndFunc My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
qsek Posted March 11, 2009 Author Posted March 11, 2009 I simply dont want it to "Flicker", meaning that that i want it to visually prevent deleting the old items and display the new without any change or clearing the background. Just imagine this refreshing of the list is automatically done every second. This wont look very smooth, does it? Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
qsek Posted March 13, 2009 Author Posted March 13, 2009 No one knows this problem? Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
Moderators Melba23 Posted March 13, 2009 Moderators Posted March 13, 2009 qsek, The only solution I can think of is to use 2 lists and then swap between them. Try running this:expandcollapse popup#include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #Include <SendMessage.au3> Opt("GUIOnEventMode",1) HotKeySet("{End}", "Refresh") Global $fFlag = False $Gui = GUICreate("TestGUI", 416, 416, 191, 113,BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION)) $Guiplist1 = GUICtrlCreateListView("Name", 8, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) $Guiplist2 = GUICtrlCreateListView("Name", 8, 8, 200, 400, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT,$LVS_EX_GRIDLINES,$LVS_EX_DOUBLEBUFFER)) _GUICTRLLISTVIEW_SETCOLUMNWIDTH(-1, 0, $LVSCW_AUTOSIZE_USEHEADER) GUICtrlSetState(-1, $GUI_HIDE) For $i = 1 To 10 _GUICtrlListView_InsertItem($Guiplist1, "GUI1 Result of Functions "&$i) next GUISetOnEvent($GUI_EVENT_CLOSE, "Exitf") GUISetState() While 1 Sleep(10) WEnd Exit Func Refresh() GUIRegisterMsg($WM_NCPAINT,"NoEraseBkgnd") Sleep(500); this represents some time intensive functions $fFlag = Not $fFlag If $fFlag Then _GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($Guiplist2)) For $i = 1 To 10 Sleep(50); this represents some time intensive functions _GUICtrlListView_InsertItem($Guiplist2, "GUI2 Result of Functions "&$i,-1,-1,Random(0,100,1)) Next GUICtrlSetState($Guiplist1, $GUI_HIDE) GUICtrlSetState($Guiplist2, $GUI_SHOW) Else _GUICtrlListView_DeleteAllItems (GUICtrlGetHandle($Guiplist1)) For $i = 1 To 10 Sleep(50); this represents some time intensive functions _GUICtrlListView_InsertItem($Guiplist1, "GUI1 Result of Functions "&$i,-1,-1,Random(0,100,1)) Next GUICtrlSetState($Guiplist2, $GUI_HIDE) GUICtrlSetState($Guiplist1, $GUI_SHOW) EndIf GUIRegisterMsg($WM_ERASEBKGND,"") EndFunc Func NoEraseBkgnd() Return 1 EndFunc Func Exitf() Exit EndFunc Does this satisfy your requirements? 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
qsek Posted March 14, 2009 Author Posted March 14, 2009 yeah thank you, very nice workaround. A bit complicated to invoke that into my script, but i will give that a try. Though i wonder if there is a more cleaner solution via the WM_PAINT messages. Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite
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