| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Mar 10, 2009 9:09 pm Post subject: SSTreeView as a Directory List? |
|
|
Has anyone ever used the SSTreeView dll for a directory list like the directory list in VDSObj.dll?
I'm trying to make a Windows 95 Explorer clone here, and while the VDSObj.dll offers the needed elements, it does not offer the needed functions to actually create a viable file manager.
The two things that would offer the needed functions are the TABLE element from VDS and the TREEVIEW element from the SSTreeView.
While I have most of what I need done for the TABLE element, I've spent the last week messing with the DIRECTORYLIST from VDSObj, only to find it just is not capable of doing what I need. So I'm now going to try working with the TREEVIEW, but! I'm not sure if anyone else has done this before, and if they have, could they give me some pointers or some code to get me going on using the TREEVIEW as the directory tree for my file manager clone.
Thanks in advance,
~Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Aslan Valued Contributor


Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Wed Mar 11, 2009 2:30 pm Post subject: |
|
|
What are you lacking if you use the Table element?
I'm guessing you need the ability to indent subdirectories.
With my extTable.dsu you can create the graphical stucture as long as you create the logical stucture.
I though about trying this myself to use as a demo for the DSU but never had the time. |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Wed Mar 11, 2009 5:11 pm Post subject: |
|
|
Well the table element is perfect for the file list, so I have no issue with the table element. So far, it offers everything I need for the file list. Well, it only has one failing for me, and that is a reliable way to change the views from detailed view, to icon view and to icon list view. That, and when in icon view, it doesn't show the icons at all But that is not an essential need, as detail view is what use anyway when using a file manager.
It's a directory list that I need. The VDSObj one doesn't allow me to drag and drop things from the file list on to it. I can't determine what item the mouse is over at all. But the SSTreeView probably does. If the table element could be used as a treeview, that could open and close like a treeview, then the table would offer me the needed abilities.
But I'm pretty sure that the sstreeview offers what I need. My concern with this though, is how to manage it's use. Load it with all the directories on a drive immediately at once, which is probably not a good idea since it takes way too much time to fill a vds list with the entire directory structure on a drive, or, try to find a way to only load say, two levels of directories, and if the user expands a folder, try to fill that sub directory structure with some more sub directories beyond it to try and keep ahead of the user.
I'm also thinking that it is likely wise to cache the directory structure of each drive visited. And to come up with some routine that can detect new or removed directories.
See, the darn directorylist in VDSObj would've been great for this since you don't have to deal with that, and you don't have to take a lot of time populating it with the directory structure, but darn it, it just doesn't offer you the ability to interact with it to the extent needed to make it viable for a file manager. _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Fri Mar 13, 2009 12:19 am Post subject: |
|
|
Ok, I've successfully created some code to populate the SSTreevw element with the entire directory structure of a drive, and it didn't choke. The drawback is that it takes far too long to load the entire directory structure, then parse it and pass it to the treeview.
Btw Aslan, I like that extTable thingy ya did there. I didn't notice that before until you pointed that out in this thread. Sweet, but not sure it'd help out with the treeview here.
So....... what to do, what to do, what, to, do....
My initial idea due to the speed issue, was to initially grab the structure once, then keep a txt file of it. Use that to initially load the tree each time it's started, then to verify the directories are all still there... But then I realized that I wouldn't know if any new directories have since been created.
At least within the realm of the program I could keep track of deleted and created directories, but not outside and trying to load an entire structure repeatedly to keep an eye on any outside changes just would not be viable at all.
Any suggestions or ideas anyone?
Here's the code:
| Code: |
OPTION ERRORTRAP,ERROROUT
EXTERNAL sstreevw.dll
#DEFINE FUNCTION,TREEVIEW,LISTCELL
#DEFINE COMMAND,TREEVIEW,LISTCELL
DIALOG CREATE,New Dialog,-1,0,621,448,CLASS TREEVIEWTESTING
DIALOG ADD,LIST,LIST1,9,265,347,410
DIALOG ADD,STATUS,STATUS1,STATUS1
DIALOG SHOW
TREEVIEW PARENT,#TREEVIEWTESTING
TREEVIEW CREATE,TV1,9,6,250,410,LinesAtRoot,HasButtons,HasLines,ShowSel,sunken,notooltips,NoDragDrop,ItemExpand,SelChange,CLICK
DIALOG CURSOR,WAIT
LIST CREATE,1
LIST CREATE,2
%Z = @treeview(handle,TV1)
%A = @sendmsg(%Z,$0B,0,0)
LIST FILELIST,2,c:,*DHSR
LISTCELL CELLSEP,\
IF @text(2)
LIST SEEK,2,0
%%PrevCount = 2
REPEAT
%%DirItem = @substr(@item(2),4,@len(@item(2)))
%%CurCount = @listcell(total,%%DirItem)
%%CurName = @listcell(last,%%DirItem)
IF @text(1)
LIST SEEK,1,0
END
IF @greater(@pos(\,%%DirItem),0)
IF @greater(%%CurCount,@count(1))
LIST SEEK,1,@pred(@count(1))
%%subparent = @treeview(addChild,TV1,@item(1),%%CurName,,,0)
LIST ADD,1,%%subparent
ELSIF @equal(%%CurCount,@count(1))
LIST SEEK,1,@pred(@count(1))
LIST DELETE,1
LIST SEEK,1,@pred(@count(1))
%%subparent = @treeview(addChild,TV1,@item(1),%%CurName,,,0)
LIST ADD,1,%%subparent
ELSIF @less(%%CurCount,@count(1))
REPEAT
LIST SEEK,1,@pred(@count(1))
LIST DELETE,1
UNTIL @equal(@count(1),%%CurCount)
LIST SEEK,1,@pred(@count(1))
LIST DELETE,1
%%subparent = @treeview(addChild,TV1,@item(1),%%CurName,,,0)
LIST ADD,1,%%subparent
END
ELSE
%%parent = @treeview(add,TV1,%%CurName,,,1)
LIST CLEAR,1
LIST ADD,1,%%parent
END
%%Null = @next(2)
UNTIL @null(@item(2))
END
%A = @sendmsg(%Z,$0B,1,0)
DIALOG CURSOR,
:EVENTLOOP
WAIT EVENT,"0.5"
%E = @event()
GOTO %E
:ERROROUT
info @error(e)@tab()@error(n)
:CLOSE
WINDOW HIDE,#TREEVIEWTESTING
TREEVIEW REMOVE,TV1
EXIT
:RESIZE
GOTO EVENTLOOP
:TIMER
GOTO EVENTLOOP
:TV1RCLICK
GOTO EVENTLOOP
:TV1ITEMEXPAND
GOTO EVENTLOOP
:TV1SELCHANGE
:TV1CLICK
GOTO EVENTLOOP
:LISTCELL
IF @null(%%ListCellSep)
%%ListCellSep = @fsep()
END
IF %1
IF @equal(%1,total)
IF %2
%%ListCellTemp = %2
%%FuncOutput = 1
REPEAT
IF @greater(@pos(%%ListCellSep,%%ListCellTemp),0)
%%FuncOutput = @sum(%%FuncOutput,1)
%%ListCellTemp = @strdel(%%ListCellTemp,1,@pos(%%ListCellSep,%%ListCellTemp))
END
UNTIL @not(@greater(@pos(%%ListCellSep,%%ListCellTemp),0))
END
ELSIF @equal(%1,last)
IF %2
REPEAT
IF @greater(@pos(%%ListCellSep,%%ListCellTemp),0)
PARSE "%%ListCellPre;%%ListCellTemp",%%ListCellTemp
END
UNTIL @not(@greater(@pos(%%ListCellSep,%%ListCellTemp),0))
%%FuncOutput = %%ListCellTemp
END
ELSIF @equal(%1,n2last)
IF %2
REPEAT
IF @greater(@pos(%%ListCellSep,%%ListCellTemp),0)
PARSE "%%ListCellPre;%%ListCellTemp",%%ListCellTemp
END
UNTIL @not(@greater(@pos(%%ListCellSep,%%ListCellTemp),0))
%%FuncOutput = %%ListCellPre
END
ELSIF @equal(%1,cellsep)
IF %2
%%ListCellSep = %2
%%FuncOutput = %%ListCellSep
ELSE
%%ListCellSep = @fsep()
%%FuncOutput = %%ListCellSep
END
END
END
EXIT %%FuncOutput |
Note: You need the sstreevw.dll
NoteNote: Most everyone knows that my way of coding is not always the best or most logical. You may find that you can easily optimize this and or put proper error handling in it etc... :p _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sat Mar 14, 2009 3:52 am Post subject: |
|
|
I do something similiar for getting lists of recorded files off a PVR. I cache the list because it takes too long to download and parse the full detailed list each time. Then next time my app is run I quickly get just the basic list of file names only. Then loop through the basic listing matching any file names that are in the cached list. If a match is found I use the cached details for that file. Any deleted or renamed files are skipped because they are not matched. For any new files that are not in the cached list I get their full details from the PVR.
The only problem is for files that have changed, but are still in the same directory with the same name, because I have no way of knowing that they have changed unless I get their full details. _________________ cheers
Dave |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|