>I can programmatically add a task item to the Task List. The item has both
>the file and the line number. However, when I double click on the task item
>in the Task List window, nothing happens. What do I need to do to get the
>file to be display when one double clicks on the task item?
Gary,
I tried calling the task item's Navigate. However, it does not seem like
this method is implemented. I'm using Visual Studio .NET 2003.
Here is the snippet on how I add the task item.
TaskList taskList =
(TaskList)_appDTE.Windows.Item(Constants.vsWindowKindTaskList).Object;
TaskItem item = taskList.TaskItems.Add("category", "", "description",
vsTaskPriority.vsTaskPriorityMedium,
vsTaskIcon.vsTaskIconComment, true, "file", lineNum,
true, true);
File has the full path name to a file in the project. Also, the above code
is called from a wizard.
Thanks,
Peter.
> Hi Peter,
>
[quoted text clipped - 26 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Gary Chang[MSFT] - 19 Mar 2005 10:23 GMT
Hi Peter,
I found the exact problem of this issue, the tasklist item you added
programmatically is unable to navigate the caret to the source code line
you specified, please refer to the following paragraph which digested from
the <<Inside Microsoft Visual Studio .NET 2003>> (By Brian Johnson, Craig
Skibo)
The Task List Window /Chapter 10. Programming the User Interface
File and Line
File and Line are a string and integer, respectively, that fill out the
File and Line columns of the Task List. These can contain any values you
want --- they're not used in any way other than for information to display
within the Task List. If the user later performs the default action on the
task (either double-clicking or pressing the Enter key when the task item
is selected), the file won't open and the caret won't be placed on the line
specified in the Line argument. This is because the object model makes no
assumptions about the data in the file; if the file points to a binary
file, opening and placing the caret on a line might not do what you expect;
rather than do something that might be incorrect, it does nothing. However,
you can still connect an event handler onto the task item that was created,
watch for a TaskNavigate event (discussed later), and then manually open
the file using code.
Wish this helps!
Best regards,
Gary Chang
Microsoft Community Support
--------------------
Get Secure! ??C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn
This posting is provided "AS IS" with no warranties, and confers no rights.