A browse edit control is a Windows edit control that includes a browse button positioned immediately to its right. A browse button is a push button with the label .... When the user presses the browse button, a modal dialog appears.
The modal dialog contains values that the user can select to add to the edit field. After the user chooses a value from this dialog, the text appears in the edit field. If the user knows the value, he can type it directly in the edit field without referring to the modal dialog. The purpose of the browse button is to help the user find the value he wants to enter.
The class hierarchy for the browse edit controls is as follows:
SECBrowseEditBase is an abstract base class that provides the interface and some of the functionality of a browse edit control.
The SECBrowseFileEdit class provides the functionality for a Filename Edit control. A filename edit is a browse edit that is suited for entering a filename. With a filename edit, the user can type in a filename directly or he can pick a filename from a dialog. When the user presses the browse button, a modal file selection dialog appears.
After the user selects a filename from the dialog, the full filename is automatically entered into the edit field.
The SECBrowseDirEdit class provides the functionality for a Directory Edit control. A directory edit is a browse edit in which a user can enter a directory name. With a directory edit control, the user can type a directory name directly into an edit field or pick a directory from a dialog. When the user presses the browse button, a modal directory selection dialog appears.
After the user selects a directory from the dialog, its path is automatically entered into the edit field.
You can use a browse edit class in a dialog or create one as a child of a window. The steps for creating a browse edit control are the same whether you're using SECBrowseFileEdit or SECBrowseDirEdit.
You can only use the SECBrowseFileEdit and SECBrowseDirEdit classes in your applications. SECBrowseEditBase is abstract and cannot be instantiated.
Use AppStudio to create a dialog template. Drop the edit control on the dialog where you want to place the File or Directory Browse Edit.
Create a new dialog class and attach it to the dialog template you just created.
Add an SECBrowseFileEdit (or SECBrowseDirEdit) as a member variable to the dialog class you just created.
Override the OnInitDialog() member of the dialog class. In your override, call SECBrowseFileEdit::Initialize() or SECBrowseDirEdit::Initialize() and pass the window ID of the edit control you want to convert to a browse edit. The following code below is an example of the override:
BOOL MyDialog::OnInitDialog() { CDialog::OnInitDialog(); #ifndef WIN32 CenterWindow(); #endif m_editFilename.Initialize(IDC_FILENAME, this); m_editPath.Initialize(IDC_PATH, this); .. } |
You can create your own browse edit controls by deriving a class from SECBrowseEditBase and then overriding the OnBrowse() method. The SECBrowseEditBase base class creates and positions the text field and browse button for you.
Whenever the user presses the browse button, the OnBrowse() method is automatically called. Your derived class can define the response to a browse button press by overriding the OnBrowse() method and coding your response. For example, you can display one of the common file dialogs. SECBrowseFileEdit and SECBrowseDirEdit are examples of two classes that derive from SECBrowseEditBase. Refer to their implementations for examples of how to do this.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.