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

4.6 Calculator Control

Objective Toolkit provides a calculator control that the user can use to perform basic arithmetic. You can use the calculator control independently or in association with a drop edit control.

Figure 14: Objective Toolkit Calculator Class Hierarchy

4.6.1 SECCalculator

The SECCalculator class implements a calculator edit control capable of decimal arithmetic and other standard operations. The calculator queries the current locale information for formatting the numerical output and determines the decimal character to display on the decimal button.

Figure 15: Example of SECCalculator

4.6.2 SECPopupCalculator

The SECPopupCalculator class creates a pop-up window for the calculator that is destroyed whenever the < = > key is pressed.

Figure 16: Example using SECPopupCalculator with SECDropEdit

4.6.3 Using SECCalculator

After instantiating an SECCalculator object, the application can create the control dynamically by calling the Create() method. For example:

It is important that the SECCalculator object have sufficient scope so that it exists as long as the control exists.

To set and query the value currently displayed by the calculator, use the SetValue() and GetValue() methods.

You can control and query the number of decimal places displayed with the SetDecimalPlaces() and GetDecimalPlaces() methods.

You can reset the calculator control with the Reset() method.

4.6.4 Customizing SECCalculator

You can customize the behavior of the SECCalculator class with the following virtual methods:

4.6.5 Calculator Sample

The calc sample project (in Samples\Toolkit\MFC\Controls\calc) demonstrates the use of an SECCalculator control in a dialog. It demonstrates how to use a class derived from SECDropEdit that creates an SECPopupCalculator. This sample is not shipped with the product. For information on how to obtain this sample, see Section 3.6.1, "Location of Sample Code," in the Stingray Studio Getting Started Guide.



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.