Version 10 of Directories & Trees

Updated 2013-04-16 19:41:11 by CsabaNemethi

Directories & Trees

Zipguy 2013-02-07 - You can find out my email address by clicking on Zipguy. On one drive, which is all mine (d:\), I've got 1228 Total Directories. They make lots of sense to me. To others, I don't know, but that's ok, because only I use them. I remember a TCL program I wrote which would allow me to "promote" a group of files to the parent directory. I have to switch directories a lot (thanks in part to starkit) when I'm working on them.

I've been toying with the idea of writing a halfway decent program, like one I've been using to display a filename, ext, size (/folder) and date all in one row. The program I've been using was written to implement Norton's Commander (nc), which was written around 1993, in a newer version and lanuage. It displays directories "side by side" panels, where you can navigate directories, either up or down, in either pane that you are in. Then you can copy/delete/move/view/rename files, or create/delete directories. It also has some more advanced features like (Icons to provide these features)

  • Back - Means to go backwards (like you do in you browser)
  • Copy (which brings up a dialog)
  • Move (which brings up a dialog)
  • Delete (which brings up a dialog)
  • Search (which brings up a dialog)
  • Edit
  • View
  • Pack (and Unpack)
  • Map (and Unmap) Network drives
  • Invert Selection (if you have a few files selected)
  • Select all
  • Unselect all
  • Select Group (which brings up a dialog)
  • Compare the two panels (which brings up a dialog)
  • Refresh
  • Tree (which brings up a dialog just like the one in tk_getOpenFile)
  • Options (which brings up a notebooked dialog)
  • Help (which brings up a dialog)
  • Exit

to name a few. This is what it looks like:

http://www.geocities.ws/thezipguy/misc/gyula_navigator.png

It was written in 2002! I think all in C++, by Gyula Bibernath, which was purchased by Wanai. There must have been a LOT of C++ code in there. You can see it here at Yahoo! [L1 ] or you can download the 32 bit version from nonags where I found it at http://www.nonags.com/freeware-gyulas-windows-navigator-1-26_802.html . If you go to the site where you'd expect to see it, it's not on there anymore :(. http://www.wanari.com . 10 Years has been a long time, and Norton's File Commander has been the most attempted re-written program, because it used to be be written for monochrome screens, and used to be a DOS program, back when memory was Extremely expensive. I think it was written in pure Assembler language (for speed).

So I thought I'd look at things that would be good at handling Multicolumn listbox'es or switching directories, and I got a little lost here in wiki. I found then tablelist vs mclistbox afterwards which does support images as a column which sounded great. So I then went to http://www.nemethi.de , downloaded http://www.nemethi.de/tablelist/tablelist5_7.zip , got it installed on my computer, but unsucessfully :(. I'm still working on it. All the programs, which are demos, say:

http://www.geocities.ws/thezipguy/misc/tablelist_err.png

Csaba Nemethi 2013-04-16: The demo scripts do work as expected. Please make sure you install the package as described in the documentation.

So I punted and tried to get mclistbox from http://tcllib.sourceforge.net , downloaded it, and it does work. The program that came with it, example.tcl, turned out to be a font selector, which I do like:

http://www.geocities.ws/thezipguy/misc/font_chooser.png

But it was not a file browser. Oops, I was in the wrong folder. So I made sure I was in the right folder, and ran example.tcl (in the correct folder, which was not D:\dl\dcl\stock\zip\combobox\example.tcl which I got from http://www2.clearlight.com/~oakley/tcl/combobox/index.html ) and it was a directory browser:

http://www.geocities.ws/thezipguy/misc/mclistbox.png

Horray! Well it does work, but there are some features, it doesn't have, that I've grown real attached to. Some to mention are compared in tablelist vs mclistbox. I wish I had tablelist working which I did back in 2005 in my aforementioned program which was the "promote" a group of files. I think it also used my own code (which I borrowed from wherever I got it, somewhere on here when it was called http://www.tcltk.com ) to have a combobox in there to make it easier to decide how many levels up you wanted to "promote" them to. Or perhaps I had a version of that program which allowed me to quickly go up 3-5 directories, and then proceed back down the tree. It's gotten a little lost in my memories, but I did like to use it when a group of files needed to be "promoted".

But anyway, not to get off subject, what about trees? I like the one that was supported in Gyula's Navigator which looked like this:

http://www.geocities.ws/thezipguy/misc/gyula_navigator_browse.png

which looked real good, but it was not re-sizeable. There was one in combobox which was at the "HugeCombo package" at http://wiki.tcl.tk/_repo/ulis/Hugecombo.zip , which was developed back in 2003, I downloaded it, unzipped it, and ran demo3.tcl in it, which looked like this:

http://www.geocities.ws/thezipguy/misc/hugecombo_demo3.png

and it did look pretty darn good. However it did not look as good with the "+" signs nor lack of them, and the lines that did look great in Gyula's version. So I went looking some more, and found another one which did look great (looking here http://wiki.tcl.tk/_//search?submit=Search&S=tree&_charset_=UTF-8 ), althought it appears on a canvas, not a listbox. It was at What's wrong with the tree widgets? which I downloaded and made it into a file, and it looked like this:

http://www.geocities.ws/thezipguy/misc/tree_graphic.png

which was wonderful. I'm still looking around for tree programs, which are smallish (not huge), and that I could give anyone credit for if I used it in my simple program that I'm trying hard to create. That is just one that let's you scroll around on your files, and move up and down folders (I mentioned at the bottom in Scrolled listbox widget -Display a list, pick any item then perform some follow up action.). I think that would be good for most TCL programmer's, if I could create one like that, that was not huge, would be great if I released it like I have ML - Heavily Modified & Improved, and it helped anyone to consider taking on the Norton Commander challenge. I'm just taking it one step at a time.

I'm still look around, because who would have thought that there are trees, many different versions, of different ages, out here somewhere. Also, what about Multicolumn listbox'es, are there many more of them hiding out here also?

Any help or comments on this would be welcome.

MG Have you looked at the ttk::treeview widget, which is part of Tk 8.5 and 8.6? It works as both a tree widget and a multicolumn listbox (either individually or both together).

Zipguy 2013-02-07 - Nope! I have the documentation for 8.4.11.xxx from Activstate with the help file. Now that they have come out with 8.6, I have already downloaded 8.5.13.0, which I have yet to install. I'll do that now and get back to you soon MG. Thanks for that. It does sound good (hopefully)!

Zipguy 2013-02-11 - I've got it installed and have looked at all the new programs for TCL, by running widget.tcl, which looks like this:

http://www.geocities.ws/thezipguy/misc/widget_01.png

and I liked the program which was called "5. A directory browser tree", which did include filenames, sprinkled in with directory names (i.e. sorted). It looked like this:

http://www.geocities.ws/thezipguy/misc/tree.png

I modified it a bit, removing the second item (size), and got it working well like this:

http://www.geocities.ws/thezipguy/misc/directorybrowser.png

So what I'm going to try to do is let it pass the current directory, which I'm not sure where the tree widget stores it, and pass it to scrolledlistbox.tcl which can be found by searching on "Scrolled listbox widget". It does look like this

http://www.geocities.ws/thezipguy/misc/scroll_lb_files.png

which would make a good sub-window for the main window, which would be the boss. One thing I don't like about it is that I always shows a + sign in front of the directory, even if it does not have sub-directories. I'm looking into this. I would prefer if it could pass the directory to:

http://www.geocities.ws/thezipguy/misc/mclistbox.png

as a subwindow also. Perhaps, I should use ttk::treeview as a multicolumn listbox again as a subwindow. Looking into that. Also, just to make it complete, for now, here is the LemonTree program which I got from there:

http://www.geocities.ws/thezipguy/misc/lemontree.png

Zipguy 2013-04-16 - Now that I've had a chance to look at it again, I tried to combine the above mentioned progams (i.e. tree and mclistbox) into a program which only barely worked together. I did and I got this:

http://www.geocities.ws/thezipguy/misc/sdv_00.png

I like the way it looked, although I was using the button to drive the mclistbox part of it. So I thought, hmmm..., I need to look into ttk a little deeper. I did find the ttk::notepad in my docs, and an example at the bottom, which I modified. This I what I came up with:

http://www.geocities.ws/thezipguy/misc/notebookex.png

It took me a little work to get all three combined but I did, ah.... success. This is what it looked like:

http://www.geocities.ws/thezipguy/misc/sdv_01.png

I thought, well great, and I played around with it a little and realized that I'd encountered a new problem, which looks like this:

http://www.geocities.ws/thezipguy/misc/sdv_02.png

So what my problem is that it does look real small, both in width and height, in both panes. Not sure why the ttk::notepad is making it so small. I'm looking into the ttk, which I'm sure I don't understand yet, but like it. The documentation is pretty sparse on that now.

I did a search on ttk and found lots of results. I found an interesting page here called Applications using Tile. There is an editor on that page, which is mentioned in the Tcl Editors page, which I did like the look of, a lot. It is called MSEdit and can be found here [L2 ]. I'm going to Unwrap it, take a look at it anyway, to see how they did all that, hopefully using ttk to do that. It does seem kind of large to me, which may mean it's Object Oriented (which is kind of a bummer for me) .

Are there better examples of ttk usage? Not OO?

Is there a way to modify the icons in it like the ones in this dialog?:

http://www.geocities.ws/thezipguy/misc/notebookex2.png

for the tk_chooseDirectory, which I like a lot better? via themes or something?