Global Question about TDL icons

Feb 24, 2014 at 10:31 AM

First thank you for your job. Not yet used because not enough time, but I hope soon !

But I try to think on how I could use your library.
And I'm wondering if you are able to take over the icons of todolist?

Let me explain:


I have a TDL file with some custom columns with icons
In the XML, there is the icon ID, but not the icon itself.

Initially I would like to transfer a TDL file or part of a tdl file in Excel, in order to transform the TDL file in a dashboard that I can present and share to others.

But I would like to take over icons
Previously with the CSV export , it was not possible (and manual) so not a solution for me.

With your library, it would be great to create a VSTO application (or a basic C# program wich create a xlsx/xlsm file) which take over the TDL file and transform it in an excel dashboard. But I need to take over the icons... :)
Feb 24, 2014 at 10:10 PM
Thanks for your interest. I understand what you're saying. It helps to understand the icons so that we can process them.

The icon indexes are 1-based offsets into the strip of icons in file "task_icons.std.bmp". So if you have a task with ICONINDEX "100", you'll see that it's a "link" symbol, and that it's the last icon in that bmp, at index=100. The folder icon is defaulted for tasks with nested tasks.

Custom columns (node CUSTOMATTRIB) can have a limited set of icons identified in the LISTDATA attribute. So we might see LISTDATA="1:\n2:". The \n is a carriage return embedded in the attribute to delimit the icon values. Again, that indexes into the bmp file and that list would be limited to the green check and plus symbols. Corresponding to this, a TASK with a CUSTOMATTRIB related to the icon list will have a VALUE with one of those values, or for example, VALUE="2".

So, to make this work, the ToDoListLib needs to understand how custom columns are defined, and then how tasks refer to the values. And indeed it does.
  • The SafeTaskList object has a collection property called CustomAttributes of type List<CustomAttribute>.
  • One of the properties of CustomAttribute is AttributeType which is a struct.
  • When AttributeType.DataType = CustomAttributeDataType.Icon, the property CustomAttribute.IconIDs has a List<int> of the IDs.
  • There is not yet any code in place that translates those IDs to a Bitmap but this will be added. (Perhaps someone will volunteer this code?)
  • The SafeTask object also has a CustomAttributes collection where only the ID and Value fields are valid.
  • The ID is a reference back to the tasklist CustomAttributes, and this ID must be present in that list.
  • A CustomAttribute doesn't inherently have a reference to the SafeTaskList parent of the containing SafeTask. (I might enhance this later.) So for now, to find out if a custom attribute in a task represents an icon, we can do this:
    bool isAnIcon = mytask.CustomAttributes[n].UsingTasklist(mylist).IsIcon;
  • To verify that an icon is valid:
    bool isValidIcon = mytask.CustomAttributes[n].UsingTasklist(mylist).IconIsValid;
    So in the above example, where the LISTDATA has values 1 and 2, we can easily check to ensure a task has an icon attribute, and that the attribute has a valid value of 1 or 2.
  • Finally, to actually get a Bitmap object for a task we have task.CustomAttribute.IconBitmap, which is of type Bitmap. But again, this code has not yet been implemented. The property is a stub that will use (Value-1)*16 (I think) to get a 16 pixel icon from the BMP file.
When all of this is fully implemented the above will go into the documentation page. Because it's not complete I don't have it on the doc pages yet.

Now, if you're using this with VSTO, you'll either need to embed the Bitmap into a rich text field, or you'll need to save the icon to disk and reference it with a link. I haven't looked into that side of it. But at this point you can create a VSTO or other Automation project where you start with a Bitmap, and either embed that into an Office document or save it and then reference it. When you have the library available to pull this data from tasks, you'll be able to integrate the two together very easily.

What do you think?
Sep 8, 2014 at 6:50 AM
Follow-up, the code is complete to convert the Icon ID to an actual Bitmap object. It's usage is profiled in a sample application in the library. You should be able to use this easily in VSTO or any other project.

This should all be released sometime around the same time that TDL v6.9 is released to production.
Sep 8, 2014 at 10:26 AM
Impressive. You are building a very interesting API.. Hope some users will try it. The best wayd to help them would be to provide several samples if possible(i know you have done it yet) In my case i don t develop anymore in .net Since 4 years, So difficult
currently to find time and energy for this. Have a good day