BCGControlBar Pro for MFC
CBCGPMaskEdit

Detailed Description

The CBCGPMaskEdit class extends the functionality of the Windows edit control. The masked edit control is able to validate typed characters against the specified mask and display them according to specified template . To use the CBCGPMaskEdit control in your application you have to perform the following steps:

  • Add CBCGPMaskEdit member to your class.
  • Call the EnableMask() member function to specify the mask.
  • Call the SetValidChars() member function to specify the list of valid characters.
  • Call the SetWindowText() member function to set the default text into the masked edit control.
  • Call the GetWindowText() member function to retrieve the text.

If you don't call to any initialization routines, the masked edit control behaves as the regular edit control.

Copy
// Mask: phone number
m_wndMaskEdit.EnableMask(
L" ddd ddd dd dd", // The mask string
L"(____) ___ __ __", // Literal _ char = character entry
' '); // Default char
m_wndMaskEdit1.SetValidChars(NULL); // Valid string characters
m_wndMaskEdit1.SetWindowText(L"(812) 212 85 06");
+ Inheritance diagram for CBCGPMaskEdit:

Public Member Functions

 DisableMaskDisables the mask.
 
 EnableGetMaskedCharsOnlySpecifies whether GetWindowText retrieves only masked characters.
 
 EnableMaskSets up the mask.
 
 EnableSelectByGroupTells whether the masked edit control allows selecting by group or the whole text.
 
 EnableSetMaskedCharsOnlySpecifies whether the text is validated against masked chars only or against the whole mask.
 
 SetValidCharsSets a string containing a list of valid characters.
 
- Public Member Functions inherited from CBCGPEdit
 ClosePopupDlgCalled by the framework when the popup dialog is closed.
 
 EnableBrowseButtonEnables or disables the browse button.
 
 EnableCalculatorButtonEnables browse button and puts the edit control in "calculator mode".
 
 EnableFileBrowseButtonEnables browse button and puts the edit control in "file browse mode".
 
 EnableFolderBrowseButtonEnables browse button and puts the edit control in "folder browse mode".
 
 EnableIconOnLeftSpecifies whether icon should be displayed on the left side.
 
 EnablePasswordPreviewEnables the password preview mode.
 
 EnablePopupDialogEnables drop button and puts the edit control in "popup dialog" mode.
 
 EnablePopupDialogEnables drop button and puts the edit control in "popup dialog" mode.
 
 EnableSearchModeEnables or disables search mode.
 
 GetColorThemeGets edit box custom color theme.
 
 GetErrorMessageGets error message.
 
 GetModeReturns the current browse mode.
 
 GetPromptReturns a prompt (displayed when the edit box text is empty).
 
 GetSearchPromptReturns a text string to be displayed in edit box in "search" mode.
 
 GetVerticalAlignmentGets a text vertical alignment.
 
 IsDisableBrowseButtonInReadOnlyModeTells whether edit box "Browse" button is disabled in control read-only mode.
 
 IsDroppedDownTells whether edit box has an active dropped-down list.
 
 IsIconOnLeftEnabledTells whether edit box has an icon on left.
 
 IsSearchModeSpecifies whether the edit control is working the "search" mode.
 
 IsSimplifiedBrowseIconTells whether edit box "Browse" button's icon is simplified.
 
 OnBeforeShowPopupDlgCalled by the framework before the popup dialog is displayed.
 
 SetAutoCompleteListHighlightedColorsSpecifies foreground and background colors of highlighted (marked) text parts in the auto-complete list.
 
 SetBrowseButtonImageAllows to set a custom button image.
 
 SetBrowseButtonImageAllows to set a custom button image.
 
 SetBrowseButtonImageAllows to set a custom button image.
 
 SetBrowseButtonToolTipSets browse button tool tip.
 
 SetColorThemeSets a custom color theme.
 
 SetDisableBrowseButtonInReadOnlyModeEnables or disables edit box "Browse" button in control read-only mode.
 
 SetErrorMessageSets a custom error message.
 
 SetPromptSets a prompt displayed when the edit box text is empty.
 
 SetSimplifiedBrowseIconSpecifies whether edit box "Browse" button should have simplified icon.
 
 SetVerticalAlignmentSpecifies a text vertical alignment (single-line only).
 

Protected Member Functions

 IsMaskedCharCalled by the framework to validate a new character against the corresponding mask char.
 
- Protected Member Functions inherited from CBCGPEdit
 OnAfterUpdateCalled by the framework when the edit control has been updated with the result of browse action.
 
 OnBrowseCalled by the framework when the user has clicked the browse button.
 
 OnCalculatorUserCommandCalled by the framework when a custom calculator command should be executed.
 
 OnDrawBrowseButtonCalled by the framework when it needs to draw the browse button.
 
 OnDrawImageOnLeftCalled by the framework when it needs to draw image (icon) of the left side.
 
 OnGetAutoCompleteListThis method is called by the framework when user types a text in "auto-complete" mode.
 
 OnIllegalFileNameCalled by the framework when the edit control contains an illegal file name and this name is used in a file dialog.
 

Additional Inherited Members

- Public Attributes inherited from CBCGPEdit
 m_bOnGlassSpecifies whether a control is located on the "glass" (DWM) area of the parent window.
 
 m_bVisualManagerStyleSpecifies whether a control has a Visual Manager style look.