Implements specialized edit controls with attached speed buttons.

editbtn.pas contains specialized edit controls with an attached speed button used to perform an action when it is clicked. The following components are added to the Misc tab in the Lazarus IDE Component Palette:

  • TEditButton
  • TFileNameEdit
  • TDirectoryEdit
  • TDateEdit
  • TTimeEdit
  • TCalcEdit
Represents a TDateTime type without a value assigned. Implements the embedded edit control used in TCustomEditButton.

TEbEdit is a TGEEdit descendant which implements the embedded edit control used in TCustomEditButton. TEbEdit provides overridden methods to alter the behavior of the control when handling OnEnter and OnExit notifications.

TGEEdit
Performs actions needed when the control is entered.

Ensures that the button visibility and spacing for the Owner control are handled when the Owner is derived from TCustomEditButton. Calls the inherited method prior to exit.

TCustomMaskEdit.DoEnter
Performs actions needed when the control is exited.

Ensures that the button visibility and spacing for the Owner control are handled when the Owner is derived from TCustomEditButton. Calls the inherited method prior to exit.

TCustomMaskEdit.DoExit
Implements a speed button used in TCustomEditButton.

TEditSpeedButton is a TSpeedButton descendant which provides support for change notifications for Glyphs used on the Button in TCustomEditButton.

Performs actions needed when the glyph has changed for the Button in TCustomEditButton. Object generating the event notification. TCustomEditButton - base class for TEditButton, an Edit Box with attached Speed Button.

TCustomEditButton is a TCustomAbstractGroupedEdit descendant which implements a composite control with both an Edit and a Button. It provides overridden methods which extend or re-implement those found in the ancestor class. Most of the properties in the class are declared as protected, and must be exposed as public or published properties in an ancestor class like TEditButton.

Gets the value for the FocusOnButtonClick property. Value for the property. Gets the value for the OnButtonClick property. Value for the property. Gets the value for the Button property. Value for the property. Gets the value for the Glyph property. Value for the property. Gets the value for the NumGlyphs property. Value for the property. Gets the value for the Edit property. Value for the property. Sets the value for the FocusOnButtonClick property. New value for the property. Sets the value for the OnButtonClick property. New value for the property. Sets the value for the ButtonOnlyWhenFocused property. New value for the property. Sets the value for the Flat property. New value for the property. Sets the value for the Glyph property. New value for the property. Sets the value for the NumGlyphs property. New value for the property. Gets the value for the Images property. Value for the property. Sets the value for the Images property. New value for the property. Gets the value for the ImageIndex property. Value for the property. Sets the value for the ImageIndex property. New value for the property. Gets the value for the ImageWidth property. Value for the property. Sets the value for the ImageWidth property. New value for the property. Performs actions needed when the button for the control is clicked.

The implementation for ButtonClick is empty in TCustomEditButton; use a descendent class which implements a specific functionality.

Performs a button click for the associated control. Gets the class type used to create a new edit control instance in the class. Class type for the edit control. Gets the class type used to create the associated button control for the class. Class type for the button control. Gets the default size used for new instances of the class.

The return value is a TSize type with the dimensions for the control. The CX member contains the width needed for both the Edit and the Button controls in the grouped edit control. The CY member contains the height used for the Edit and the Button controls.

GetControlClassDefaultSize is called in the constructor for the class instance, and used to set the initial bounds for the control.

TControl.SetInitialBounds
TSize value with the dimensions for the new class instance. Indicates whether the Button for the control should be visible.

CalcButtonVisible is a Boolean function used to determine whether the Button for the control should be visible. The return value is True when the control is Visible and the Edit has focus, or the control is not configured to display its button only when focused.

The return value is always True at design-time.

CalcButtonVisible is used in the implementation of the CheckButtonVisible method.

TControl.Visible
GetDefaultGlyphName finds the name of the default glyph used for the Button. Ensures the Button for the control is configured and its visibility is set.

CheckButtonVisible is a procedure which ensures that the Button in the control is configured and its visibility is set. If Button has not been assigned (contains Nil), no actions are performed in the method.

Otherwise, the Visible property in Button is set to the value returned by CalcButtonVisible. UpdateSpacing is called to adjust the space between Edit and Button as needed for its visibility and Layout.

Loads the default glyph displayed on the Button for the control. Performs action needed when the glyph assigned in Button has changed. Button is the TSpeedButton that is attached to the grouped edit control. Contains the caption used for the Button on the grouped edit control. Cursor shape displayed when the mouse hovers over the Button in the control. ButtonHint is the hint that pops up when the mouse hovers over the button. ButtonOnlyWhenFocused - if True, the SpeedButton only appears when focus is given to the EditButton control. ButtonWidth is the width for the TSpeedButton used in the grouped edit control. Edit is the TEbEdit control used to perform direct input for the value in the grouped edit control. Flat - if True, SpeedButton appears flat rather than three-dimensional. Indicates if the focus is changed to the Edit control after the Button is clicked. Glyph - the small graphic image on the SpeedButton, which ought to indicate its function. NumGlyphs - the number of available glyphs. Contains the Images that can be displayed on the Button for the grouped edit control. Ordinal position in Images for the bitmap displayed on the Button control.

Read and write access for the property are redirected to the ImageIndex property in Button.

Specifies the width of the image displayed on the Button control. Specifies the number of pixels reserved between the Edit and Button controls when Button is visible.

The default value for the property is 4 in TCustomEditButton.

OnButtonClick - event handler for a mouse click on the SpeedButton. Create - constructor for TCustomEditButton: calls inherited Create then sets some defaults and initializes some variables.

Create - constructor for TCustomEditButton: calls inherited Create then sets some defaults and initializes some variables.

Initializes height and width, cursor, glyph, style, checks visibility, event handler for click.

TComponent.Create TCustomEdit.Create TWinControl.Create
Owner of the class instance. Destructor for the class instance. TWinControl.Destroy Implements a grouped edit control with both an Edit and a Button.

TEditButton implements a grouped edit control with both an Edit and a Button. TEditButton is derived from the TCustomEditButton class, and sets the visibility for properties declared in the ancestor classes.

TCustomAbstractGroupedEdit
Enables automatic adjustment of the size for the control, according to its content.

AutoSize is a Boolean property which allows the control to automatically adjustment its size to the content in the control. The default value for the property is True in TEditButton.

TCustomAbstractGroupedEdit.AutoSize
Style for the Border drawn around the control.

The default value for the property is bsNone in TEditButton.

TWinControl.BorderStyle
String filter options which can be enabled in controls.

TFilterStringOption is an enumerated type with values representing string filter options which can be enabled in controls which support the feature. TFilterStringOption values are stored in the TFilterStringOptions set type used to implement the FilterOptions property in TCustomControlFilterEdit.

Value comparisons are case sensitive. Value comparisons start at the beginning to the string value. Set type used to store values from the TFilterStringOption enumeration. Specifies an event handler used to filter data items in TCustomControlFilterEdit.

TFilterItemEvent is a Boolean object function type that specifies an event handler used to filter data items in TCustomControlFilterEdit. The return value is True if an item matches a filter condition implemented in the event handler. Done can be updated to indicate if the item requires additional filtering on the title string in the data item; when it contains True, no additional filtering is needed.

TFilterItemEvent is the type used for the OnFilterItem event handler in TCustomControlFilterEdit.

True if the item matches the filter implemented in the event handler. Pointer to the data for the item examined in the event handler. Indicates if additional filtering is needed on the title of the item data. Specifies an event handler used to filter data items in TCustomControlFilterEdit.

TFilterItemExEvent is a Boolean object function type that specifies an event handler used to filter data items in TCustomControlFilterEdit. It is similar to TFilterItemEvent, but provides an additional argument with the caption for the data item.

The return value is True if an item matches a filter condition implemented in the event handler. Done can be updated to indicate if the item requires additional filtering on the title string in the data item; when it contains True, no additional filtering is needed.

TFilterItemEventEx is the type used for the OnFilterItemEx event handler in TCustomControlFilterEdit.

True if the item matches the filter implemented in the event handler. Caption or display name for the item examined in the event handler. Pointer to the data for the item examined in the event handler. Indicates if additional filtering is needed for the caption or item data. Specifies an event handler is to determine if the specified Item is checked.

TCheckItemEvent specifies an event handler that can be used only for items that have a checkbox. Returns True when the item is checked. It will be necessary to cast the object instance in Item to the correct data type in the event handler to access properties introduced in a TObject descendant.

TCheckItemEvent is the type used to implement the OnCheckItem event handler in TCustomControlFilterEdit.

True when the item is checked. Object examined in the method. Base class for edit controls which filter data in an associated control like TListbox or TTreeview.

When the container control is connected to a filter control, the filtering happens automatically as a user enters text. When the filter is empty and does not have focus, it displays the greyed value "(filter)".

Sets the value for the Filter property. New value for the property. Sets the value for the IdleConnected property. New value for the property. Event handler signalled to apply a filter when an Application becomes idle.

OnIdle is a procedure which implements a TIdleEvent event handler signalled to apply a filter when the Application becomes idle. OnIdle is assigned (using AddOnIdleHandler) or removed (using RemoveOnIdleHandler) in the global Application instance when the value in IdleConnected is changed.

OnIdle uses an internal flag to determine if an update is needed, and when set, calls ApplyFilter to activate the filter and resets the flag value. Use the OnFilterItemEx or OnFilterItem (deprecated) event handlers to perform actions needed to implement the filter.

OnIdle signals the OnAfterFilter event handler (when assigned).

Object for the event notification. Indicates if the value in TextHint is stored in the LCL component streaming mechanism

The value is True when TextHint contains a value other than the rsFilter resource string.

.
True when TextHint is included in the LCL component stream. Flag which indicates that the filter has been updated and needs to be applied. Flag indicating if the filter has ever been applied. Node to select during the next update. Stores the event handler in the OnFilterItem property. Stores the event handler in the OnFilterItemEx property. Stores the event handler in the OnCheckItem property. Ensures that the Canvas for the control is freed before the window handle is destroyed. Calls the inherited DestroyWnd method. TWinControl.DestroyWnd Provides a default routine used to examine an item in the filtered edit control.

Signals the OnFilterItemEx (preferred) or OnFilterItem (deprecated) event handlers (when assigned) to determine if the item meets the filter condition. Values in ACaption and ItemData are passed as arguments to the event handlers.

The return value is True when the item meets the filter condition(s) implemented in the event handlers. The DoDefaultFilterItem method is called when the return value is False, or the event handlers are not assigned in the class instance.

True when the item meets the filter condition. Caption for the item passed to DoDefaultFilterItem. Pointer to the data for the item examined in the method. Filters items using the handlers for the control. Returns True when the item meets the filter criterion. Caption for the item. Pointer to the data for the item. Gandles a KeyDown event for the Edit control. Performs actions needed when the Edit is changed. Performs actions when the Button for the control is clicked.

BuddyClick is an overridden method used to perform actions needed when the Button for the control is clicked. It clears values in the Text and Filter properties, and gives focus to the Edit when FocusOnButtonClick is set to True. It calls the inherited method prior to exit.

TControl.Text
Sorts the data in the associated control and applies the filter.

SortAndFilter is an abstract virtual method in TCustomControlFilterEdit. It must be implemented in a descendent class to provide the specific functionality needed.

Filters the data and updates the container.

Does its job at once when Immediately is set to True. Otherwise, it connects the OnIdle event handler which applies the filter when the Application is idle.

Indicates the filter is applied immediately. Applies the Filter data to the container component. Method that actually filters data in the container component. ApplyFilterCore is a virtual abstract method, and must be implemented in a derived classes. Moves to the next value matching the filter for the control. Abstract virtual method that must be implemented in a descendent class. Moves to the previous value matching the filter for the control. Abstract virtual method that must be implemented in a descendent class. Moves one page of previous values matching the filter. Abstract virtual method that must be implemented in a descendent class. Moves one page of subsequent values matching the filter. Abstract virtual method that must be implemented in a descendent class. Moves to the first value matching the filter. Abstract virtual method that must be implemented in a descendent class. Moves to the last value matching the filter. Abstract virtual method that must be implemented in a descendent class. Indicates whether an assigned OnKeyPress event handler handles the Return or Enter key in the KeyDown method for the Edit. Abstract virtual method that must be implemented in a descendent class. True if OnKeyPress is assigned and handles the VK_RETURN key code. Registers the class reference used to create new instances of the class. Constructor for the class instance.

Create is the constructor for the class instance, and calls the inherited constructor. Create sets the default values for properties used to configure the Edit and Button in the class instance as well as its internal flags, including:

CharCase
Set to ecLowerCase
Button.Enabled
Set to False
FilterOptions
Set to an empty set
FIsFirstUpdate, fIsFirstSetFormActivate
Set to True
TextHint
Set to rsFilter
Owner for the class instance. Destructor for the class instance. Should be called when data was changed and it must be filtered again. Connects to OnIdle handler which filters the data later. Removes the filter text and shows all items in the container. Applies a new filter immediately without waiting for idle. Returns the previous filter. Stores the current selection for the associated control in the class instance.

StoreSelection is an abstract virtual method, and must be implemented in a derived class to use the correct class type for items in the associated control.

Used in the implementation of the ApplyFilter method.

Restores the selection in the associated control after the filter is applied.

Abstract virtual method that must be implemented in a descendent class.

The textual representation for the filter. Typically a user types it in the edit control but it can also be set in code. Filtering is done during idle time after the value of Filter text has changed. Lowercase variant of the Filter property.

FilterLowercase is a read-only String property which contains a variant of Filter converted to lowercase characters. It is used in the implementation of the DoDefaultFilterItem method when case sensitivity is not enabled in the FilterOptions property ( fsoCaseSensitive is not included). The property can be used in a similar manner in routines assigned to the OnFilterItem and OnFilterItemEx event handlers.

The value for FilterLowercase is derived and assigned when the value in the Filter property is changed.

Indicates if OnIdle has been connected to the Application singleton.

IdleConnected is a Boolean property which indicates if the OnIdle event handler in the class instance has been connected to the Application singleton. When set to True, the Filter in the control will be applied when the application is in an idle state.

Changing the value in the property causes the Application singleton to be updated by calling either the AddOnIdleHandler or the RemoveOnIdleHandler method. The address for the OnIdle method in the class is passed as an argument.

IdleConnected is set to True in the InvalidateFilter method.

IdleConnected is set to False in the OnIdle method after the Filter has been applied for the control.

The default value for the property is False.

Application TApplication TApplication.AddOnIdleHandler TApplication.RemoveOnIdleHandler
Items can be sorted while they are filtered. For retaining selection in the filtered control. The actual type depends on the associated control. Controls case conversion performed for a value entered in the control.

CharCase is a TEditCharCase property that controls the case conversion used (if any) for a value entered in the control. The default value for the property is ecLowerCase in TCustomControlFilterEdit, and indicates that charcters are converted to lower case.

See TEditCharCase for more information about the enumeration values supported for the type.

TCustomAbstractGroupedEdit.CharCase TEditCharCase
Contains options which control string comparisons for filters in the control.

FilterOptions is a TFilterStringOptions property which contains zero (0) or more TFilterStringOption enumeration values(s). Values in FilterOptions determine how string comparisons are performed in the DoDefaultFilterItem method. See for more information about the enumeration values and their meanings.

The default value for the property is an empty set ([]).

Called after all items are filtered. An event handler to give extra conditions for filtering, in addition to the default behavior. Returns True if the passes the filter. This feature has, for example, enabled filtering the Options windows in Lazarus IDE based on captions for all controls on the options pages. Deprecated. Use OnFilterItemEx with a caption parameter instead. Event handler signalled to filter data in the control using its caption or item data. Has effect when items in the filtered container can be checked. Typically a CheckListbox. TAcceptFileNameEvent - generic event handling method to accept a filename from a dialog. Object for the event notification. File name examined in the event handler. Enumerated type representing dialog styles used in TFileNameEdit.

TDialogKind is an enumerated type representing the dialog styles available for use in TFileNameEdit. Values in the enumeration influence the common dialog type created for a control which displays a dialog when its button is clicked.

TDialogKind is the type used to implement the DialogKind property in TFileNameEdit.

An Open dialog. A Save dialog. An Open dialog for image types. A Save dialog for image types. TFileNameEdit - an EditBox to hold a filename, with an attached SpeedButton that summons a File Open dialog.

TFileNameEdit is a TCustomEditButton descendant which implements a grouped edit control used to select and edit a file name on the local file system. The control provides the Edit and Button properties from the ancestor class, and executes a dialog when the Button is clicked. New properties are introduced which allow configuring the control to a specific file path, filters to select files of particular type or file extension, and to hide or show directories in its dialog.

Sets the value for the FileName property. New value for the property. Gets the default glyph name used for the Button on the control.

The return value contains the resource ID in the ResBtnFileOpen constant. The value is used in the LoadDefaultGlyph method defined in TCustomEditButton.

Creates the dialog for the control.

CreateDialog is a TCommonDialog function which creates and returns the dialog for the grouped edit control.

AKind contains the TDialogKind value that identifies the dialog type required for the control, and normally has the value from the DialogKind property. AKind determines the class type instantiated and used as the return value. For example:

dkOpen
TOpenDialog is the type in return value
dkPictureOpen
TOpenPictureDialog is the type in return value
dkSave, dkPictureSave
TSaveDialog is the type in return value

Properties relevant to the dialog kind are copied into the dialog, and mat include:

  • FileName
  • Path information extracted from FileName
  • InitialDir
  • DefaultExt
  • Filter
  • FilterIndex
  • DialogOptions
  • DialogTitle

CreateDialog is used in the implementation of the RunDialog method.

TCommonDialog TOpenDialog TSaveDialog
Dialog class instance created in the method. Identifies the dialog kind or type created in the method. SaveDialogResult - stores the result of the dialog.

SaveDialogResult is a procedure used to capture the results from the dialog when it has finished execution. The values are stored in the corresponding properties in the class instance, and depending on the DialogKind, may include:

  • FilterIndex
  • FileName
  • DialogFiles

SaveDialogResult is used in the implementation of the RunDialog method.

Dialog type in the D argument. Dialog examined in the method. Performs actions needed when the Button for the control is clicked.

ButtonClick is an overridden method used to perform actions needed when the Button for the control is clicked. For TFileNameEdit, the RunDialog method is called to execute the dialog for the control and to capture it results. When FocusOnButtonClick is set, the FocusAndMaybeSelectAll method is called to give focus to the Edit control in the class.

Performs actions needed when the value for the control has been changed. Signals the OnFolderChange event handler (when assigned). Constructor for the class instance.

Create is the overridden constructor for the class instance, and calls the inherited constructor. Create allocates resource needed for the DialogFiles property, and sets the default values for the DialogKind and DialogOptions properties.

Owner of the class instance. Destructor for the class instance. RunDialog executes the dialog for the control. DialogFiles is the list of files for the dialog.

DialogFiles is a read-only TStrings property used to store one or more file names found when the dialog for the control is executed. DialogFiles is updated in the SaveDialogResult method. For open dialogs, DialogFiles is set to the files returned by the dialog. For save dialogs, the content in DialogFiles is cleared.

FileName - the name of the selected file: either the initial value placed in the Text Box, or the value selected from the dialog. InitialDir is the directory from which the search starts. OnAcceptFileName is an event handler for accepting a filename. Event handler signalled when the path to FileName has changed. Determines the dialog type executed when the Button in the control is clicked.

DialogKind is a TDialogKind property that indicates the type of dialog executed when the Button for the control is clicked. The default value for the property is dkOpen, as assigned in the constructor. Use one of the other TDialogKind enumeration values to perform its corresponding action.

DialogTitle - the title to appear on the dialog.

DialogTitle is a String property that contains the title displayed on the dialog executed by clicking on Button. The value in DialogTitle is assigned to the TCommonDialog descendant created in the CreateDialog method.

DialogOptions - set of options enabled for the file open dialog.

DialogOptions is a TOpenOptions property which contains the options enabled for a File Open dialog. The default value for the property is defined in the DefaultOpenDialogOptions constant.

Values in DialogOptions control the functionality and visual appearance of the dialog displayed for the control. See for more information about the enumeration values used in DialogOptions.

Filter - the filtering string to help search for the required file. FilterIndex - index value for the filtering string. Default file extension used in the dialog for the component. Hide directory name from edit.

If HideDirectories is set to true, the file name editor displays only a file name, without path.

This may be useful if application allows user to select files from a fixed directory with a long path.
Text displayed on the button for the control. Cursor shape displayed when hovering the mouse over the button for the control. Text displayed in the balloon hint for the button in the control. Controls visibility of the Button when the control loses focus. Width of the Button displayed in the control. TDirectoryEdit - an EditBox to hold a directory name, with an attached SpeedButton that summons a Directory Open dialog. TSelectDirectoryDialog Gets the value for the Directory property. Value for the property. Sets the value for the Directory property. New value for the property. Creates and configures the dialog for the control.

CreateDialog is a TCommonDialog function which creates and configures the Directory Open dialog executed when the Button is clicked for the control. In TDirectoryEdit, the class type instantiated and used as the return value is actually TSelectDirectoryDialog.

CreateDialog ensures that values for the InitialDir and FileName properties in the dialog are set using the properties in the class instance. Directory and Filename are used in the the dialog when the directory exists on the local file system. Otherwise, the initial directory is set to the value in RootDir and the file name is set to the value in Directory.

CreateDialog set the options in the dialog to the values specified in DialogOptions, and the value in DialogTitle is used as the title for the dialog.

CreateDialog is used in the implementation of the RunDialog method.

TSelectDirectoryDialog TCommonDialog
Dialog created and configured in the method. Gets the result from the specified dialog.

GetDialogResult is a String function used to get the result from the Select Directory dialog. The return value contains the value from the FileName property in the TSelectDirectoryDialog instance in D. The return value, when accepted in OnAcceptDirectory, is stored in the Directory property.

GetDialogResult is used in the implementation of the RunDialog method.

TSelectDirectoryDialog TCommonDialog
Directory name from the dialog. Dialog examined in the method. Implements the button handler for the Button in the control.

ButtonClick is an overridden method used to implement the button click handler for the Button in the control. ButtonClick calls the inherited method, and calls RunDialog to display the dialog and capture the directory name. When the dialog has completed, and FocusOnButtonClick is set to True, the FocusAndMaybeSelectAll method is called to give focus to the Edit control and select text as needed.

ButtonClick is called from the BuddyClick method in the ancestor class.

Constructor for the class instance.

Create is the overridden constructor for the class instance, and calls the inherited constructor. Create sets the values in the DialogOptions property to the defaults in DefaultOpenDialogOptions.

Owner of the class instance. Executes the dialog for the control and stores the return value.

RunDialog is a procedure used to execute the dialog for the control, and to store the selected directory name in the control. RunDialog calls CreateDialog to create and configure the dialog executed in the method. When the dialog has completed successfully, GetDialogResult is called to capture the selected directory name.

When assigned, the OnAcceptDirectory event handler is signalled to accept or reject the selected directory name. When rejected, the return value is ignored. When accepted, the value returned from the dialog is stored in the Directory property.

RunDialog is used in the implementation of the ButtonClick method.

TCommonDialog TSelectDirectoryDialog
The Directory selected by the dialog.

Directory is a String property which contains the active directory, and the value displayed in the Edit for the control.

Directory and RootDir determine the values used in the Select Directory dialog executed when the Button is clicked for the control. When Directory is a valid file path on the local file system, it is used as the initial directory displayed in the dialog. Otherwise, the value in RootDir is used as the initial directory and Directory is used as the file name in the dialog.

The value in Directory is updated in the RunDialog method when the dialog for the control has been executed successfully.

The root directory for file system navigation in the control.

RootDir is a String property which identifies the root directory for file system navigation in the Select Directory dialog for the control. Its value, along with Directory, is used in the CreateDialog method to configure the dialog.

RootDir is relevant when Directory does not represent a valid path on the local file system. It is used as the initial directory in the Select Directory dialog. When Directory is a valid file path, RootDir is ignored.

OnAcceptDirectory - event handler for accepting the name of a directory. DialogTitle - the title that appears on the Select Directory dialog. Contains the options enabled for the Open dialog displayed by the control.

The default value for the property is defined in the DefaultOpenDialogOptions set.

DefaultOpenDialogOptions
ShowHidden - if True, display names of hidden directories.

ShowHidden - if True, display names of hidden directories. In Windows etc, show directories under 'Windows' and branches; in Linux etc show directories with preceding dot e.g. '.Lazarus'.

Text displayed on the button for the control. Cursor shape displayed when the mouse hovers over the button for the control. Hint displayed when the mouse hovers over the button for the control. TAcceptDateEvent - generic event handling method for accepting a date from a dialog.

TAcceptDateEvent is an object procedure which specifies an event handler used to examine and verify a TDateTime value.

Senderis the object generating the event notification.

ADate is the TDateTime value examined in the event handler.

AcceptDate is a variable Boolean argument which indicates if the TDateTime value meets the criteria implemented in the event handler. Set AcceptDate to False to indicate that the TDateTime value should be rejected.

TAcceptDateEvent is the type used to implement the OnAcceptDate property in TDateEdit.

Object generating the event notification. TDateTime value examined in the method. Indicates if the Date/Time can be accepted when True. Specifies an event handler used to examine or alter a String with a date value.

TCustomDateEvent is an object procedure which specifies an event handler used to examine or alter a String with a date value in an arbitrary format.

Sender is the object generating the event notification.

ADate is a variable String argument which can be examined or altered in the event handler.

TCustomDateEvent is the type used to implement the OnCustomDate event handler in TDateEdit.

Object generating the event notification. Variable String argument which can be examined or altered in the event handler. Controls the display order for Month, Day, and Year portions of a date value.

TDateOrder is an enumerated type with values that indicate the display order for the Month, Day, and Year portions of a date value.

TDateOrder is the type used to implement the DateOrder property in TDateEdit, and passed as an argument to the ParseDate routine in the implementation for the unit.

No order is specified for the Year, Month, and Day values. Displayed in Month, Day, Year order. Displayed in Day, Month, Year order. Displayed in Year, Month, Day order. Implements a control with an edit box for a date value, with an attached speed button to display a date selection (calendar) dialog.

TDateEdit is a TCustomEditButton descendant which implements a grouped edit control for entering a date value. The control uses an Edit and a Button, as defined in the ancestor class, and implements a Calendar dialog to select a date value when the Button is clicked. The value is stored in the Date property as a TDateTime value.

TDateEdit provides additional properties which are used to configure the Edit and Button controls and the dialog executed when Button is clicked.

Sets the value for the DateFormat property. New value for the property. Converts the specified text to a TDateTime value with an optional default value. TDateTime value for the specified text. Text examined in the method. Default TDateTime value used when the text cannot be converted. Gets the value for the Date property. Value for the property. Sets the value for the Date property. New value for the property. Implements the OnReturnDate event handler used in the dialog in the control.

CalendarPopupReturnDate is a procedure which implements the TReturnDateEvent event handler used to validate and store the date returned from the dialog for the control. It is passed as an argument when calling the ShowCalendarPopup routine in the ButtonClick method.

CalendarPopupReturnDate signals the OnAcceptDate event handler (when assigned) to accept or reject the value in ADate. The value in ADate is stored in the Date property when accepted in OnAcceptDate.

CalendarPopupReturnDate handles any exception which occurs in the method, or in the OnAcceptDate event handler, and displays a Message Dialog with the message from the exception.

ShowCalendarPopup
Object generating the event notification. Date/Time value examined and stored in the method. Implements the event handler used to toggle the visibility of the dialog form for the control.

CalendarPopupShowHide is a procedure which implements the event handler used to toggle the visibility of the dialog form for the control. CalendarPopupShowHide is passed as an argument when calling the ShowCalendarPopup routine in the ButtonClick method.

CalendarPopupShowHide checks the visibility of the form in Sender (a TCalendarPopupForm in this usage), and assigns the value to the DroppedDown property in the class instance.

ShowCalendarPopup
Object generating the event notification; the TCalendarPopupForm instance in this case. Sets the value for the DateOrder property. New value for the property. Converts the specified TDateTime value to a string.

DateToText is a String function used to convert the TDateTime value in the Value parameter to its textual representation. The return value is an empty String ('') when Value is equal to the NullDate constant.

DateToText uses DefaultFormatSettings to generate the return value when DateOrder is doNone using the short date format in the DateFormat property. When DateOrder contains another value from the enumeration, the edit mask for the fixed date format is used to generate the return value.

DateToText is used in the implementation of the SetDate, RealSetText, and EditEditingDone methods.

DefaultFormatSettings DateToStr FormatDateTime
Text for the converted date/time value. TDateTime vale converted in the method. Registers the class reference used to create new instances of the class. Gets the default glyph name displayed on the Button for the control.

GetDefaultGlyphName is overridden in TDateEdit to return the resource name specified in the ResBtnCalendar constant.

Resource name for the default glyph. Implements the handler executed when the Button for the control is clicked. Performs actions needed when the Edit in the control is double clicked.

EditDblClick is an overridden procedure in TDateEdit. It calls the inherited method, and checks to ensure that the control is not marked as ReadOnly before calling the ButtonClick method.

TCustomAbstractGroupedEdit.EditDblClick
Implement the OnEditingDone event handler for the Edit in the control. Sets the value in the DirectInput property.

SetDirectory is overridden in TDateEdit to synchronize the values in the Text and Date properties when DirectInput is changed.

TCustomAbstractGroupedEdit.DirectInput TCustomAbstractGroupedEdit.Text
New value for the property. Sets the value for the control.

RealSetText is overridden in TDateEdit to ensure that DefaultToday is used to set the Date when Text is an empty string. Calls the inherited RealSetText method.

TCustomAbstractGroupedEdit.Text
New value for the control. Applies a mask to the Edit control suitable for the DateOrder in the control. Performs actions needed when the component has finished loading in the LCL streaming mechanism. Create - constructor for TDateEdit: calls inherited Create and sets defaults.

Create - constructor for TDateEdit: calls inherited Create and sets defaults.

Initializes the dialog title, caption, display settings, and the default date.

Owner of the class instance. GetDateFormat - returns the format for the date. Contains the TDateTime value for the control. Indicates the dialog for control is visible when True. CalendarDisplaySettings - governs how the calendar dialog is displayed. OnAcceptDate - event handler for accepting the date selected in the calendar dialog. OnCustomDate - event handler for inserting a custom date. Indicates if the value for the control can be changed. DefaultToday - if True, the current date is offered as the default date (value is False by default). Default value for the property is False. Controls the display order for Year, Month, and Day parts of the date value. Specifies the editing format used for the date value in the control.

DateFormat is a String property which contains the format used when converting the Date value to and from text. DateFormat is relevant when DateOrder contains the value doNone; when another TDateOrder value is used, the fixed format needed for the date order is automatically used.

DateFormat is used in the implementation of the TextToDate and DateToText methods.

Specifies an event handler used to validate and accept/reject a time value.

TAcceptTimeEvent specifies an event handler used to validate and accept/reject a time value in TTimeEdit. TAcceptTimeEvent is the type used to implement the OnAcceptTime property in TTimeEdit.

Object generating the event notification. Time value examined in the method. Indicates the time value is accepted when True. Specifies an event handler used to generate an arbitrary time value.

TCustomTimeEvent specifies an event handler used to generate an arbitrary TDateTime value. TCustomTimeEvent is the type used to implement the OnCustomTime property in TTimeEdit.

Object generating the event notification. TDateTime value generated in the event handler. Implements a control used to edit time values.

TTimeEdit is a TCustomEditButton descendant which implements a control used to edit a time value. TTimeEdit provides the Edit and Button properties defined in the ancestor class, and a dialog that is executed to select a time value when the Button is clicked.

The time value in the control is represented using the TDateTime type; only the time portion of the value is significant.

Gets the value for the Time property. Value for the property. Sets the value for the Time property. New value for the property. Sets the value in the Time property to the empty time value.

SetEmptyTime is a procedure used to set the value in the Time property to the empty time value. The value in NullDate is assigned as the value for the Time property. In addition, the EmptyStr constant is assigned as the value for the Text property. An internal flag is set to indicate that the time value is empty.

SetEmptyTime is used in the implementation of the ParseInput method, and in the constructor for the class instance.

EmptyStr
Gets the value for the SimpleLayout property. Value for the property. Sets the value for the SimpleLayout property. New value for the property. Implements the event handler used to display the popup dialog for the control, and to capture the returned time value. Object generating the event notification. Time value returned from the popup dialog. Implements an event handler used to toggle the visibility of the popup dialog for the control. Object generating the event notification. Configures and displays the popup dialog for the control. Used in the implementation of the ButtonClick and EditDblClick methods. Parses text in the Edit control and stores the value in the Time property. Used in the implementation of the OpenTimePopup and EditEditingDone methods. Gets the resource name for the default glyph displayed on the Button for the control. Resource name for the glyph. Performs actions needed when the Button for the control is clicked. Implements the OnDblClick event handler for the Edit in the control. Implements the OnEditingDone event handler for the Edit in the control. Constructor for the class instance. Owner of the class instance. Represents the time value in the control. Indicates if the popup dialog for the control is visible. DroppedDown is read-only Boolean property which indicates if the popup dialog for the control is visible. Indicates the current time is used for an empty time value.

DefaultNow is a Boolean property which indicates if the time value defaults to the current system time when a empty time value assigned in the control. The default value for the property is False.

DefaultNow is used in the implementation of the GetTime method which gets the value for the Time property.

Event handler signalled to validate and accept/reject the time value for the control. Event handler signalled to get an arbitrary time value for the control. Indicates if the dialog uses a layout with 30 minute intervals between values.

SimpleLayout is a Boolean property which indicates if the popup dialog for the control uses the 2 (rows) by 6 (columns) layout with 30 minute intervals between time values. The default value for the property is True. When set to False, a more detailed layout with 12 rows by 5 columns using 5 minute time intervals is used.

TAcceptValueEvent - generic event handling method for accepting a value from a (calculator) dialog. Implements an numeric edit control with a button to display a calculator dialog.

TCalcEdit is a TCustomEditButton descendant which implements a numeric edit control with a button to display a calculator dialog. It contains properties to configure the button and the calculator dialog. Other properties are provided to access the numeric value as an Integer or a floating point (Double) data type. Use the RunDIalog method to display the calculator dialog and get its return value.

Gets the value for the AsFloat property. Value for the property. Gets the value for the AsInteger property. Value for the property. Sets the value for the AsFloat property. New value for the property. Sets the value for the AsInteger property. New value for the property. FCalcDialog - local variable holding the Calculator Dialog for use with this class. Performs actions needed when the button for the control is clicked.

ButtonClick is an overridden method used to perform actions needed when the Button for the control is clicked. For TCalcEdit, the RunDialog method is called to execute the dialog for the control and to capture it results. When FocusOnButtonClick is set, the FocusAndMaybeSelectAll method is called to give focus to the Edit control in the class.

Constructor for the class instance.

Create is the overridden constructor for the class instance. Create calls the inherited constructor, and sets the default values for the following properties:

DialogTitle
Uses the value in the rsCalculator constant
DialogPosition
Set to poScreenCenter
Owner of the class instance. RunDialog - perform the function of the dialog.

RunDialog is a procedure used display the form which captures the value for the control. For TCalcEdit, a TCalculatorForm instance is used instead of a TCommonDialog descendant as used in other grouped edit controls.

Property values in the class are assigned to the form, such as: DialogTitle, DialogTop, DialogLeft, DialogPosition, and AsFloat. The form is displayed modally, and its value is passed to the OnAcceptValue event handler (when assigned). The accepted value is stored in the AsFloat property.

CalculatorLayout - normal or simple. AsFloat - holds the result of the calculation as a floating-point (double precision) number. AsInteger - holds the result of the calculation as an Integer. OnAcceptValue - event handler for accepting the result of the calculation. DialogTitle - the caption to be used for the dialog. Position where the calculator dialog is displayed.

DialogPosition is a TPosition property with the position where the calculator dialog is displayed when the button for the control is clicked. The default value for the property is poScreenCenter.

Values in DialogPosition, DialogTop, and DialogLeft are assigned to the form for the dialog in the RunDialog method.

TPosition
Vertical coordinate for the dialog displayed for the control. Horizontal coordinate for the dialog displayed for the control. Resource name for the default glyph used on the Button in TCustomControlFilterEdit. Resource name for the default glyph used on the Button in TFileNameEdit. Resource name for the default glyph used on the Button in TDirectoryEdit. Resource name for the default glyph used on the Button in TDateEdit. Resource name for the default glyph used on the Button in TCalcEdit. Resource name for the default glyph used on the Button in TTimeEdit. Registers components in the unit for use in the Lazarus IDE.

Register is the procedure used to add components to the component palette in the Lazarus IDE. Register adds the following components to the Misc tab on the component palette:

  • TEditButton
  • TFileNameEdit
  • TDirectoryEdit
  • TDateEdit
  • TTimeEdit
  • TCalcEdit