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

4.14 Extended Progress Control

Derived from MFC's CProgressCtrl, SECProgressCtrl offers several enhancements to the existing progress control, including

The progress control also offers powerful virtual hooks for you to provide your own customizations easily.

In addition, SECProgressCtrl supports the automatic advancing of the progress status in response to timer events. Refer to StepOnTimer() in the Objective Toolkit Class Reference for more information.

Figure 37: Example Progress Control

The class hierarchy for the progress control is as follows:

Figure 38: Objective Toolkit SECProgressCtrl Class Hierarchy

4.14.1 Using SECProgressCtrl

You can use objects instantiated from SECProgressCtrl anywhere you can use CProgressCtrl. You can attach an SECProgressCtrl object to an existing CProgressCtrl control via the AttachProgress() method or you can create the control dynamically via the Create() method.

To attach an SECProgressCtrl instance to an progress control resource:

Call the AttachProgress() method with the control ID of the progress control you want to attach.

To create an SECProgressCtrl instance dynamically:

  1. Create a unique control ID for the control. In Visual Studio, you can create a control ID in the Resource Includes dialog.

  2. Call the Create() method.

        CRect rect(0,0,100,50);         // initial rectangle
        m_wndProgress.Create(WS_CHILD|WS_VISIBLE,rect, this,IDC_PROGRESS1);
      

4.14.2 Customizing SECProgressCtrl

You can use the following extended styles to customize the progress control.

Table 22: Extended Styles for SECProgressCtrl

Extended style flag Description
SEC_EX_PROGRESS_VERT Bar progresses vertically
SEC_EX_PROGRESS_RIGHT_TO_LEFT If horizontal, bar progresses right to left
SEC_EX_PROGRESS_TOP_TO_BOTTOM If vertical, bar progresses top to bottom
SEC_EX_PROGRESS_SHOWPERCENT Show text percentages on bar
SEC_EX_PROGRESS_SHOWTEXT Show text on bar
SEC_EX_PROGRESS_TEXT_ALIGN_LEFT If text shown, align text left
SEC_EX_PROGRESS_TEXT_ALIGN_RIGHT If text shown, align text right
SEC_EX_PROGRESS_TEXT_ALIGN_CENTER If text shown, center the text
SEC_EX_PROGRESS_ COMMCTRL32 Has look and feel of CProgressCtrl
SEC_EX_PROGRESS_DEFAULTS SEC_EX_PROGRESS_SHOWPERCENT |SEC_EX_PROGRESS_TEXT_ALIGN_CENTER

You can specify these styles as parameters to the Create() and SetExStyle() methods. By default, the progress bar is horizontal and progresses left to right with centered percentages. You can use the preceding flags to modify the default behavior. In addition, the application can configure the font, foreground, and background color at run time.

4.14.3 Extending SECProgressCtrl

Almost every method in SECProgressCtrl is virtual so you can override them. Some of the virtual callbacks provided by this class include:

Table 23: Virtual Callbacks in SECProgressCtrl

Method Description
OnDisplayStr() Override to alter a progress string before display.
OnPaintBarFill() Paint the filled portion of the progress bar.
OnPaintBarEmpty() Paint the empty portion of the progress bar.
OnPaintBarText() Paint the progress text, if any.


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.