SECMarquee Class

class SECMarquee: public CStatic

The SECMarquee class is a scrollable text marquee control class. Fonts, colors, scrolling speed and wrapping mode are all configurable. The attributes can easily be changed at runtime. Since it is CWnd derived, it can be embedded on a view or dialog just like any other control.

Defined in: marquee.h

Comments

The marquee can be used anywhere a CStatic can be used. It can be attached to an existing CStatic control with the  AttachStatic method, or can be created dynamically with the  Create method.

The STATBAR sample in the \SAMPLES\TOOLKIT\STANDARD\CONTROLS\MASKTEST directory demonstrates how to use the SECMarquee class.

Developer Notes

When this object is used on Window CE devices the scroll rate is locked by the maximum update rate of the screen. This means that the speed cannot go above a slow crawl in some cases. Although the preprocessor definition SCROLL_PIXELS_PER_FRAME sets the step rate this sets the rate for all marquees globally. The variable m_nScrollStep has been added to allow individual control of the step rate and direction.

Class Members

Creation/Initialization

SECMarquee()

Constructs a SECMarquee object.

virtual BOOL  Create(RECT rect,CWnd* pParent,LPCTSTR lpszText=_T(""), DWORD dwStyle=WS_VISIBLE|WS_CHILD,UINT nControlID=0xFFFF)

Dynamically create the marquee control

virtual BOOL  AttachStatic(int nCtlID,CWnd* pParentWnd)

Attach marquee to an existing static control

Attributes

virtual BOOL  SetScrollDelay(UINT uNewDelay=SEC_MARQUEE_DEF_SCROLL_DELAY)

Set scrolling delay

virtual BOOL  SetTextWrap(FLOAT fraction=SEC_MARQUEE_WRAP_ON_HALF)

Set text wrapping mode

virtual void  SetColors(COLORREF fgnd=SEC_MARQUEE_DEF_FGND_COLOR, COLORREF bgnd=SEC_MARQUEE_DEF_BGND_COLOR)

Set foreground and background colors

virtual BOOL  IsScrolling()

Return current scrolling state.

virtual void  SetWindowText(LPCTSTR lpszNewText=(LPCTSTR)NULL)

Set/Reset marquee message text

virtual void  GetWindowText(CString& strText)

Get the current marquee message text.

virtual void  GetVisibleText(CString& strText)

Get text visible currently visible on the marquee.

virtual void  SetFont(CFont* pFont=(CFont *)NULL,BOOL bRedraw=TRUE)

Reset the marquee font

Operations

BOOL  Scroll(BOOL bDoScroll=TRUE)

Start/stop the marquee scrolling

void  SetScrollStep(INT v)

Setting the scroll-step sets how many pixels the marquee is moved with each timer tick

INT  GetScrollStep()

Returns the scroll step value

Overridable

virtual void  OnScrollStart()

Called when a new message is about to start scrolling.

virtual void  OnScrollComplete()

Called when an existing message is about to finish.

virtual BOOL  OnInitMarquee()

Called when the marquee is initializing.

virtual BOOL  OnScrollMarquee()

Called when the marquee is scrolling 1 frame.

virtual void  Draw3DBorder(CDC* pDC,CRect rect)

Draws the 3D border around the marquee control.

virtual void  DoPaint(CPaintDC* pdc)

Paints the marquee control.

virtual void  ResetMarquee()

Resets the marquee control.

Protected data members

CRect  m_ClientRect

The client rect of the control.

BOOL  m_bWndExists

Indicates whether a hWnd exists for this control.

BOOL  m_bIsScrolling

Indicates current scrolling state.

UINT  m_nScrollDelay

The scroll delay in milliseconds.

SEC_UINT  m_nTimerID

The internal timer ID.

BOOL  m_bTimerActive

Indicates whether the internal timer is active.

FLOAT  m_fWrapModifier

Wrap modifier flags.

int  m_nWrapPixelPadding

Wrap pixel padding.

COLORREF  m_FgndColor

Current foreground color.

COLORREF  m_BgndColor

Current background color.

CPen  m_penWhite

A white pen.

CPen  m_penBlack

A black pen.

CPen  m_penShadow

A COLOR_BTNSHADOW pen.

CPen  m_penFace

A COLOR_BTNFACE pen.

BOOL  m_bDrawCtrlBorder

Indicates whether to draw the 3D border.

CFont*  m_pFont

The current font.

BOOL  m_bShowWindow

Indicates whether the control is currently visible.

BOOL  m_bFirstScrollStart

Indicates whether the first scroll has begun.

CString  m_strMarqueeText

The entire marquee text to scroll.

CString  m_strVisibleText

Currently displayed text.

int  m_nNextDisplayCharIndex

Moving position pointer.

BOOL  m_bLastCharDisplayed

Indicates that the last character was displayed.

INT  m_nLeftPixelExtent

Starting pixel position of visible marquee.

INT  m_nRightPixelExtent

Ending pixel position of visible marquee.

INT  m_nScrollStep

Number of pixels to scroll marquee