Tasks are clickable text items that sit in the Tasks panel in the WMC. They are placed into groups and have a lifetime that's controllable by the component that created them.
Adding tasks
Tasks stay visible until they are removed with NavDeleteItem so you can create permanent task items (Like the Submit feedback task above) by not deleting the task and its group. Typically however, you want to add them when your panel becomes active and delete them when the panel is deactivated. See Tree items and panels for information of handling (de)activation events.
...
Info |
---|
The NavItemHelpers code in sdk\helpers has more convenient ways to manage tasks |
Removing tasks
To remove a task simply call NavDeleteItem with the FQN or alias of the task you wish to delete.
Changing tasks
If you wish to change a task item's properties (label, description etc) you can do so with NavSetItem or NavSetItemEx
Code Block |
---|
NAVSETITEM newItemProperties; newItemProperties.mask = NI_MASK_LABEL | NI_MASK_DESCRIPTION; newItemProperties.strLabel = L"New Label"; newItemProperties.strDescription = L"New Description"; NavSetItem(aliasOrFQNOfTaskToChange, &newItemProperties); |
Responding to task activation
In order to respond to user task selection you need to create the task with the NI_EVENT_MOUSE_LCLICK mask bit set in the EventMask field and you need to provide a NavigationItemUIInterface pointer that has a NavItemNotify function. When a user clicks a task then the framework calls your NavItemNotify function with the message value NI_EVENT_MOUSE_LCLICK.
...