Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 23840, Custom Edit Controls -- 2

by Philip Manger Email: pmanger@thesoftwarebuilder.com


UPDATED!
A collection of eight custom edit controls that allow the programmer to put certain restrictions on data entry to minimize errors, plus a generalized popup menu that can be used with any descendant of TCustom Edit and a table navigation tool. Installation program included.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 6.0  to 6.0 447 downloads
Copyright: No significant restrictions


Size: 1,094,950 bytes
Updated on Sat, 03 Feb 2007 15:44:57 GMT
Originally uploaded on Tue, 15 Nov 2005 14:36:03 GMT
SHA1 Hash: 1C8AD39ABD6D55C8A6FF9C074B5D2CE8B2873342
MD5 Hash: BFF4526C013B498004083881673F3968

    Explore the files in this upload

Description
NOTE: The installation program has been changed. When the components are uninstalled, the palette page registry entries are freed. For this reason, these components should be installed on their own palette page. That way, if you uninstall them, you won't run the risk of accidentally removing other components from the palette.

This distribution replaces an earlier distribution of Custom Edit Controls posted here. Bugs in the original controls have been fixed and two more edit controls have been added, as well as a generalized popup menu that can be used with any descendant of TCustomEdit. In addition to fixing the bugs, some new features have been added to the controls to permit the programmer to exercise even tighter control over user input, thus reducing the likelihood of data-entry error.

Six of the data-entry controls are of the spin-edit type, similar to cspinedit, but with better and more complete message-handling capabilities, more formatting options, and dataset connectivity.

Because of the new features, these controls will now compile ONLY on C++ Builder 6.0. However, source code is included, so if you are using an earlier version of C++ Builder you can make the appropriate modifications -- although this will in some cases entail replacing some of the function calls with your own code. Delphi programmers conversant with C++ can rewrite the code in ObjectPascal.

This package includes a simple installation program (cpsetup.exe) and setup script (cpsetup.ini) that in one step will install the controls in the C++ Builder IDE and merge their help files with the C++ Builder help files. Theoretically, you should be able to modify the setup script (an .ini file) to install custom components in any version of C++ Builder or Delphi. Be warned, though, it has only been tested with C++ Builder 6.0. Also, it is not a bad idea to back up your system registry before running the setup program. Components installed with cpsetup.exe can be uninstalled through the Windows Control Panel.

The controls included in this packages are:

AlignEdit -- a simple edit control derived from the VCL's Edit, and which behaves the same way, except that the programmer can specify that text be left-justified, centered, or right-justified.

AlignMaskEdit -- an edit control derived from the VCL's MaskEdit, which also behaves the same way as its ancestor and offers an alignment option in addition.

ISpinEdit -- a text edit control that restricts data entry to integers, within a specified range chosen by the programmer, and which increments or decrements by the programmed amount if the user presses an up or down button, or the up-arrow or down-arrow keys.

FSpinEdit -- a text edit control that restricts data entry to real numbers, within a specified range and level of precision chosen by the programmer, and which also increments or decrements by the programmed amount if the user presses an up or down button, or the up-arrow or down-arrow keys.

DTSpinEdit -- a text edit control that, at the option of the programmer, restricts data entry to dates, times, or date/times in a limited number of formats, where the increments are either determined by the programmer or based on the cursor's position in the control.

DBSpinNav -- a table navigation tool that looks just like the spin edit controls described above, but which is not, in fact, an edit control. It is attached to a field in a table, and the up/down buttons and up-arrow/down-arrow keys are used for moving forward or backward through the table

DBDTSpinEdit -- a data-aware version of DTSpinEdit.

DBISpinEdit -- a data-aware version of ISpinEdit.

DBFSpinEdit -- a data-aware version of FSpinEdit.

EdCtlMenu -- The controls listed above are all descended from TCustomEdit. The Undo feature of the default popup menu associated with TCustomEdit descendants only works correctly for the spin edit controls when the user types directly into the text area. This popup menu corrects that problem, emulating the default popup menu in every respect, and the developer can even add additional menu choices to it. An instance of this component should be selected as the PopupMenu property of these controls.

The last three components are all new with this release. As for the others, in addition to correcting the problems the earlier versions had, the rewrite has added some new features:

-- Addition of the OldValue property, which is of the same type as the Value property, to all spin edit controls and an enumerated StartValue property to the FSpinEdit and ISpinEdit controls and their data-aware versions.

-- Addition of the IsClear() method to all spin edit controls. This allows the code to check for an empty control without raising an exception.

-- Addition of the DateFormat and DatePreference property to the date/time spin edit controls. The former allows the developer to choose from among four date formats (American, European, International and System), and the latter sets the default value of the hidden date portion of a pure time value.

-- Addition of type-specific drop-down edit lists for the DataField properties of the data-aware controls. This restricts the list of available fields to the control’s permissible data types.

-- Stricter type-checking for all type-specific controls.

-- The controls all now allow the user to leave an empty control. If the control is empty, the data-aware versions are assigned a null value in the field. Non-data-aware versions report values of negative MAXINT, negative MAXDOUBLE, and TDateTime(-1000000) for TISpinEdit, TFSpinEdit and TDTSpinEdit respectively. Programmers should always check IsClear() before assigning the value of one of these controls.

-- Stricter control over user input when EditorEnabled = false. Cutting and pasting now operates on the entire value, rather than just the selected text.

-- More customized responses to Windows messages, resulting in fewer chances for users to inadvertantly enter inappropriate values in the text windows.

Any comments, suggestions or complaints about these components should be directed to:

pmanger@thesoftwarebuilder.com.

For more information, see http://www.thesoftwarebuilder.com

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04