BCGSuite for MFC
CBCGPEdit

Detailed Description

The CBCGPEdit class implements the functionality of a simple edit control with a browse button. There are four out-of-the-box modes:

  • calculator mode: when the user clicks the browse button a popup calculator appears and the result of arithmetical calculations will be inserted in the edit control
  • folder mode: the standard Shell folder selection dialog allows to browse for a folder
  • file mode: the standard file dialog allows to browse for a file
  • popup dialog mode: when the user clicks the browse button a custom popup dialog appears
  • custom mode: allows to display a custom dialog

You should to perform the following steps in order to incorporate the edit control in your application:

  • Derive your own class from CBCGPEdit class if you want to implement custom browse mode.
  • Override CBCGPEdit::OnBrowse if you implement the custom browse mode. In the overridden method you'll need to execute a custom browse action and update the edit control with the result.
  • Embed a CBCGPEdit object into the parent window object.
  • If you use the edit control in a dialog, place a simple edit control on the dialog form and replace CEdit with CBCGPEdit in the header file. The control will be created automatically. Otherwise you need to create the Windows edit control using CEdit::Create.
  • Depending on the desired mode call one of the following methods in order to enable the browse button and put the control into desired browse mode: EnableCalculatorButton(), EnableFolderBrowseButton(), EnableFileBrowseButton(), EnableBrowseButton() or EnablePopupDialog()
  • Call SetBrowseButtonImage() if you want to provide a custom image for the browse button or/and override OnDrawBrowseButton().
  • If the edit control is placed on a dialog box, setup data exchange using the ClassWizard.
  • If at some point you want to remove the browse button from the edit control, just call EnableBrowseButton() with bEnable set to FALSE.

You can find an example of using CBCGPEdit in BCGPControls example, page3.cpp/h (misc controls).

+ Inheritance diagram for CBCGPEdit:

Public Member Functions

 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.
 
 IsDisableFrameAccelTableOnFocusTells whether to suppress handling of the keyboard accelerators in the top-level frame when the control is being focused.
 
 IsIconOnLeftEnabledTells whether edit box has an icon on left.
 
 IsSearchModeSpecifies whether the edit control is working the "search" mode.
 
 OnBeforeShowPopupDlgCalled by the framework before the popup dialog is displayed.
 
 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.
 
 SetDisableFrameAccelTableOnFocusSpecifies whether to suppress handling of the keyboard accelerators in the top-level frame when the control is being focused.
 
 SetErrorMessageSets a custom error message.
 
 SetPromptSets a prompt displayed when the edit box text is empty.
 
 SetVerticalAlignmentSpecifies a text vertical alignment (single-line only).
 

Public Attributes

 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.
 

Protected Member Functions

 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.
 
 OnIllegalFileNameCalled by the framework when the edit control contains an illegal file name and this name is used in a file dialog.