faustf Posted March 24, 2016 Share Posted March 24, 2016 hi guy i have a prog , notice , when i take data from db and insert in listview with guctrlsetbkcolor is very slow with 24 record i wait 7 or 8 second and blinking the listview with out color go fast this is my code Func _Popola_Anagrafica() ; popola il listview con i clienti del db _Mysql_Query("SELECT * FROM ge_anagrafica_clienti ") Local $ANAC_cotrol = 0 Local $ANAC_index = (_ArrayMaxIndex($aRecordsetContent) + 1) Do GUICtrlCreateListViewItem($aRecordsetContent[$ANAC_cotrol][1] & "|" & _ $aRecordsetContent[$ANAC_cotrol][2] & "|" & $aRecordsetContent[$ANAC_cotrol][3] & "|" & _ $aRecordsetContent[$ANAC_cotrol][4] & "|" & $aRecordsetContent[$ANAC_cotrol][5] & "|" & _ $aRecordsetContent[$ANAC_cotrol][6] & "|" & $aRecordsetContent[$ANAC_cotrol][7] & "|" & _ $aRecordsetContent[$ANAC_cotrol][8] & "|" & $aRecordsetContent[$ANAC_cotrol][9] & "|" & _ $aRecordsetContent[$ANAC_cotrol][10] & "|" & $aRecordsetContent[$ANAC_cotrol][11] & "|" & _ $aRecordsetContent[$ANAC_cotrol][12] & "|" & $aRecordsetContent[$ANAC_cotrol][13] & "|" & _ $aRecordsetContent[$ANAC_cotrol][14] & "|" & $aRecordsetContent[$ANAC_cotrol][15] & "|" & _ $aRecordsetContent[$ANAC_cotrol][16] & "|" & $aRecordsetContent[$ANAC_cotrol][17] & "|" & _ $aRecordsetContent[$ANAC_cotrol][18] & "|" & $aRecordsetContent[$ANAC_cotrol][19] & "|" & _ $aRecordsetContent[$ANAC_cotrol][20] & "|" & $aRecordsetContent[$ANAC_cotrol][21] & "|" & _ $aRecordsetContent[$ANAC_cotrol][22] & "|" & $aRecordsetContent[$ANAC_cotrol][23] & "|" & _ $aRecordsetContent[$ANAC_cotrol][24] & "|" & $aRecordsetContent[$ANAC_cotrol][0], $ANAC_List1) If Not Mod($ANAC_cotrol, 2) Then ;Even GUICtrlSetBkColor(-1, 0xffffff) Else ;Odd GUICtrlSetBkColor(-1, 0xe6e6e6) EndIf $ANAC_cotrol += 1 Until $ANAC_cotrol = $ANAC_index EndFunc ;==>_Popola_Anagrafica how can optimize ??? Link to comment Share on other sites More sharing options...
KaFu Posted March 24, 2016 Share Posted March 24, 2016 Add _GUICtrlListView_BeginUpdate() at the start of the function and _GUICtrlListView_EndUpdate() at the end. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
faustf Posted March 24, 2016 Author Share Posted March 24, 2016 simply genius thnakz is very very fast 788 milli second before , and after 78 milli thankzzz Link to comment Share on other sites More sharing options...
AutoBert Posted March 24, 2016 Share Posted March 24, 2016 It's no need to check for odd or evenlines. This script shows how to alternate colors in LV: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <ListViewConstants.au3> #include <File.au3> Global $main = GUICreate("Altenating Colors in Listview", 600, 400) Global $listview = GUICtrlCreateListView("Gruppe1| BlubText", 10, 10, 580, 370, BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_FULLROWSELECT, $WS_EX_CLIENTEDGE)) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) ; general for alternate Colors GUICtrlSetBkColor(-1, 0xE6E6FA) ; Backgroundcolor odd Lines _GUICtrlListView_BeginUpdate($listview) For $i = 1 To 99 GUICtrlCreateListViewItem("test" & $i & " |Blub " & Random(1, 9), $listview) GUICtrlSetBkColor(-1, 0xcccccc) ;Backgroundcolor even Lines Next _GUICtrlListView_EndUpdate($listview) GUISetState() Global $msg While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
water Posted March 24, 2016 Share Posted March 24, 2016 I described alternate colors in LVs here: My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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