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

3.5 Add the Finishing Details

Now you are going to learn how to polish the application. In this section, you learn how to:

3.5.1 Adding Drop-Down Menus

Let's enhance the application by adding a few finishing details. First, let's add some drop-down menus. Adding a drop-down menu is a three-fold process. To add a drop-down menu you need to:

  1. Select Open from the File menu. Then, select OdRes.rc from the INCLUDE subdirectory, which is immediately under the Objective Views install directory. Double-click the file to open it. It appears as in Figure 32.

    Figure 32: OdRes.rc

  2. Let's copy the Structure and Align drop-down menus to the application. Select the Structure menu from the IDR_OD_MENU resource in OdRes.rc and copy it. Select the empty slot in the project's IDR_MAINFRAME menu resource and paste it. Do the same for the structure menu. The finished menu should appear as in Figure 33.

    Figure 33: Creating a menu

  3. When you copy a resource to your application, its string table entry is copied over as well. You need to delete each of the OD string table definitions from your string table before you can begin compiling your application. Otherwise, the application considers the string table entries to be duplicates of the existing string table entries in the included OdRes.rc resource file. After copying resource elements, your string table should look like Figure 34.

    Figure 34: Sample string table

  4. Delete each of the ID_OD_xxx entries to prevent the compiler from producing errors.

3.5.2 Organizing Toolbars in the Application

You almost have a fully functional application. Next, let's rearrange the tool bars.

  1. Find the CMainFrame::OnCreate() method in your application's MainFrame.cpp source file. The following code is near the end of the file.

  2. Now, incorporate CODGlobal::DockControlBarLeftOf() into your code. The code should look like the following after you make a change:

  3. After you rebuild and execute the application, your application should look like Figure 35.

    Figure 35: Sample application with rearranged toolbars

3.5.3 Add an Arrow to the Link

Our application is almost complete. Let's add an arrow to the link by adding a command handler for the ID_OD_LINK_SYMBOLS command.

  1. First, add the following line to the class declaration for CSimpleController.

  2. Then, add the following code to CSimpleController's message map.

  3. Lastly, add the following code to SimpleCtlr.cpp.

    This is the same technique you used to add other symbols to a canvas. We create the link component and add a CODArrowEndpoint object to it by calling SetTargetEndpoint(). Then, you pass the link component to the controller for insertion onto the canvas by calling OnInsertLink(). The OnInsertLink() method serves the same purpose as OnInsertSymbol(). Any command handler can add custom links to a canvas using OnInsertLink(). The CODController class provides a default handler for the ID_OD_LINK_SYMBOLS command, which creates a link with no adornments.

  4. Our simple application is now complete. Rebuild the application and experiment with it.


    Although this sample is not equivalent to a fully functional Objective Views application, it demonstrates many of its basic features.



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.