EKY32 Posted August 26, 2012 Share Posted August 26, 2012 (edited) I have a GuiCtrlCreateListView, and a database with a huge quantity of rows, the scripts loads the data from the database to the list view (GuiCtrlCreateListViewItem), so it makes the window flashes and very slow, so I used _GUICtrlListView_BeginUpdate and _GUICtrlListView_EndUpdate it helped a bit, but the window still flashes as i need to recall the listing func each minute. Is there any way to fix that please? Thank you. Edited August 31, 2012 by EKY32 [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 26, 2012 Moderators Share Posted August 26, 2012 EKY32, In short, no! The only way I have found to stop the filckering is to hide the ListView at the beginning of the update and then show it again once the reload is completed. Why are you recall the listing function so often? 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 Link to comment Share on other sites More sharing options...
UEZ Posted August 26, 2012 Share Posted August 26, 2012 Try: disable the control, update the listview elements and finally enable the control again. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
czardas Posted August 26, 2012 Share Posted August 26, 2012 (edited) I don't seem to have any problems with flashing using the following code. The first time you click click the list view population is slow. On subsequent clicks it is much faster. This makes me wonder if creating empty rows first might be faster (I don't know). expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <String.au3> _Run() Func _Run() Local $dStyle = BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX) Local $dTestGUI = GUICreate(" ListView Test", 300, 200, Default, Default, $dStyle) Local $sHeadings = "Click" & _StringRepeat("| ", 4) Local $hListView = GUICtrlCreateListView($sHeadings, 0, 0, 300, 200, BitOR($LVS_REPORT,$LVS_SHOWSELALWAYS)) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) ;GUICtrlSetBkColor($hListView, 0xFFFFFF) GUISetState(@SW_SHOW) ;================================================================================ While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $hListView Then _Populate($hListView) WEnd ;=============================================================================== EndFunc Func _Populate($hListView) Local $iCols = 5 Local $hControlHandle = GUICtrlGetHandle($hListView) _GUICtrlListView_DeleteAllItems($hControlHandle) Local $sData For $i = 1 To 10000 $sData = $i For $j = 0 To $iCols -1 $sData &= "|" $sData &= $i & "," & $j Next GUICtrlCreateListViewItem($sData, $hListView) Next _GUICtrlListView_SetColumn($hListView, 0, "Click") EndFunc Edited August 26, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
EKY32 Posted August 26, 2012 Author Share Posted August 26, 2012 Well, this script looks good, i'll find a way to combine it with mine.Mr.Melba23, I have a compo box as a filter for the list view items, so when i choose a string from it, it must delete all the items of the list and get them again filtered from the database.. is it really that bad? i must disable or hide the list view? I'll try the script czardas gave me, then get back again, thank you. [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
Zedna Posted August 27, 2012 Share Posted August 27, 2012 Don't use BOLD style for all text of post!! Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
EKY32 Posted August 27, 2012 Author Share Posted August 27, 2012 Sorry, neither disabling nor hiding the listview stopped flickering the window, any other ideas please?Don't use BOLD style for all text of post!!OK, I'm sorry I annoyed you sir [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
EKY32 Posted August 28, 2012 Author Share Posted August 28, 2012 Well, is that really unreachable? should I lose hope to fix this problem? Thank you. [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
UEZ Posted August 28, 2012 Share Posted August 28, 2012 @EKY32: best is you show us your code and we can see what maybe is not properly coded. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
EKY32 Posted August 31, 2012 Author Share Posted August 31, 2012 Well, here is my script.. I found the real problem but I don't get the solution yet. Even when I'm using a huge quantity of items the ListView never flash if it's created in a normal GUI, and the script works fine, BUT, When I create the ListView in a TabItem.., the ListView starts flickering when I select the "Show All" string from the ComboBox (Means when loading all the items from the database), so how to fix that? Thank you. The Script File: Products.zip [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
UEZ Posted August 31, 2012 Share Posted August 31, 2012 Try this: expandcollapse popup#include <GUIConstantsEx.au3> ;~ #include <ComboConstants.au3>;~~~ #Include <GuiComboBox.au3> #include <GUIListView.au3> #include <SQLite.au3> #include <SQLite.dll.au3>;~~~ #include <GuiTab.au3> _SQLite_Startup() _SQLite_Open(@ScriptDir & "Products.db") Global $hQuery, $aRow $hGui = GUICreate("TITLE", 800, 500) $TabBox = GUICtrlCreateTab(0, 100, 802, 401) $hTabBox = GUICtrlGetHandle($TabBox) GUICtrlSetResizing(-1, $GUI_DOCKTOP) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlCreateTabItem("1") GUICtrlCreateLabel("Swich to Tab 2", 20, 50) GUICtrlCreateTabItem("2") $ListProducts = GUICtrlCreateListView("1|2|3|4|5|6|7|8|9", -2, 120, 803, 355) _GUICtrlListView_SetExtendedListViewStyle($ListProducts, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) $hListProducts = GUICtrlGetHandle($ListProducts) _GUICtrlListView_JustifyColumn($hListProducts, 0, 1) _GUICtrlListView_JustifyColumn($hListProducts, 1, 1) _GUICtrlListView_JustifyColumn($hListProducts, 2, 1) _GUICtrlListView_JustifyColumn($hListProducts, 3, 1) _GUICtrlListView_JustifyColumn($hListProducts, 4, 1) _GUICtrlListView_JustifyColumn($hListProducts, 5, 1) _GUICtrlListView_JustifyColumn($hListProducts, 6, 1) _GUICtrlListView_JustifyColumn($hListProducts, 7, 1) _GUICtrlListView_JustifyColumn($hListProducts, 8, 1) _GUICtrlListView_RegisterSortCallBack($hListProducts) _GUICtrlListView_SortItems($hListProducts, 8) $FilterT = GUICtrlCreateCombo("Show All", 254, 477, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlCreateTabItem("3") GUICtrlCreateTabItem("4") GUICtrlCreateTabItem("5") GUICtrlCreateTabItem("6") GUICtrlCreateTabItem("7") Loader() _SQLite_Query(-1, "SELECT ROWID,* FROM Products;", $hQuery) While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK If $aRow[8] <> "" Then GUICtrlSetData($FilterT, $aRow[8]) WEnd _GUICtrlComboBox_SelectString($FilterT, "Show All") GUISetState(@SW_SHOW) _GUICtrlTab_ActivateTab($hTabBox, 1) While 1 $RibbonsBar_GetMsg = GUIGetMsg() Switch $RibbonsBar_GetMsg Case $GUI_EVENT_CLOSE Exit Case $FilterT _Filter() EndSwitch WEnd Func Loader() _LoadDBTable("Products", $ListProducts) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 0, 80) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 1, 80) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 2, 90) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 3, 80) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 4, 60) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 5, 100) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 6, 150) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 7, 70) GUICtrlSendMsg($ListProducts, $LVM_SETCOLUMNWIDTH, 8, 60) EndFunc ;==>Loader Func _Filter() Local $FilterX, $RowF, $hQuery, $aRow, $i = 0 If GUICtrlRead($FilterT) = "Show All" Then _LoadDBTable("Products", $ListProducts) Else _GUICtrlListView_BeginUpdate($ListProducts) _GUICtrlListView_DeleteAllItems($ListProducts) _SQLite_Query(-1, "SELECT ROWID,* FROM Products WHERE Filter = '" & GUICtrlRead($FilterT) & "';", $FilterX) GUISetState(@SW_LOCK, $hGui) While _SQLite_FetchData($FilterX, $aRow, False, False) = $SQLITE_OK GUICtrlCreateListViewItem($aRow[1] & "|" & $aRow[2] & "|" & $aRow[3] & "|" & $aRow[8] & "|" & $aRow[4] & "|" & $aRow[5] & "|" & $aRow[6] & "|" & $aRow[7] & "|" & $i + 1, $ListProducts) $i = $i + 1 WEnd GUISetState(@SW_UNLOCK , $hGui) _GUICtrlListView_EndUpdate($ListProducts) EndIf EndFunc ;==>_Filter Func _LoadDBTable($table, $list) Local $hQuery, $aNames, $aRow, $i = 0 _GUICtrlListView_BeginUpdate($list) _GUICtrlListView_DeleteAllItems($list) _SQLite_Query(-1, "SELECT ROWID,* FROM " & $table & ";", $hQuery) GUISetState(@SW_LOCK, $hGui) While _SQLite_FetchData($hQuery, $aRow, False, False) = $SQLITE_OK If $table = "Products" Then GUICtrlCreateListViewItem($aRow[1] & "|" & $aRow[2] & "|" & $aRow[3] & "|" & $aRow[8] & "|" & $aRow[4] & "|" & $aRow[5] & "|" & $aRow[6] & "|" & $aRow[7] & "|" & $i + 1, $list) EndIf $i = $i + 1 WEnd GUISetState(@SW_UNLOCK , $hGui) _GUICtrlListView_EndUpdate($list) _GUICtrlListView_SetItemSelected($list, 0) _GUICtrlListView_SetItemFocused($list, 0) EndFunc ;==>_LoadDBTable Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
EKY32 Posted August 31, 2012 Author Share Posted August 31, 2012 Oh, that's it Mr.UEZ, you are great! SO, locking the GUI solved the problem Thank you! [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
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