May 08, 2024, 08:18:25 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Source Finder

Started by fasecero, July 08, 2009, 02:02:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fasecero

This small application looks for source files in a given directory and all subdirectories. The results are displayed in hierarchical form in a treeview or in a list.

The objective of the program is to use it when working on projects with many source files for fast access to them. Or, alternatively, to access the files in the folder "Project", for example.

The program can open any source file founded by double clicking it. You can also open any folder by right-clicking in the item.

You can view the folders and sources in the treeview and only the sources in the listview.
How to use: Press the button "...", select a folder and press the button "Go!"

Some results:
  * Load all the source files in the folder "Project" of the EB folder: 1 second.
  * A path with 1000+ subfolders, 300+ sources: 8 seconds.

Hopefully it can be helpful :)


billhsln

Very nice program.  It is an excellent program to use as a learning example.  Very cleanly written with well written comments.

Thank you,
Bill
When all else fails, get a bigger hammer.

fasecero

Thank you.

The hardest part was to create a code that allow process all the treeview childs items from a given one. Not finding anything on the web I did it myself (not was easy) :), the result is at least a few lines:

to process all the childs (and their respectives childs too...) of a particular item "parent", excluding the parent himself:


uint parent= .....
uint itemid
TVFINDER tvf

TvFinderStart(tvf, parent)
DO
itemid=TvFinderFindNext(tvf)
IF itemid>0 THEN
' do something with itemid
' .......
ENDIF
UNTIL (tvf.nivel<=0)


however, to go through all the childs of a given parent, including the "parent"


TvFinderStart(tvf, parent)
DO
IF itemid>0 THEN
' do something with itemid
' .......
ENDIF
itemid=TvFinderFindNext(tvf)
UNTIL (tvf.nivel<=0)


and to go through all the items of the treeview we can use any of the above using:


parent = 0


finally, if someone creates an application with more than one treeview will be necessary to reformulate the function TvFinderStart:


GLOBAL SUB TvFinderStart(TVFINDER tvf, uint initialid, uint tvid, WINDOW w)
tvf.actualid=initialid
tvf.nivel=0
tvf.childhab=1
tvf.tipo=1
tvf.hwndtv=GETCONTROLHANDLE(w, tvid)
ENDSUB


tvid is the Identifier of the treeview control.