You know how it is - you start work on one project and halfway through, you find one or two side-projects crop up that have to be solved before you can continue on the original project.

This is one such project with the added twist that it too started its life as a side-project. Here's what happened:

<Cue wavy screen effect>

I can only imagine that the planets must have been in (mis-)alignment or something, because at one point a few months ago, I was suddenly fielding emails on four or five separate articles I had previously submitted to CodeProject, some asking for features and others for bug fixes.

Foolishly or otherwise, I largely agreed with all the points raised, and subsequently found myself with fourteen or fifteen separate issues to resolve.

The situation was also made worse because I was trying to use CodeProject to keep track of all the things I had agreed to do, meaning that I had to continuously trawl the comments section of each article to remind myself of what I was supposed to be working on.

It even got to the stage where I was worrying that I'd fail to deliver on something - silly I know, but there you are!

Keeping a list on paper was a definite step in the right direction, but since I do all my coding on the same machine, it seemed somewhat inelegant, and anyway, we all know what happens to crucial bits of paper left lying around on desks and such.

The next step was to hunt around on the web for a tool to meet the following requirements:

Simple interface

Support for hierarchical data

Numbered items/subitems

Open file format

Freeware

Simple, huh! not!

I will admit that I did not spend weeks searching, but I am still surprised at the general lack of software matching my needs.

On reflection, I think that the reason may be simple: people are so used to commercial software being 'feature-rich' that when they come to design software themselves, they (not unreasonably) think they too need to cram as much in as possible, often leading to software where a lot of essential functionality is hidden away in the menu bar.

So, surprise, surprise, I decided to write something myself.

However, it's fair to say that I did not originally intend to post it on CodeProject and am only really doing so because I had a heap of fun solving some very interesting problems and these are what I think make it worth it.

Using the Software

There's really very little I need to say here since every feature/function is explicitly visible in the interface.

Nevertheless, the following list of basic capabilities and omissions may go someway to answering any questions that arise:

Files are stored in XML format with .xml file extension.

Trying to load a non-tasklist file will generally fail (unless you read the code to see how to circumvent it).

The number of items/subitems is limited only by memory (although performance may be the deciding factor before you exhaust memory).

Marking a parent item as 'done' will also gray-out child items, but they are not disabled or automatically marked as 'done'.

An ellipsis (...) indicates that an item has sub-items.

All items can be expanded or collapsed (by double-clicking).

Top-level items and sub-items are created using different toolbar buttons.

There are task-specific context-menus.

The previously open tasklists are re-opened on startup.

The tasklist is automatically saved when closing the software or minimizing it to the system tray.

The priority of a task is shown as a grayscale box to the left of the item.

Points of Interest

Here's where we come to the side-projects I was talking about, the first two of which I intend to work up into follow-up articles.

They are:

The 'ordered' tree control, which incorporates a non-client gutter for displaying the item numbers.

The idea stemmed from research I did into alternative designs for a tree-list control, which did not solve it by creating a hybrid control incorporating a tree and a list.

The hybrid control seems such an obvious solution that I suspect few people have stopped to question it, but it has still always struck me as looking far too much like hard work to be truly elegant ('square pegs' and 'round holes' spring to mind).

One possible idea is to implement the 'list' portion entirely in the non-client area of the tree. I.e., shift the right hand client edge to the left and then render the list portion in the resulting non-client area.

Whilst I've yet to get round to building a proof of concept, it was nevertheless this ongoing mental debate which prompted me to try to solve the requirement for numbered items and subitems by rendering the item/subitem numbers in the non-client area.

Without going into too much detail (as this will subsequently be an article of its own), this is how I got it to work:

Handle TVM_INSERTITEM and TVM_DELETEITEM to know exactly when items are added and removed.

In these handlers recalculate the width of the gutter required to display the widest 'dotted' item/subitem number. (Note: this is not necessarily simply the deepest subitem.)

Handle WM_NCCALCSIZE when it does, and offset the left border by the required gutter width.

Handle WM_NCPAINT for painting the numbers.

This is necessarily an over-simplification, but it captures the essence of the solution, and all that essentially remains is lots of fiddling about to ensure the non-client area gets redrawn at the the right times to stay synchronized with the client area.

Embedding .RC control definition data directly in a .cpp file to break the dependency on binary resources (a.k.a. 'Runtime Dialogs').

This is an idea that has been floating about for quite some time and which has only recently gelled into a workable solution.

The problem, put simply, is that if you want to take advantage of the resource editor in Visual Studio (and who doesn't), then you very quickly find yourself stuck with having to load dialog templates from resources compiled into the binary file.

This further means that if you want to make use of a dialog across multiple projects, then either you need to copy and paste the dialog template between project .RC files, or you need to build the dialog into a DLL from which it can be accessed.

'Runtime Dialogs' (a snappy title I coined myself) is a solution that neatly sidesteps both the nuisance of copying dialog resources between resource files and the extra work (and maintenance) involved in packaging dialogs in DLLs.

And it works like this:

First, you design your dialog template in the resource editor, create a CDialog derived class using class wizard, and wire up all the controls just as you normally would.

Next, you #include "runtimedlg.h" and change all instances of CDialog to CRuntimeDlg.

Then, you cut and paste the control definition section from the appropriate section in the .RC file and embed it directly in the dialog's .cpp file as a static string (with a bit of tweaking to handle double quotes and such like).

Finally, in the constructor of your dialog, you simply call CRuntimeDlg::AddRCControls(...) passing the control definitions as a string.

And CRuntimeDlg takes care of the rest including, if required, auto-sizing the dialog to suit the control layout.

I'm certainly not suggesting that this is a 'win-win' solution for all situations but it certainly has merits in its closer coupling of dialog template to dialog code which makes sharing dialogs across multiple projects a breeze.

P.S.: In case it's not clear here, I used CRuntimeDlg to create CToDoCtrl which encapsulates the ordered tree together with the priority, date and comments controls as a single simple-to-instantiate control.

This is possibly the most satisfying aspect of the whole project because it was completely unexpected.

What I mean is that, until recently, my knowledge of DOM and XMLDOM was virtually non-existent, as it's only since I've become more interested in the presentation of AbstractSpoon that I've been forced to get to grips with the various implementations of DOM and XMLDOM out there.

I'm pleased to say that the code on my site works under IE 6.0, Netscape 7.1, and Mozilla, although custom code was required to achieve this.

Generic MFC Classes that may prove Useful to You

The following table lists a wide range of utility classes written for this project. They can all be included in any MFC project provided you include any class dependencies too. Feel free to ask any questions relating to these specific classes and how to use them.

Adds support for recognizing urls, clicking them and setting custom url callbacks

CWinClasses

Encapsulates the ::GetClassName Win32 functions

CXmlFile, CXmlItem

Non-Unicode class for reading and writing xml files

CXmlFileEx

Adds encryption capabilities to CXmlFile

CXmlFile, IEncryption

* CSubclassWnd was originally written by Paul DiLascia for MSJ magazine. The version I use has been heavily extended to suit my specific needs. The classes that depend on it here need this extended version.

Further Work

Whilst this tool was originally intended for my personal use only, it is now a 'community' project, so if you find it useful and want to make suggestions for enhancements or bug fixes, then post below.

History

7.1.4 (26 Aug 2017)

Fixed filter selection when names contain brackets

Fixed HTML exporting of '&', '<', '>'

Fixed application window resizing on startup

Fixed file encoding of 'Transformed' tasklists when auto-exporting after saving

I am surprised that a link on same drive but diff directory is relative too.
Is it on purpose?

Possible improvement: if the only common thing with TaskList is the Drive letter, just hiding the drive letter in link is shorter than relative link.
Example:
TaskList is D:\TaskDir\MyTaskList.tdl
linked File is D:\MyPDF\MyScan.pdf
actual link is ..\MyPDF\MyScan.pdf
improved link could be \MyPDF\MyScan.pdf

My real list is 3 directories level deep and lead to ..\..\..\MyPDF\MyScan.pdf

Patrice

“Everything should be made as simple as possible, but no simpler.” Albert Einstein

No it can't because \MyPDF is not a subfolder of D:\TaskDir...\ means 'go to the parent of the folder you are currently in'.
So, using your example of the 'current' folder as D:\TaskDir\ and the file as D:\MyPDF\MyScan.pdf you must first exit out of \TaskDir to D:\ before you can then go into \MyPDF.

If I store the file links in D:\TaskDir\LinkDir\
there is 3 ways to write a link:
- Completely Absolute: D:\TaskDir\LinkDir\MyFile.pdf
- Same disk Absolute: \TaskDir\LinkDir\MyFile.pdf
- relative: .\LinkDir\MyFile.pdf or even LinkDir\MyFile.pdf

If my file link is in D:\MyPDF\
there is also 3 ways to write a link
- Completely Absolute: D:\MyPDF\MyScan.pdf
- Same disk Absolute: \MyPDF\MyScan.pdf
- relative: ..\MyPDF\MyScan.pdf

The 3 writing are exactly the same.
But since the .. is jumping to the root, the "Same Disk Absolute" became shorter than relative.

Patrice

“Everything should be made as simple as possible, but no simpler.” Albert Einstein

Dan and I have a lot of daily exchanges about enhancements to the ecosystem being built around ToDoList. Other people have also become involved in the GitHub repositories for Issues, Resources, and the Wiki[^].

I won't go into detail about what's happening. Stay tuned for announcements. In summary we're trying to make ToDoList and related information accessible to more people while giving Dan better control over feedback analysis and resolution. We want people to be able to provide feedback in the most convenient way for the individual, but without diluting the value of this CodeProject resource - that's very important.

A problem with getting more feedback is that comments get chatty and unfocused, making it tough for Dan to get to the heart of the issue. As we add more vectors for feedback we're trying to ensure that we don't increase the burden on Dan to get the info he needs from each of those vectors. To help, when reporting issues or requesting feedback, no matter what site or method you're using, please follow the guidelines[^]. A version[^] of that is also available via a link at the top of every new Issue report.

My primary responsibility is with the wiki. It's still in active development, less aggressive than over the last couple weeks. You will notice a lot of material there but a lot is not there. Don't worry, it's not forgotten, it will get filled in, it just takes time.

I'm going to be on a trip for the next week or so, and my efforts will be reduced. But we're moving forward with a lot of good things. Your patience, feedback, and support are most welcome.

Discussions about the new ecosystem are welcome here and in the Google Group. The idea is to facilitate exchanges by users wherever they prefer. This CodeProject page remains the home and technical discussions are preferred here. Issues and feature requests will be gathered from all sources and centralized at GitHub.

I don't know how it's setup but it sounds like it could easily be used as a UDT:

command.exe "$(pathName)$(fileName)" $(selTID)

OR to add the file reference directly rather than requiring a parse through the .tdl file:

command.exe "$(pathName)$(fileName)" $(selTFile)

Unfortunately $(selTFile) doesn't support multiple files yet[^]. The reference to the .tdl file is required because File Links are relative to the .tdl file, so that path needs to be used to derive absolute path of the File Link - this is referenced in the _Issues ticket.

I could add this functionality to my UDT if there is any demand. I'm happy to enhance the UDT, I just don't know what people want in there.

I'm ready to release now, just waiting on Tony so we can synchronise our efforts.

It's no big deal really since I've already fixed the worst of the problems that 7.0 introduced, so it can always wait for a subsequent bug-fix release. All that matters is that we keep that particular ball rolling.

This is because it works with a simple text-search without any XML-logic.

ppolymorphe wrote:

What about using the flag field to indicate which task have a dead link ?

I think the best improvement is to integrate the feature (not the entire tool) into TDL - it could be done as a filter ("Show broken links") or with flags or with coloured task or ...
The effect of the current, external analysis it that the file stays unmodified - sometimes as an advantage, sometimes as a disadvantage.