Skip to content

Commit 577b4d0

Browse files
authored
Clean up redundant relative links in "Walkthrough: Putting Controls On Toolbars"
1 parent a5d8881 commit 577b4d0

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

docs/mfc/walkthrough-putting-controls-on-toolbars.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.assetid: 8fc94bdf-0da7-45d9-8bc4-52b7b1edf205
77
---
88
# Walkthrough: Putting Controls On Toolbars
99

10-
This article describes how to add a toolbar button that contains a Windows control to a toolbar. In MFC, a toolbar button must be a [`CMFCToolBarButton` Class](../mfc/reference/cmfctoolbarbutton-class.md)-derived class, for example [`CMFCToolBarComboBoxButton` Class](../mfc/reference/cmfctoolbarcomboboxbutton-class.md), [`CMFCToolBarEditBoxButton` Class](../mfc/reference/cmfctoolbareditboxbutton-class.md), [`CMFCDropDownToolbarButton` Class](../mfc/reference/cmfcdropdowntoolbarbutton-class.md), or [`CMFCToolBarMenuButton` Class](../mfc/reference/cmfctoolbarmenubutton-class.md).
10+
This article describes how to add a toolbar button that contains a Windows control to a toolbar. In MFC, a toolbar button must be a [`CMFCToolBarButton` Class](reference/cmfctoolbarbutton-class.md)-derived class, for example [`CMFCToolBarComboBoxButton` Class](reference/cmfctoolbarcomboboxbutton-class.md), [`CMFCToolBarEditBoxButton` Class](reference/cmfctoolbareditboxbutton-class.md), [`CMFCDropDownToolbarButton` Class](reference/cmfcdropdowntoolbarbutton-class.md), or [`CMFCToolBarMenuButton` Class](reference/cmfctoolbarmenubutton-class.md).
1111

1212
## Adding Controls to Toolbars
1313

@@ -21,7 +21,7 @@ To add a control to a toolbar, follow these steps:
2121

2222
1. Construct the button control by using a `CMFCToolbarButton`-derived class.
2323

24-
1. Replace the dummy button with the new control by using [`CMFCToolBar::ReplaceButton`](../mfc/reference/cmfctoolbar-class.md#replacebutton). You can construct the button object on the stack, because `ReplaceButton` copies the button object and maintains the copy.
24+
1. Replace the dummy button with the new control by using [`CMFCToolBar::ReplaceButton`](reference/cmfctoolbar-class.md#replacebutton). You can construct the button object on the stack, because `ReplaceButton` copies the button object and maintains the copy.
2525

2626
> [!NOTE]
2727
> If you enabled customization in your application, you may have to reset the toolbar by using the **Reset** button on the **Toolbars** tab of the **Customize** dialog box to see the updated control in your application after recompiling. The toolbar state is saved in the Windows registry, and the registry information is loaded and applied after the `ReplaceButton` method is executed during application startup.
@@ -30,11 +30,11 @@ To add a control to a toolbar, follow these steps:
3030

3131
The **Commands** tab of the **Customize** dialog box contains a list of commands that are available in the application. By default, the **Customize** dialog box processes the application menus and builds a list of standard toolbar buttons in each menu category. To keep the extended functionality that the toolbar controls provide, you must replace the standard toolbar button with the custom control in the **Customize** dialog box.
3232

33-
When you enable customization, you create the **Customize** dialog box in the customization handler `OnViewCustomize` by using the [`CMFCToolBarsCustomizeDialog` Class](../mfc/reference/cmfctoolbarscustomizedialog-class.md) class. Before you display the **Customize** dialog box by calling [`CMFCToolBarsCustomizeDialog::Create`](../mfc/reference/cmfctoolbarscustomizedialog-class.md#create), call [`CMFCToolBarsCustomizeDialog::ReplaceButton`](../mfc/reference/cmfctoolbarscustomizedialog-class.md#replacebutton) to replace the standard button with the new control.
33+
When you enable customization, you create the **Customize** dialog box in the customization handler `OnViewCustomize` by using the [`CMFCToolBarsCustomizeDialog` Class](reference/cmfctoolbarscustomizedialog-class.md) class. Before you display the **Customize** dialog box by calling [`CMFCToolBarsCustomizeDialog::Create`](reference/cmfctoolbarscustomizedialog-class.md#create), call [`CMFCToolBarsCustomizeDialog::ReplaceButton`](reference/cmfctoolbarscustomizedialog-class.md#replacebutton) to replace the standard button with the new control.
3434

3535
## Example: Creating a Find Combo Box
3636

37-
This section describes how to create a **Find** combo box control that appears on a toolbar and contains recent-used search strings. The user can type a string in the control and then press the enter key to search a document, or press the escape key to return the focus to the main frame. This example assumes that the document is displayed in a [`CEditView` Class](../mfc/reference/ceditview-class.md)-derived view.
37+
This section describes how to create a **Find** combo box control that appears on a toolbar and contains recent-used search strings. The user can type a string in the control and then press the enter key to search a document, or press the escape key to return the focus to the main frame. This example assumes that the document is displayed in a [`CEditView` Class](reference/ceditview-class.md)-derived view.
3838

3939
### Creating the Find Control
4040

@@ -51,27 +51,27 @@ First, create the **Find** combo box control:
5151
> [!NOTE]
5252
> Because `ID_EDIT_FIND` is a standard command that is processed by `CEditView`, you are not required to implement a special handler for this command. However, you must implement a handler for the new command `ID_EDIT_FIND_COMBO`.
5353
54-
1. Create a new class, `CFindComboBox`, derived from [`CComboBox` Class](../mfc/reference/ccombobox-class.md).
54+
1. Create a new class, `CFindComboBox`, derived from [`CComboBox` Class](reference/ccombobox-class.md).
5555

5656
1. In the `CFindComboBox` class, override the `PreTranslateMessage` virtual method. This method will enable the combo box to process the [`WM_KEYDOWN`](/windows/win32/inputdev/wm-keydown) message. If the user hits the escape key (`VK_ESCAPE`), return the focus to the main frame window. If the user hits the Enter key (`VK_ENTER`), post to the main frame window a `WM_COMMAND` message that contains the `ID_EDIT_FIND_COMBO` command ID.
5757

58-
1. Create a class for the **Find** combo box button, derived from [`CMFCToolBarComboBoxButton` Class](../mfc/reference/cmfctoolbarcomboboxbutton-class.md). In this example, it's named `CFindComboButton`.
58+
1. Create a class for the **Find** combo box button, derived from [`CMFCToolBarComboBoxButton` Class](reference/cmfctoolbarcomboboxbutton-class.md). In this example, it's named `CFindComboButton`.
5959

6060
1. The constructor of `CMFCToolbarComboBoxButton` takes three parameters: the command ID of the button, the button image index, and the style of the combo box. Set these parameters as follows:
6161

6262
1. Pass the `ID_EDIT_FIND_COMBO` as the command ID.
6363

6464
1. Use [`CCommandManager::GetCmdImage`](reference/internal-classes.md) with `ID_EDIT_FIND` to get the image index.
6565

66-
1. For a list of available combo box styles, see [Combo-Box Styles](../mfc/reference/styles-used-by-mfc.md#combo-box-styles).
66+
1. For a list of available combo box styles, see [Combo-Box Styles](reference/styles-used-by-mfc.md#combo-box-styles).
6767

6868
1. In the `CFindComboButton` class, override the `CMFCToolbarComboBoxButton::CreateCombo` method. Here you should create the `CFindComboButton` object and return a pointer to it.
6969

70-
1. Use the [`IMPLEMENT_SERIAL`](../mfc/reference/run-time-object-model-services.md#implement_serial) macro to make the combo button persistent. The workspace manager automatically loads and saves the button's state in the Windows registry.
70+
1. Use the [`IMPLEMENT_SERIAL`](reference/run-time-object-model-services.md#implement_serial) macro to make the combo button persistent. The workspace manager automatically loads and saves the button's state in the Windows registry.
7171

72-
1. Implement the `ID_EDIT_FIND_COMBO` handler in your document view. Use [`CMFCToolBar::GetCommandButtons`](../mfc/reference/cmfctoolbar-class.md#getcommandbuttons) with `ID_EDIT_FIND_COMBO` to retrieve all **Find** combo box buttons. There can be several copies of a button with the same command ID because of customization.
72+
1. Implement the `ID_EDIT_FIND_COMBO` handler in your document view. Use [`CMFCToolBar::GetCommandButtons`](reference/cmfctoolbar-class.md#getcommandbuttons) with `ID_EDIT_FIND_COMBO` to retrieve all **Find** combo box buttons. There can be several copies of a button with the same command ID because of customization.
7373

74-
1. In the `ID_EDIT_FIND` message handler `OnFind`, use [`CMFCToolBar::IsLastCommandFromButton`](../mfc/reference/cmfctoolbar-class.md#islastcommandfrombutton) to determine whether the find command was sent from the **Find** combo box button. If so, find the text and add the search string to the combo box.
74+
1. In the `ID_EDIT_FIND` message handler `OnFind`, use [`CMFCToolBar::IsLastCommandFromButton`](reference/cmfctoolbar-class.md#islastcommandfrombutton) to determine whether the find command was sent from the **Find** combo box button. If so, find the text and add the search string to the combo box.
7575

7676
### Adding the Find Control to the Main Toolbar
7777

@@ -82,20 +82,20 @@ To add the combo box button to the toolbar, follow these steps:
8282
> [!NOTE]
8383
> The framework sends this message to the main frame window when a toolbar is initialized during application startup, or when a toolbar is reset during customization. In either case, you must replace the standard toolbar button with the custom **Find** combo box button.
8484
85-
1. In the `AFX_WM_RESETTOOLBAR` handler, examine the toolbar ID, that is, the *`WPARAM`* of the `AFX_WM_RESETTOOLBAR` message. If the toolbar ID is equal to that of the toolbar that contains the **Find** combo box button, call [`CMFCToolBar::ReplaceButton`](../mfc/reference/cmfctoolbar-class.md#replacebutton) to replace the **Find** button (that is, the button with the command ID `ID_EDIT_FIND`) with a `CFindComboButton` object.
85+
1. In the `AFX_WM_RESETTOOLBAR` handler, examine the toolbar ID, that is, the *`WPARAM`* of the `AFX_WM_RESETTOOLBAR` message. If the toolbar ID is equal to that of the toolbar that contains the **Find** combo box button, call [`CMFCToolBar::ReplaceButton`](reference/cmfctoolbar-class.md#replacebutton) to replace the **Find** button (that is, the button with the command ID `ID_EDIT_FIND`) with a `CFindComboButton` object.
8686

8787
> [!NOTE]
8888
> You can construct a `CFindComboBox` object on the stack, because `ReplaceButton` copies the button object and maintains the copy.
8989
9090
### Adding the Find Control to the Customize Dialog Box
9191

92-
In the customization handler `OnViewCustomize`, call [`CMFCToolBarsCustomizeDialog::ReplaceButton`](../mfc/reference/cmfctoolbarscustomizedialog-class.md#replacebutton) to replace the **Find** button (that is, the button with the command ID `ID_EDIT_FIND`) with a `CFindComboButton` object.
92+
In the customization handler `OnViewCustomize`, call [`CMFCToolBarsCustomizeDialog::ReplaceButton`](reference/cmfctoolbarscustomizedialog-class.md#replacebutton) to replace the **Find** button (that is, the button with the command ID `ID_EDIT_FIND`) with a `CFindComboButton` object.
9393

9494
## See also
9595

96-
[Hierarchy Chart](../mfc/hierarchy-chart.md)\
97-
[Classes](../mfc/reference/mfc-classes.md)\
98-
[`CMFCToolBar` Class](../mfc/reference/cmfctoolbar-class.md)\
99-
[`CMFCToolBarButton` Class](../mfc/reference/cmfctoolbarbutton-class.md)\
100-
[`CMFCToolBarComboBoxButton` Class](../mfc/reference/cmfctoolbarcomboboxbutton-class.md)\
101-
[`CMFCToolBarsCustomizeDialog` Class](../mfc/reference/cmfctoolbarscustomizedialog-class.md)
96+
[Hierarchy Chart](hierarchy-chart.md)\
97+
[Classes](reference/mfc-classes.md)\
98+
[`CMFCToolBar` Class](reference/cmfctoolbar-class.md)\
99+
[`CMFCToolBarButton` Class](reference/cmfctoolbarbutton-class.md)\
100+
[`CMFCToolBarComboBoxButton` Class](reference/cmfctoolbarcomboboxbutton-class.md)\
101+
[`CMFCToolBarsCustomizeDialog` Class](reference/cmfctoolbarscustomizedialog-class.md)

0 commit comments

Comments
 (0)