Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_GUICtrlListView.au3


  • Please log in to reply
59 replies to this topic

#1 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 28 May 2006 - 03:23 PM

120 [correction] in zip includes comparing LVs to delete
_108; inbuilt DeleteDuplicates
0_97 faster remove dupes, arraydeletevbs
version to 0_80 now; July5th; Checkboxes and icon sort; exe incl, not image pics.
[lines needing Array2D.au3 remmed out (only needed for Win9x compat, and slower anyway)]
version to 0_57 now; June 15th; more complex [example working is Filebrowser below]
[NOte - needs Win2K at least for the DOS and maybe vbs commands...]
[attachment=9580:attachment] - Example with checkboxes
[attachment=9139:attachment]on toolbar
[attachment=9214:attachment]With tabs and calendar on toolbar [needs "slider.au3"]
[attachment=9215:attachment]
[attachment=9707:attachment][attachment=9708:attachment][attachment=9706:attachment][attachment=9712



:attachment][attachment=9777:attachment]
Hi,
If you are frustrated by ListView;
1. Slow Sort [Can the register sort speed things up?; I cannot get it to...]
2. No Display of items over 4000
This may be for you. [10-100x times faster; the more items, the faster relatively; guaranteed <1sec unless over 4000 items ( starts to slow down) or using _GUIsetImage; still <4 secs instead of up to ?40!]
USAGE [** at present, only works for simple ListView report, ? not icons etc, can't modify.. etc]
A. Include"_GUICtrlListView.au3"
B. Change any previous script with these 7 functions;
1. GUICtrlSetImage, [** delete these; use "FileSetIconDefault " and then icons are automatic within limits; change limits with "$i_DefaultIconNumber=300" etc]
2.._GUICtrlListViewSort,
3..GUICtrlCreateListViewItem,
4..GUICtrlCreateListView
5..__FileListToArray
6.._FileSetIconDefault -** use this to add icons; see FileBrowser examplle; sppeds icon display; sets default icon by checking max number of filetypes in the list first; or set it yourself
7..__GUICtrlListViewDeleteAllItems

to add an extra underscore at the start;[ _GUICtrlSetImage],__GUICtrlListViewSort[so ends up with 2 underscores],_GUICtrlCreateListViewItem,_GUICtrlCreateListView
C. Run as usual
Let me know if it's useful, I'll add more functions
Best, Randall
EXAMPLES; cf icon sorting demo; default icon number shown 300; change by "$i_DefaultIconNumber=300" etc
[New func also "_GUIListViewClose()" if you will redraw the Listview in same running script - changed ; now included in new "__GUICtrlListViewDeleteAllItems "
[attachment=8960:attachment][attachment=8961:attachment]
AutoIt         
;_GUICtrlListViewSorter.au3 0_12 #include-once #include "_GUICtrlListView.au3" ;declares following; global $ar_LISTVIEW[4001],$ar_LISTVIEWArray[4001],$s_LISTVIEWSortOrder="ASC",$i_LISTVIEWNumItemsView,$i_LISTVIEWPrevcolumn=-1 ;#opt('MustDeclareVars', 1) Dim $searchGUI,$listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index,$timerstamp $searchGUI = GUICreate("ListView Sort", 810, 623, (@DesktopWidth - 800) / 2, (@DesktopHeight - 600) / 2,$WS_MAXIMIZEBOX  + $WS_MINIMIZEBOX) $listview = _GUICtrlCreateListView("col1|col2|col3", 10, 10, 790, 530, -1, BitOR($LVS_EX_REGIONAL, $LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) $timerstamp1 = TimerInit() for $i=1 to 4000; it also works quicker over 4000, but starts slowing down as "_GUICtrlListViewInsertItem" used     $s_RandomListItem="line"&Random(-10000, 10000, 1)&"|"&Random(-10000, 10000, 1)&"|more_"&Chr(Random(Asc("a"), Asc("z"), 1))&Chr(Random(Asc("a"), Asc("z"), 1))&String(Random(-10000, 10000, 1))     _GUICtrlCreateListViewItem($s_RandomListItem, $listview) next ConsoleWrite("Time New :"&TimerDiff($timerstamp1) & " mseconds to search."&@lf) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) GUISetState() Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ];only needed for slow  sort method While 1     $msg = GUIGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit             global $ar_LISTVIEW[1],$ar_LISTVIEWArray[1]; only if want to free memory at end, and scrip still running?             ExitLoop         Case $msg = $listview             $i_Index=GUICtrlGetState($listview)             ; sort the list by the column header clicked on             $timerstamp1 = TimerInit()             __GUICtrlListViewSort( $listview,$B_DESCENDING,$i_Index)             $i_Time1=TimerDiff($timerstamp1)             ;$timerstamp1 = TimerInit()             ;_GUICtrlListViewSort($listview, $B_DESCENDING, GUICtrlGetState($listview))             ;$i_Time2=TimerDiff($timerstamp1)             ;ConsoleWrite("Time Trad :"&$i_Time2 & " mseconds to search."&@lf)             ;__GUICtrlListViewSort( $listview,$B_DESCENDING,$i_Index)             ;ConsoleWrite("Time New :"&$i_Time1 & " mseconds to search."&@lf)             ;MsgBox(0,"","ratio :"&round($i_Time2/$i_Time1,2) & " ."&@lf&"TimeOld1="&round($i_Time2,2) & " ."&@lf&"TimeNEW="&round($i_Time1,2) & " ."&@lf,2)             MsgBox(0,"","TimeNEW="&round($i_Time1,2) & " ."&@lf)             ;ConsoleWrite("ratio :"&round($i_Time2/$i_Time1,2) & " ."&@lf)     EndSelect WEnd Exit

Note - you do not need "Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount ($listview) ]", but still need to declare it "Local $B_DESCENDING", unless you are going to test against old sort.

Hi,
I think this is working on all international settings, with sliding toolbar, icons, and fast sort?...
So I have deleted versions I wrote which were not compatible...
Best, randall
GUICtrlListView.au3, ListView GUI Fast Sort


Edited by randallc, 16 October 2007 - 10:57 AM.








#2 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 581 posts

Posted 28 May 2006 - 07:08 PM

I've juste integrated in my "lastfilebrowser" program
and...simply amazing... the list not "clink" anymore while sorting
and it's fast, so fast !
i don't know how did you manage it, but i hope your functions will replace the old ones
good job man
c u

edit : your sort function doesn't work when list view is empty...i know i have to add
a work around, but it's just to inform
btw : it's only possible to pass by vbs (like some functions i've created too ?) ?

Edited by arcker, 29 May 2006 - 10:11 AM.

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

 

Projects :

  • Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here

#3 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 29 May 2006 - 03:21 PM

I've juste integrated in my "lastfilebrowser" program

Please remind me the link to your program?

your sort function doesn't work when list view is empty

OK, fixed in first post.

it's only possible to pass by vbs (like some functions i've created too ?)

I'd like to answer about the scripting control for vbs, but I am not sure of your question; you could write this file with AutoIt instead, but vbs gives the array sorting speed...
AutoIt         
;_GUICtrlListViewSorter.au3 0_15 #include-once #include "_GUICtrlListView.au3" Dim $searchGUI,$listview, $Btn_Exit, $msg, $Status, $Btn_Insert, $ret, $Input_Index,$timerstamp $searchGUI = GUICreate("ListView Sort", 810, 623, (@DesktopWidth - 800) / 2, (@DesktopHeight - 600) / 2,$WS_MAXIMIZEBOX  + $WS_MINIMIZEBOX) $listview = _GUICtrlCreateListView("Index   |col1     |col2|col3", 10, 10, 790, 530,   $LVS_SHOWSELALWAYS, BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL));Drag&Drop Columns _GUICtrlSetImage($listview, "mmcndmgr.dll", 96)                   ;Set Icons for records $timerstamp1 = TimerInit() for $i=1 to 4000; it also works quicker over 4000, but starts slowing down as "_GUICtrlListViewInsertItem" used     $s_RandomListItem=$i&"|line"&Random(-10000, 10000, 1)&"|"&Random(-10000, 10000, 1)&"|more_"&Chr(Random(Asc("a"), Asc("z"), 1))&Chr(Random(Asc("a"), Asc("z"), 1))&String(Random(-10000, 10000, 1))     _GUICtrlCreateListViewItem($s_RandomListItem, $listview) next ConsoleWrite("Time New :"&TimerDiff($timerstamp1) & " mseconds to search."&@lf) $Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30) GUISetState() GUISetState(@SW_MAXIMIZE) ;Local $B_DESCENDING While 1     $msg = GUIGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit             ExitLoop         Case $msg = $listview             $i_Index=GUICtrlGetState($listview)             ; sort the list by the column header clicked on             $timerstamp1 = TimerInit()             __GUICtrlListViewSort( $listview,$B_DESCENDING,$i_Index)             ConsoleWrite("Time New :"&round(TimerDiff($timerstamp1)) & " mseconds to search."&@lf)             ;MsgBox(0,"","Time New :"&round(TimerDiff($timerstamp1)) & " mseconds to search."&@lf,1)     EndSelect WEnd


** I have added a 4th function, which slows down the display [if "_GUICtrlSetImage" has been called for icons] [still 5-10 x faster as uses fast vbs sort, but reverts to normal "ListViewdeleteAllItems [slow!]" and "GUICtrlCreateListViewItem"], of course, but should keep icons, etc OK/... please test and let me know; [EDIT - you will need to put your own routine for icons in the UDF, probably, depending on your program]
INSTRUCTION
As in first post; 4th func to change is "GUICtrlSetImage" to "_GUICtrlSetImage" by adding extra underscore at front
Best, Randall

Edited by randallc, 30 May 2006 - 01:33 AM.


#4 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 581 posts

Posted 29 May 2006 - 08:51 PM

ok, i didn't that vbs array sort was faster, thanx you !
i've replace the old _guictrllistview.au3, and no more error while empty
my program is not yet released because i've a problem with the function _dateisvalid doesn't work (the example doesn't work too)
i will post it later
nice job
c u

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

 

Projects :

  • Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here

#5 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 30 May 2006 - 03:09 AM

Hi,
OK;
new version,
see running demo using icons in first post.
EXAMPLES; cf icon sorting demo; default icon number shown 300; change by "$i_DefaultIconNumber=300" etc
New func also "_GUIListViewClose()" if you will redraw the Listview in same running script
[attachment=8960:attachment][attachment=8961:attachment]
Best, randall

#6 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 30 May 2006 - 09:33 AM

Hi,
version to 0_27 now; May30th; minor correction; not sorting till 2nd click
See 1st post in this thread
Randall

#7 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 04 June 2006 - 11:09 PM

Hi,
version to 0_45 now; June 5th; more complex [example working is Filebrowser in first thread]
best, Randall

Edited by randallc, 04 June 2006 - 11:09 PM.


#8 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 08 June 2006 - 02:02 AM

Hi,
Some bugs fixed, and allowance for computers without "AM/PM" in time settings
version to 0_50 now; June 8th; more complex [example working is Filebrowser in first thread
Best, Randall
[Can I please have feedback as local regional date/time settings affect these functions]

#9 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 11 June 2006 - 12:49 PM

Hi,
v 0_52
I think this is working on all international settindgs, with sliding toolbar, icons, and fast sort?...
Best, randall

#10 Uten

Uten

    stupid is as stupid does..

  • Active Members
  • PipPipPipPipPipPip
  • 1,989 posts

Posted 11 June 2006 - 01:04 PM

Think you should add some error handling when vbs in not properly installed or wrong version?
I got this error in SciTe when running Last File Browser whome uses your UDF's.
Z:\Code\autoit\include\_GUICtrlListView.au3 (442) : ==> The requested action with this object has failed.: $aArray= $vbs.run("FileListToArray",$sPath) $aArray= $vbs.run("FileListToArray",$sPath)^ ERROR


Othervice it looks cool so keep up the good work

#11 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 12 June 2006 - 02:55 AM

Think you should add some error handling when vbs in not properly installed or wrong version?
I got this error in SciTe when running Last File Browser whome uses your UDF's.

Z:\Code\autoit\include\_GUICtrlListView.au3 (442) : ==> The requested action with this object has failed.: $aArray= $vbs.run("FileListToArray",$sPath) $aArray= $vbs.run("FileListToArray",$sPath)^ ERROR


Othervice it looks cool so keep up the good work

Hi, Thanks for looking;

Last File Browser

in the first post of the thread you link to.. does not call that function; you must be using another file?

$aArray= $vbs.run("FileListToArray",$sPath)^ ERROR

That is usually the line which gives an error if I have the international date settings or time settings wrong; are you able to forward a copy of the DOS file you will have genearted please?
"FindFiles.txt" in your script directory?

error handling when vbs in not properly installed or wrong version

I agree, but would not now how to start...
Best, Randall

#12 slightly_abnormal

slightly_abnormal

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 513 posts

Posted 12 June 2006 - 03:43 AM

nice job


err... one thing the norton says your filetoolbar.au3 is malicious script .maybe because of vbs?

Edited by slightly_abnormal, 12 June 2006 - 03:44 AM.


#13 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 12 June 2006 - 05:26 AM

Hi,
"norton says your filetoolbar.au3 "
"filetoolbar.au3" does not have any vbs until it runs and #includes "_GuiCtrlListView", so I'm not sure; does it complain on scannnig the file on the disc, or when it runs? [or do you mean the compiled version anyway?]
Thanks, Randall

#14 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 15 June 2006 - 06:43 AM

Hi,
Update on first post;

_GUICtrlListView.au3 ( 20.25k )
version to 0_57 now; June 15th; more complex [example working is Filebrowser below]lastfile_tabs.au3 ( 11.9k )
With tabs and calendar on toolbar [needs "slider.au3"]
Slider.au3 ( 3.36k ) Number of downloads: 0

Best, Randall

#15 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 581 posts

Posted 15 June 2006 - 01:49 PM

simply amazing...
your version of lastfile is really cool, and works !
but one thing to consider : the CPU !
on my computer, the script consume 30% of my 2400+ ...
it's the toolbar that do this ? alone it's consume 2-3 %, and with the "autorefresh" , 30%
i'll try to add an option to desactivate this option, because it's too big, isn't it ?

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

 

Projects :

  • Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here

#16 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 15 June 2006 - 03:04 PM

the CPU !;on my computer, the script consume 30%

Thanks for looking; I am not computer-savvy enough to understand this;
on my current machine, the 31% is only for about 1/2sec or less, then back to 0-1%
Is taht what you mean? - Wouldn't you expect that for the amount of processing required for a refresh (reads the whole directory again, sorted by time, then selects that day's files from the lists)
All the other ways of doing this are slower that I can see; but a fair compromise would be to go back to "findnextfile" each time and sort the listview by time afterwards (x2); slower a little, and flickery [I had it running that way for a while... I'll tr to find the version for you to test if you like.];
What do you think?
randall

#17 ptrex

ptrex

    Universalist

  • MVPs
  • 2,413 posts

Posted 16 June 2006 - 08:26 AM

@randallc

Hi here we meet again.

I see that you are making a lot of effort to increase the speed if the ListView handling.
As well as trying to break the 4000 Limit boundary. :D

I appreciate what you are doing, but I sorry to say that this is not quit the best approach.

I will post the a better way on doing ListView navigation, which has no limits and speed is no problem.

please comment on what you see.

regards,

#18 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 16 June 2006 - 09:50 AM

Hi,
Good news; i look forward to it.
Best, Randall

#19 arcker

arcker

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 581 posts

Posted 17 June 2006 - 02:24 AM

hey, i've just commented the other guilistview approach by p.trex
so, what is the best for our computers ? ^^
btw, on my computer, the script take 20-30% all the time ! not only at the start...
c u !

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

 

Projects :

  • Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here

#20 randallc

randallc

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,902 posts

Posted 17 June 2006 - 03:01 AM

Hi,
[btw. - You'd need to ask @ptrex if he can apply it to this application?]
*** That's a worry about the cpu use staying at 30%!
I'll try it on another computer;
Is it...?
1. The new listView Gui approach.
2. Icons
3. Toolbar
4. Tabs?

Could you please try this one (back to sans toolbar, sans vbs[except for sort], sans DOS; just tabs , icons (you acn set the default icon manually for speed), and back to your "findfirstfile")
Best, Randall

[PS and the "old" version reverts to your original, without my GUIListView at all; still does 30% for 1/2 sec on refresh on my machine; ]

Edited by randallc, 17 June 2006 - 03:39 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users