Objective Toolkit : Chapter 4 Simple Controls : Marquee Control
Marquee Control
The SECMarquee implements a marquee control that scrolls text across its window. You can configure the fonts, colors, scrolling speed, and wrapping mode. In addition, you can easily change them at run time. Because it is CWnd-derived, you can embed SECMarquee in a view or dialog like any other control.
Figure 33 – SECMarquee Window Embedded in an SECStatusBar
Figure 34 – Objective Toolkit Marquee Class Hierarchy
Using SECMarquee
You can use objects instantiated from SECMarquee anywhere a CStatic can be used. You can attach the object to an existing CStatic control via the AttachStatic() method or create it dynamically via the Create() method.
To attach an SECMarquee instance to an existing CStatic instance:
1. Call the AttachStatic() method with the control ID of the static control to attach the SECMarquee instance. For example:
 
m_wndMarquee.AttachStatic(IDC_MARQUEE_STATIC,this);
To create an SECMarquee 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. For example:
 
Rect rect(0,0,100,50); // initial rectangle
m_wndMarquee.Create(rect,this,strMarqueeText);
To start and stop the SECMarquee:
The Scroll() method controls the scrolling of the marquee.
Customizing SECMarquee
Table 17 lists the five methods that allow you to customize the text, the text font, scrolling speed, foreground/background colors, and wrapping mode at run time.
Table 17 – Customization Methods for SECMarquee 
Method
Description
SetScrollDelay()
Sets scrolling delay.
SetTextWrap()
Sets text wrapping mode.
SetColors()
Sets foreground and background colors.
SetWindowText()
Sets/resets marquee message text.
SetFont()
Set the marquee font.
 
For more information about these methods, see the Objective Toolkit Class Reference.
To modify the SECMarquee behaviors:
Nearly all the public and protected methods of SECMarquee are virtual so you can override them. Some of the virtual callbacks provided by this class are as follows:
Table 18 – Virtual Callbacks for SECMarquee 
Method
Behavior
OnScrollStart()
Called when a new message is about to start scrolling.
OnScrollComplete()
Called when an existing message is about to finish.
OnInitMarquee()
Called when the marquee is initializing.
OnScrollMarquee()
Called when the marquee is scrolling one frame.
 
Some of the methods that you can override to alter the appearance of the SECMarquee class include:
Table 19 – Methods to alter the appearance of SECMarquee
Method
Behavior
Draw3Dborder()
Draws a 3D border around the marquee control.
DoPaint()
Paints the marquee control.
 
Marquee Sample
The statbar sample in the Samples\Toolkit\MFC\UIExt\statbar directory demonstrates how to the use the marquee control in an SECStatusBar. This sample is not shipped with the product. For information on how to obtain this sample, see “Location of Sample Code” in the Getting Started part.