共用方式為


CMFCTasksPane Class

This topic is included for completeness. For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.

The CMFCTasksPane class implements a list of clickable items (tasks).

class CMFCTasksPane : public CDockablePane

Members

Public Constructors

Name

Description

CMFCTasksPane::CMFCTasksPane

Constructs a CMFCTasksPane object.

Public Methods

Name

Description

CMFCTasksPane::AddGroup

Adds a new group of tasks to the task pane control.

CMFCTasksPane::AddLabel

Adds a new static label into the specified task group.

CMFCTasksPane::AddMRUFilesList

Adds tasks specified by a Most Recently Used (MRU) file list into a group.

CMFCTasksPane::AddPage

Adds a new page to the task pane.

CMFCTasksPane::AddSeparator

 

CMFCTasksPane::AddTask

Adds a new task to the specified task group.

CMFCTasksPane::AddWindow

Adds a child window to the task pane.

CMFCTasksPane::CollapseAllGroups

 

CMFCTasksPane::CollapseGroup

Programmatically collapses a group.

CMFCTasksPane::CreateDefaultMiniframe

  (Overrides CPane::CreateDefaultMiniframe.)

CMFCTasksPane::CreateMenu

Called by the framework to create a menu for the Other Tasks Panes menu button.

CMFCTasksPane::EnableAnimation

Enables or disables animation while collapsing or expanding task groups.

CMFCTasksPane::EnableGroupCollapse

Specifies whether tasks groups can be collapsed.

CMFCTasksPane::EnableHistoryMenuButtons

Enables or disables drop-down menus in Next and Previous navigation buttons.

CMFCTasksPane::EnableNavigationToolbar

Enables or disables the navigation toolbar.

CMFCTasksPane::EnableOffsetCustomControls

 

CMFCTasksPane::EnableScrollButtons

Enables scroll buttons instead of a scrollbar.

CMFCTasksPane::EnableWrapLabels

Enables or disables word wrapping for labels.

CMFCTasksPane::EnableWrapTasks

Enables or disables word wrapping for tasks.

CMFCTasksPane::GetActivePage

Returns the zero-based index for the active page.

CMFCTasksPane::GetGroupCaptionHeight

Returns the height of the group captions.

CMFCTasksPane::GetGroupCaptionHorzOffset

Returns the current offset of a group caption from the left and right edges of the task pane.

CMFCTasksPane::GetGroupCaptionVertOffset

Returns the current offset of a group caption from the top and bottom edges of the task pane.

CMFCTasksPane::GetGroupCount

Returns the total number of groups.

CMFCTasksPane::GetGroupLocation

Returns the internal group index for a given group.

CMFCTasksPane::GetGroupVertOffset

Returns the vertical offset of a group.

CMFCTasksPane::GetHorzMargin

Returns the horizontal spacing between a task pane and the edges of the client area.

CMFCTasksPane::GetNextPages

 

CMFCTasksPane::GetPageByGroup

Retrieves the page index for a specified group.

CMFCTasksPane::GetPagesCount

Returns the number of pages.

CMFCTasksPane::GetPreviousPages

 

CMFCTasksPane::GetScrollBarCtrl

  (Overrides CWnd::GetScrollBarCtrl.)

CMFCTasksPane::GetTask

Retrieves a task.

CMFCTasksPane::GetTaskCount

Returns the number of task items in a specified group.

CMFCTasksPane::GetTaskGroup

Returns a task group for a given group index.

CMFCTasksPane::GetTaskLocation

Returns the group and the index for a given task.

CMFCTasksPane::GetTasksHorzOffset

Returns the horizontal offset of tasks from the left and right edges of their parent groups.

CMFCTasksPane::GetTasksIconHorzOffset

 

CMFCTasksPane::GetTasksIconVertOffset

 

CMFCTasksPane::GetVertMargin

Returns the vertical spacing between a task pane and the edges of the client area.

CMFCTasksPane::IsAccessibilityCompatible

  (Overrides CDockablePane::IsAccessibilityCompatible.)

CMFCTasksPane::IsAnimationEnabled

Indicates whether animation is enabled.

CMFCTasksPane::IsBackButtonEnabled

Indicates whether the back button is enabled.

CMFCTasksPane::IsForwardButtonEnabled

Indicates whether the forward button is enabled.

CMFCTasksPane::IsGroupCollapseEnabled

 

CMFCTasksPane::IsHistoryMenuButtonsEnabled

Indicates whether the Next and Previous navigation buttons have drop-down menus.

CMFCTasksPane::IsNavigationToolbarEnabled

Indicates whether the navigation toolbar is enabled.

CMFCTasksPane::IsToolBox

 

CMFCTasksPane::IsWrapLabelsEnabled

Indicates whether the task pane wraps words in labels.

CMFCTasksPane::IsWrapTasksEnabled

Indicates whether the task pane wraps words in tasks.

CMFCTasksPane::LoadState

  (Overrides CDockablePane::LoadState.)

CMFCTasksPane::OnCancel

 

CMFCTasksPane::OnClickTask

Called by the framework when the user clicks an item in the task pane.

CMFCTasksPane::OnOK

 

CMFCTasksPane::OnPressBackButton

Called by the framework when the user clicks the back button.

CMFCTasksPane::OnPressForwardButton

Called by the framework when the user clicks the forward navigation button.

CMFCTasksPane::OnPressHomeButton

Called by the framework when the user clicks the home navigation button

CMFCTasksPane::OnPressOtherButton

 

CMFCTasksPane::OnSetAccData

  (Overrides CBasePane::OnSetAccData.)

CMFCTasksPane::OnUpdateCmdUI

  (Overrides CDockablePane::OnUpdateCmdUI.)

CMFCTasksPane::PreTranslateMessage

  (Overrides CDockablePane::PreTranslateMessage.)

CMFCTasksPane::RecalcLayout

  (Overrides CPane::RecalcLayout.)

CMFCTasksPane::RemoveAllGroups

Removes all groups on the specified page.

CMFCTasksPane::RemoveAllPages

Removes all pages from the task pane except the default (first) page.

CMFCTasksPane::RemoveAllTasks

Removes all tasks from the group.

CMFCTasksPane::RemoveGroup

Removes a group.

CMFCTasksPane::RemovePage

Removes a specified page from the task pane.

CMFCTasksPane::RemoveTask

Removes a task from a task group.

CMFCTasksPane::SaveState

  (Overrides CDockablePane::SaveState.)

CMFCTasksPane::Serialize

  (Overrides CDockablePane::Serialize.)

CMFCTasksPane::SetActivePage

Activates a specified page in the task pane.

CMFCTasksPane::SetCaption

Sets the caption name of a task pane.

CMFCTasksPane::SetGroupCaptionHeight

Sets the height of a group caption.

CMFCTasksPane::SetGroupCaptionHorzOffset

Sets the horizontal offset of a group caption.

CMFCTasksPane::SetGroupCaptionVertOffset

Sets the vertical offset of a group caption.

CMFCTasksPane::SetGroupName

Sets a group name.

CMFCTasksPane::SetGroupTextColor

Sets the text color for a group caption.

CMFCTasksPane::SetGroupVertOffset

Sets the vertical offset for a group.

CMFCTasksPane::SetHorzMargin

Sets the horizontal spacing between a task pane and the edges of the client area.

CMFCTasksPane::SetIconsList

Sets the image list associated with tasks.

CMFCTasksPane::SetPageCaption

Sets the caption text for a task pane page.

CMFCTasksPane::SetTaskName

Sets the name for a task.

CMFCTasksPane::SetTasksIconHorzOffset

 

CMFCTasksPane::SetTasksIconVertOffset

 

CMFCTasksPane::SetTaskTextColor

Sets the text color for a task.

CMFCTasksPane::SetTasksHorzOffset

Sets the horizontal offset of tasks from the left and right edges of their parent groups.

CMFCTasksPane::SetVertMargin

Sets the vertical spacing between a task pane and the edges of the client area.

CMFCTasksPane::SetWindowHeight

Sets the height for a window.

CMFCTasksPane::ShowCommandMessageString

 

CMFCTasksPane::ShowTask

Shows or hides a task.

CMFCTasksPane::ShowTaskByCmdId

Shows or hides a task based on its command ID.

CMFCTasksPane::Update

Updates the GUI elements that belong to a task pane.

Protected Methods

Name

Description

CMFCTasksPane::OnActivateTasksPanePage

Called by the framework when a new task pane page is activated.

Remarks

The CMFCTasksPane class implements the following functionality:

  • Items can be grouped and each item grouping can have an associated caption.

  • Item groupings can be collapsed or expanded.

  • An icon can be assigned to each item in the task pane.

  • Individual items can be associated with a command ID which executes when a user clicks the item. When the click occurs, the WM_COMMAND message is sent to the owner of the task pane control.

To use the CMFCTasksPane control in your application, follow these steps:

  1. Embed a CMFCTasksPane object into the main frame window class.

  2. When processing the WM_CREATE message, call the Create method. You can use the regular CControlBar styles. For more information, see CControlBar::Create.

  3. Call the CMFCTasksPane::AddGroup method to add various groups.

  4. Call the CMFCTasksPane::AddTask, CMFCTasksPane::AddLabel or CMFCTasksPane::AddMRUFilesList member functions to add new items (tasks) to each group.

  5. Call CMFCTasksPane::EnableGroupCollapse to specify whether item groups can collapse.

The following illustration shows a typical task pane control. The first group is a special group and its caption is a darker color. The third group is collapsed. The last group is aligned to the bottom of the task pane and has no caption, and the last task in the group is a simple label:

Example of Task Pane

You can customize the appearance of the task pane by adjusting various margins and offsets. The following illustration clarifies the meaning of these variables:

Custom task group

Example

The following example demonstrates how to construct a CMFCTasksPane object and use various methods in the CMFCTasksPane class. The example shows how to enable the collapsing of task groups, enable the drop-down menus on the Next and Previous navigation buttons, enable the scroll buttons instead of a scroll bar, enable the word wrapping for the text in labels, set the caption name of the task pane, set the text color for a group caption, and set the horizontal and vertical margins.

   CMFCTasksPane* tPane = new CMFCTasksPane();
    tPane->EnableGroupCollapse(true);
    tPane->EnableHistoryMenuButtons(true);
    tPane->EnableScrollButtons(true);
    tPane->EnableWrapLabels(true);
    tPane->SetCaption(_T("Task Pane"));
    tPane->SetGroupTextColor(0,RGB(0,0,128));
    tPane->SetHorzMargin(15);
    tPane->SetVertMargin(15);
    tPane->Update();

Inheritance Hierarchy

CObject   CCmdTarget      CWnd

         CBasePane            CPane               CDockablePane

                  CMFCTasksPane

Requirements

Header: afxTasksPane.h

See Also

Reference

Hierarchy Chart

CMFCTasksPaneTaskGroup Class

CMFCTasksPaneTask Class

CMFCOutlookBar Class

CMFCVisualManager Class

Other Resources

MFC Classes