SECDateTimeCtrl Class

class SECDateTimeCtrl: public CWnd

SECDateTimeCtrl is a date/time editing control. This class works in conjunction with SECDTGadget, an abstract base class for the gadget components used by SECDateTimeCtrl. The several subclasses that are based on SECDTGadget include:

SECDTStaticGadgetImplements a non-editable text gadget.
SECDTNumericGadgetImplements an editable numeric gadget.
SECDTListGadgetImplements a text gadget with a defined list of possible strings.
SECDTButtonGadgetImplements a simple push button gadget.
SECDTSpinGadgetImplements a spin button gadget.

Defined in: DTCtrl.h

Comments

Before creating/attaching the date/time control, the member function SetFormat must be called.

See the DATETIME sample in the \SAMPLES\TOOLKIT\STANDARD\CONTROLS\DATETIME directory for a demonstration of this class.

Class Members

Creation/Initialization

SECDateTimeCtrl()

Constructs a SECDateTimeCtrl object.

BOOL  Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL)

Creates the edit control and attaches it to the SECDateTimeCtrl object.

BOOL  CreateEx(DWORD dwExStyle, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL)

Creates the edit control with extended style attributes and attaches it

BOOL  AttachDateTimeCtrl( UINT uID, CWnd* pParent, DWORD dwDTStyles, DWORD dwWinStyles = WS_CHILD|WS_TABSTOP, DWORD dwExStyle = WS_EX_CLIENTEDGE )

Attaches an SECDateTimeCtrl object to an edit control.

Attributes

enum  FormatType

Format types

enum  ValidationMode

Validation types

enum  NoEdit

Non-editable fields

BOOL  SetMinMax(const COleDateTime& minDateTime, const COleDateTime& maxDateTime, ValidationMode mode = DateTimeValidation)

Sets the current validation mode and the ranges being validated.

ValidationMode  GetMinMax(COleDateTime& minDateTime, COleDateTime& maxDateTime) const

Gets the current validation mode and the ranges being validated.

void  SetFormat(FormatType format)

Sets the current date/time format.

void  SetFormat(LPCTSTR lpszFormat)

Sets the current date/time format.

void  GetFormat(FormatType& format) const

Gets the current date/time format.

void  GetFormat(CString& format) const

Gets the current date/time format.

void  SetBkColor(COLORREF cNewColor)

Sets the background color.

void  EnableFastEntry(BOOL bEnable = TRUE)

Enables fast input in numeric fields.

void  EnableFastEntry(BOOL bEnable, BOOL bTabEnable)

Enables fast input in numeric fields.

BOOL  IsFastEntryEnabled() const

Determines whether fast input is enabled.

void  SetTabMode(BOOL bEnable)

Sets the tab behaviour.

void  SetModified(BOOL bModified)

Sets the current modified state.

void  SetModified(BOOL bDate, BOOL bTime)

Sets the current modified state.

BOOL  IsModified() const

Returns the current modified state.

void  IsModified(BOOL& bDate, BOOL& bTime) const

Returns the current modified state.

BOOL  IsEditing() const

Determines if one of the fields is being edited.

BOOL  SetDateTime(const COleDateTime& datetime)

Sets the current date and time in the control.

BOOL  SetDate(const COleDateTime& date)

Sets the current date in the control.

BOOL  SetTime(const COleDateTime& time)

Sets the current time in the control.

const COleDateTime&  GetDateTime() const

Gets the current date and time in the control.

int  GetNoEdit() const

Gets the non-editable fields.

void  SetNoEdit(int nNoEdit)

Sets the non-editable fields.

TCHAR  GetNullChar() const

Returns the current null mode character.

BOOL  IsHourPM()

Returns TRUE if current hour is PM.

Operations

void  InvalidateGadget(SECDTGadget* pGadget, BOOL bImmediateRedraw = FALSE)

Forces the specified gadget to be redrawn.

void  InvalidateGadget(int nIndex, BOOL bImmediateRedraw = FALSE)

Forces the specified gadget to be redrawn.

int  GadgetFromPoint(CPoint point)

Returns the index of the gadget at the given portion of the window.

void  BringIntoView(SECDTGadget* pGadget)

Brings the specified gadget into the displayable portion of the window.

void  BringIntoView(int nIndex)

Brings the specified gadget into the displayable portion of the window.

void  SizeToContent()

Forces the control to re-size to fit its content exactly.

BOOL  Validate(const COleDateTime& datetime) const

Validates the given date/time to the current ranges.

void  SetNull(TCHAR cNull = _T('_'), BOOL bAlways = FALSE)

Sets control to null date entry mode.

void  DisableWMCtlColor(BOOL bDisable = TRUE)

Disables sending of the WM_CTLCOLOR messages

Overrides

virtual BOOL  OnChanging(const COleDateTime& newDateTime)

Called just before a commit of a new date/time is applied.

virtual void  OnChanged()

Called after the date/time has been modified.