Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Edit User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

7.5 STEP 3 - Add Additional User Interface Support

At this point, we have developed a skeleton 1stEdit application and added syntax highlighting support. In the last part of this tutorial, we create additional user interface support. This section is divided into five smaller procedures, which are covered in each of the following five sections.

Objective Edit has handlers for many common user interface interactions, such as Undo/Redo, Find/Replace, Cut/Copy/Paste, and Bookmark operations. Some of these, such as Cut/Copy/Paste, are added to every AppWizard-generated application. You can easily add the rest.

7.5.1 Create a New Toolbar

New toolbars are a frequently requested feature of user interfaces. To create a new toolbar and add it to 1stEdit, follow these steps:

  1. Click on the Resource View tab. Right-click the toolbar folder, and select Insert Toolbar. Name the toolbar IDR_TOOLBAR_EDIT.

  2. Add buttons to the toolbar, as shown in Figure 30. Most of these bitmaps are available in the DockTool sample that ships with Visual C++.

    Figure 30: Adding new toolbar buttons to 1stEdit

  3. Give the buttons the following IDs:

    You do not need to add a prompt to these IDs.

7.5.2 Incorporate the Toolbar into the Project

The next step is to incorporate the toolbar from the previous step into the project. Incorporating the toolbar requires these steps:

  1. Switch to the ClassView tab. Right-click the CMainFrame class, and select Add Member Variable…

  2. The Add Member Variable window appears, as shown in Figure 31. Add a protected member of type CToolBar, named m_wndEditToolBar.

    Figure 31: The Add Member Variable window

  3. Edit the CMainFrame::OnCreate() handler, and then add these lines of code immediately before the last line of code. The last part of the function should look like this:

7.5.3 Modify the 1stEdit menus

To modify the 1stEdit menus, edit the IDR_MY1STETYPE menu resource by adding the menu items from Table 11 under the appropriate top-level menu:

Table 11: 1stEdit menu items

Top Menu New Menu ID Caption
Edit ID_EDIT_REDO &Redo\tCtrl+Y
Edit ID_EDIT_FIND &Find...\tCtrl+F
Edit ID_EDIT_REPLACE R&eplace...\tCtrl+H
Edit ID_EDIT_SELECT_ALL Select A&ll\tCtrl+A

The finished menus should look like Figure 32:

Figure 32: Modified 1stEdit menu

7.5.4 Add the Dynamic Splitter Window

You can now add a dynamic splitter window. Open the Component Gallery, and insert the Split Bars component. Make sure that you have Both selected for your bars, and that the CChildFrame class is selected as the class for which to add the splitters.

The Component Gallery adds a member variable of type CSplitterWnd to your CChildFrame class and adds an override for the OnCreateClient() function, using the following code:

The implementation for OnCreateClient() is given here:

This is all that is necessary to add dynamic splitter windows to your Objective Edit project.

7.5.5 Build and Run Step 3

You may now build and run 1stEdit Step 3, as shown in Figure 33. All the toolbar buttons and new menu items are automatically connected to the appropriate commands in Objective Edit.

Once you have integrated Objective Edit into your application, you can add application-specific behavior by calling Objective Edit methods. You can customize the behavior of Objective Edit by creating a derivative and overriding virtual functions.

Figure 33: 1stEdit showing additional user interface support



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.