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 Lazarus IDE Component Palette:

Misc tab

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

editbtn.pas is part of the LCL (Lazarus Component Library).

Represents a TDateTime type without date and time values.

NullDate is actually a writeable constant. This is used for compatibility reasons. It is however a bad idea to change the value to anything that is an actual date that is withing the range for the TDateEdit control.

The value was modified in LCL version 3.0.
Represents a TDateTime type without a time value assigned. Added in LCL version 3.0. 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.

Calls the corresponding method in the owner control when it is derived from TCustomEditButton.

TCustomSpeedButton.GlyphChanged TCustomEditButton.GlyphChanged
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 classMost 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 FocusOnButtonClick property. Gets the value for the OnButtonClick property. Value for the OnButtonClick property. Gets the value for the Button property. Value for the Button property. Gets the value for the Glyph property. Value for the Glyph property. Gets the value for the NumGlyphs property. Value for the NumGlyphs property. Gets the value for the Edit property. Value for the Edit property. Sets the value for the FocusOnButtonClick property. New value for the FocusOnButtonClick property. Sets the value for the OnButtonClick property. New value for the OnButtonClick property. Sets the value for the ButtonOnlyWhenFocused property. New value for the ButtonOnlyWhenFocused property. Sets the value for the Flat property. New value for the Flat property. Sets the value for the Glyph property. New value for the Glyph property. Sets the value for the NumGlyphs property. New value for the NumGlyphs property. Gets the value for the Images property. Value for the Images property. Sets the value for the Images property. New value for the Images property. Gets the value for the ImageIndex property. Value for the ImageIndex property. Sets the value for the ImageIndex property. New value for the ImageIndex property. Gets the value for the ImageWidth property. Value for the ImageWidth property. Sets the value for the ImageWidth property. New value for the ImageWidth property. Performs actions needed when the button for the control is clicked.

The ButtonClick it a virtual method in TCustomEditButton, and the implementation is empty; use a descendent class which re-implements the method with the functionality needed for the control.

Performs actions needed when the Button for the control is clicked.

BuddyClick calls the inherited method on entry to signal the OnBuddyClick event handler (when assigned), and to perform focus and selection changes. It calls the ButtonClick method to forward the click event to the Edit control.

BuddyClick is called from the private InternalOnBuddyClick method used as the OnClick handler for the Button in the grouped edit control.

TCustomAbstractGroupedEdit.BuddyClick TCustomAbstractGroupedEdit.OnBuddyClick
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. Determines 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
True if the control is visible and has focus, or is configured to always shows its editor button. Gets the name of the default glyph resource used for the Button on the control.

GetDefaultGlyphName is String function used to get the default resource name with the glyph image for the Button on the control. It is used in the LoadDefaultGlyph method to assign the LCLGlyphName for the TButtonGlyph instance used in the control.

GetDefaultGlyphName is a virtual method in TCustomEditButton, and does not provide an actual value (other than an empty string). It must be re-implemented in a descendant class to return the name for its glyph resource. Descendants include:

  • TCustomControlFilterEdit
  • TFileNameEdit
  • TDirectoryEdit
  • TDateEdit
  • TTimeEdit
  • TCalcEdit
TButtonGlyph.LCLGlyphName
Default resource name for the glyph image on the Button in the control. 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.

LoadDefaultGlyph calls GetDefaultGlyphName to get the name for the default glyph resource defined for the class instance. In TCustomEditButton, this is an empty string (''). In a descendent class, another value may be provided. If a glyph name is found, it is assigned to the ButtonGlyph in the Button for the control.

LoadDefaultGlyph is called when Nil assigned to the Glyph property in the control.

Performs action needed when the glyph assigned in Button has been changed. Object for the event notification. TSpeedButton instance used on the edit control.

Button is a read-only TSpeedButton property with the Button displayed on edit control.

Use ButtonWidth, ButtonCaption, ButtonCursor, and ButtonHint to set the display attributes for the Button in the grouped edit control.

At run-time, Button is cast to the TEditSpeedButton type to access the default glyph name for the control. Use Glyph to assign a bitmap used as the glyph for the speed button. As an alternative, the Images property can be used along with ImageIndex and ImageWidth to define an image displayed on the Button.

Use the OnButtonClick event handler to implement the actions performed when the Button is clicked.

Use FocusOnButtonClick to define whether the Edit control receives focus when the Button is clicked.

Contains the caption used for the Button on the edit control.

The property is read from and written to the Caption property for the associated Button control.

TSpeedButton.Caption
Cursor shape displayed when the mouse hovers over the Button in the control.

ButtonCursor is a TCursor property with the cursor shape displayed when the mouse pointer is hovered over the Button for the edit control. The property value is read from and written to the Cursor property in the associated Button control.

The default value for the property is crDefault.

Text displayed in the pop-up hint window when the mouse hovers over the button.

The property value is read from and written to the Hint property in the associated Button for the edit control.

ButtonOnlyWhenFocused - if True, the SpeedButton only appears when focus is given to the EditButton control. Width for the TSpeedButton on the edit control.

The property value is read from and written to the Width property in the associated Button on the edit control.

Edit is the TEbEdit control used to perform direct input for the value in the grouped edit control. TCustomAbstractGroupedEdit.BaseEditor When True, the SpeedButton has a flat appearance rather than a three-dimensional one. 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. Constructor for the class instance.

Create is the constructor for TCustomEditButton. It calls the inherited Create method then sets default values and initializes 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 grayed value "(filter)".

Filters the data and updates the container.

Does its job at once when Immediately is set to True. Otherwise, it connects the asynchronous event handler routine which applies the filter asynchronously in the Application.

Indicates the filter is applied immediately. Gets the value for the Filter property. Value for the Filter property. Sets the value for the Filter property. New value for the Filter property. Sets the value for the IdleConnected property. New value for the property. Performs actions to asynchronously apply the Filter to the Items for the control.

OnAsync is a method used apply the value in the Filter property to the sorted Items for the control. It implements the TDataEvent routine passed as an argument to the Application.QueueAsyncCall method.

OnAsync ensures that the internal flag for pending filter updates is handled by calling the private ApplyFilter method to immediately apply the pending updates. Use the OnFilterItemEx or OnFilterItem (deprecated) event handlers to perform actions needed to implement the filter.

OnAsync is executed (via Application.QueueAsyncCall) when the value in IdleConnected is changed to True. This occurs when InvalidateFilter or ForceFilter are called.

The value in IdleConnected is reset to False when the filter has been applied to the items in the control. OnAsync signals the OnAfterFilter event handler (when assigned).

Introduced in LCL version 3.0 as a replacement for the OnIdle event handler routine. TApplication.QueueAsyncCall
Pointer to an Integer with the data for the asynchronous method. Always contains 0 in OnAsync. 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 default value in 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 Performs actions needed when a new value is assigned to the Filter property.

InternalSetFilter is called from the write access specifier for the Filter property. It performs actions needed when the value in Filter has been changed (and applied to Text), and the control needs to be updated to reflect the modified value.

  • Sets the enabled state for the Button on the control; it is enabled when the AValue argument contains a non-empty value.
  • Sets the values in members for the Filter and FilterLowercase properties.
  • Calls Invalidatefilter to update internal members which cause the control to refresh the list of filtered items when an idle state occurs.
Added in LCL version 3.0.
New filter value applied in the method. 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 matches the Filter value. The DoDefaultFilterItem method is called when the return value from the event handlers 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. Handles a KeyDown event for the Edit control.

EditKeyDown is an overridden method in TCustomControlFilterEdit. It implements the OnKeyDown event handler for the Edit in the grouped edit control. It extends the inherited method to handle additional key down events, including:

  • Return
  • Up, Shift+Up
  • Down, Shift+Down
  • PageUp, Shift+PageUp
  • PageDn, Shift+PageDn
  • Home, Shift+Home, Ctrl+Home
  • End, Shift+End, Ctrl+End

The methods called to respond to the key down event are declared as abstract virtual methods in TCustomControlFilterEdit; they are implemented in descendent classes to call methods in the associated control for the filter edit control.

If the value in Key is handled in the method, Key is set to VK_UNKNOWN (0). Otherwise, the inherited method is called to handle the Key and Shift modifier.

Virtual key code for the key down event. Shift, Alt, or Ctrl modifier for the key down event. Performs actions needed when the Edit for the control is changed.

EditChange is an overridden method in TCustomControlFilterEdit used to apply the Filter for the control when its value has been changed in the edit control. EditChange calls the InternalSetFilter method to apply the Filter value and update the enabled state for the Button on the control.

Modified in LCL version 3.0 to call InternalSetFilter.
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.

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.

True if the value should be selected following the move operation. Moves to the previous value matching the filter for the control.

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

True if the value should be selected following the move operation. Moves one page of previous values matching the filter.

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

True if the value should be selected following the move operation. Moves one page of subsequent values matching the filter.

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

True if the value should be selected following the move operation. Moves to the first value matching the filter.

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

True if the value should be selected following the move operation. Moves to the last value matching the filter.

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

True if the value should be selected following the move operation. 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. Sets flags and property to indicate that the filter must be reapplied for the control.

InvalidateFilter is a method used to indicate that updates to the Filter value are pending for the control. It sets the internal flag used to track pending filter updates, and sets the IdelConnected property to True to enable the asynchronous event handler routine for the control.

InvalidateFilter is called from the private ApplyFilter method when the Filter value is not immediately applied. InvalidateFilter is also called when a new value is applied to the Filter or SortData properties, or when the FilterOptions are modified for the control.

Clears the Filter text to show all items in the control.

ResetFilter clears the existing value in the Filter property by setting it to an empty string (''). This results in the Text for control being set to the same value, and the InvalidateFilter is called when the filter is internally applied to the control.

ResetFilter is called from the BuddyClick method - the OnClick handler routine executed when the associated Button for the control is clicked.

Applies a new Filter immediately without waiting for an idle state.

Calls the private ApplyFilter method to immediately apply the value in Filter using the ApplyFilterCore method in the implementation.

Returns the previous Filter value. 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.

Contains the textual used to select the visible items in the associated control.

Filter is a String property which contains the value used to filter the items in an associated control. Filter is used when the SortAndFilter and ApplyFilterCore methods (in descendent classes) are called to apply the filter value to the items in an associated control.

Changing the value for the property causes the value in the Text property control to be updated. The InternalSetFilter method is called to perform actions needed for the new property value. The new filter will be applied to the associated Control when the OnChange handler for the Edit control is called.

Use FilterLowercase to access the Filter value converted to lowercase UTF-8 characters.

Use FilterOptions to indicate whether case sensitivity is enabled for the filter value; FilterLowercase is used when fsoCaseSensitive has not been included in the set of options.

Use ResetFilter to clear the filter value (and the Text property) for the control. Use ForceFilter to immediately apply a specified Filter value to the items in the associated Control.

Modified in LCL version 3.0 to call InternalSetFilter when a new value is assigned to the property.
The textual representation for the Filter using lowercase characters.

FilterLowercase is a read-only String property which contains the value in Filter converted to lowercase characters. It is used in the implementation of the DoDefaultFilterItem method when case sensitivity has not been 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 in InternalSetFilter, and used when the value for the edit control has been changed.

Indicates if the asynchronous event handler routine is enabled for the Application.

IdleConnected is a Boolean property which indicates if the asynchronous event handler routine is enabled for 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 for the property causes the handler routine to be queued or dequeued as an asynchronous method call for the Application. When set to True, the TApplication.QueueAsyncCall method is called to enqueue the asynchronous event handler routine. Otherwise, the Application.RemoveAsyncCalls is called to remove any pending asynchronous methods.

IdleConnected is set to True in the InvalidateFilter method.

IdleConnected is set to False in the asynchronous event handler routine after the Filter has been applied for the control.

The default value for the property is False.

Application TApplication.QueueAsyncCall TApplication.RemoveAsyncCalls
Indicates whether items are sorted as they are filtered.

SortData is a Boolean property which determines whether items in the filtered control are sorted when the Filter value is applied in the private ApplyFilter method. An explicit default value is not assigned for the property, but the default value for the Boolean type is False.

Changing the value for the property causes the InvalidateFilter method to be called. This method sets internal flags to signify a pending update, and enables the asynchronous event handler routine where the filter value is applied and sorting is performed.

Descendant classes provide an overridden SortAndFilter method which performs the actions needed to filter and sort the item data for an associated control type.

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 characters 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 using the Filter for 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 ([]). Changing the value for the property causes the Filter to be invalidated and re-applied to the items from the associated control.

Event handler signalled after all items have been filtered in the control.

OnAfterFilter is signalled from the asynchronous event handler routine, and occurs after the private ApplyFilter method has been completed.

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). Object instance (TFileNameEdit) for the event notification. 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. Executes an Open or Save dialog for the DialogKind specified in the control.

RunDialog is a virtual method used to create, display, and execute a dialog when the button for the control is clicked. It calls the CreateDialog method to create a TDialogKind instance for the type indicated in the DialogKind property. The Execute method for the dialog is called to display the dialog form. If Execute returns True, the SaveDialogResult method is called to perform the Open or Save action(s) needed for the DialogKind.

RunDialog is called from the ButtonClick method which occurs when the Button for the control has been clicked.

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. Hides directory paths in the edit control.

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. Gets the name of the default glyph resource used for the Button on the control.

GetDefaultGlyphName is an overridden String function used to get the default resource name with the glyph image for the Button on the control. It is used in the LoadDefaultGlyph method to assign the LCLGlyphName for the TButtonGlyph instance used in the control.

In TDirectoryEdit, the return value is set to the ResBtnSelDir constant.

TButtonGlyph.LCLGlyphName
Default resource name for the glyph used on the button in the control. 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.

When ShowHidden is True, the names for hidden directories are displayed. In Windows, this show directories under 'Windows' and branches; in Linux, 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.

Sender is 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. Specifies an event handler signalled prior to validating a date for it lower and upper limits.

TDateRangeCheckEvent is the type used to implement the OnDateRangeCheck property in TDateEdit. TDateRangeCheckEvent allows the control to perform actions needed for the existing value in ADate prior to validating and/or limiting the value to a specific range.

Object (TDateEdit) for the event notification. The existing TDateTime value for the handler routine. 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 and 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 displays a pop-up Calendar dialog to select a date value when the Button is clicked. The selected date 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.

TDateEdit has an overridden ButtonClick method which displays the pop-up Calendar dialog. This method includes logic to set the minimum and maximum date values for the native calendar control on the dialog. For the Windows platform, the value limits are September 14, 1752 and December 31, 9999. This functionality is not supported for all platforms. Specifically, GTK2 and GTK3 do not support the minimum and maximum date values on their native calendar controls.

Signals the OnDateRangeCheck event handler and validates a date for its lower and upper limits. Sets the value for the DateFormat property. New value for the property. Sets the value for the MaxDate property. Sets the value for the MinDate 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 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 which toggles 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 DateOrder 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 formatting mask for the date order is used to generate the return value; i. e. 'mm/dd/yyyy'.

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 name of the default glyph resource used for the Button on the control.

GetDefaultGlyphName is an overridden String function used to get the default resource name with the glyph image for the Button on the control. It is used in the LoadDefaultGlyph method to assign the LCLGlyphName for the TButtonGlyph instance used in the control.

In TDateEdit, the return value is set to the ResBtnCalendar constant.

TButtonGlyph.LCLGlyphName
Default resource name for the glyph image on the control. Displays a pop-up calendar dialog when the Button for the grouped edit control is clicked.

ButtonClick is an overridden method in TDateEdit. It implements the virtual method defined in the ancestor class, and is called when the Button for the grouped edit control is clicked.

ButtonClick creates, displays, and executes a pop-up calendar dialog used to get a TDateTime value. The value in the Date property is passed as the initial date displayed on the dialog form. If Date contains the NullDate value, the current system date is used.

Values in the MinDate and MaxDate properties are used to validate and to limit the range of dates displayed on the pop-up calendar. When the properties contain non-zero values that are at least one day apart, they are used as the lower and upper limits for the value in Date. Otherwise, the MinDateTime and MaxDateTime RTL constants are used as the limits for the date value.

The ShowCalendarPopup routine is called to display and execute the dialog form. Set values in CalendarDisplaySettings and DefaultToday to control the appearance and behavior for the calendar on the dialog.

For the Windows platform, additional validation is performed to ensure that Date is within the range of values allowed for the native calendar control. The minimum date value is "1752-09-14" (September 14, 1752) for the start of the Gregorian calendar. The maximum date value is "9999-12-31" (December 31, 9999). This is done to prevent an exception when an invalid value is passed to the native calendar control. When DefaultToday is enabled, Date defaults to the current system date for a value outside this range. When not enabled, the MinDate and MaxDate values are used to range limit the date.

Assign a routine to the OnAcceptDate event handler to perform actions needed when a new date value is selected using the dialog. Enable FocusOnButtonClick to focus and optionally auto-select the value in the edit control after the dialog has been closed.

TCustomAbstractGroupedEdit.FocusAndMaybeSelectAll ShowCalendarPopup
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
Implements the OnEditingDone event handler for the Edit in the control.

EditEditingDone is an overridden method in TDateEdit. It calls the inherited method on entry to signal the OnEditEditingDone event handler (when assigned).

If DirectInput is enabled, the value in Date is converted to a string and stored in the Text property. Values in DateOrder, DateFormat, or the default date format settings for the locale are used to determine the content for the converted value. An empty string ('') is assigned to Text when Date contains the NullDate value.

TCustomAbstractGroupedEdit.EditEditingDone TCustomAbstractGroupedEdit.OnEditingDone
Sets the value in the DirectInput property.

SetDirectInput is overridden in TDateEdit to synchronize the value from the Text property to the Date property when the property value in DirectInput is changed. The OnCustomDate event handler is signalled (when assigned) to handle a custom date format or value in Text. DateOrder is used to determine the order of the date component values in Text. When DateOrder is doNone, the format setting in DefaultFormatSettings or DateFormat is used. An implementation routine is used to parse the value in Text if cannot be converted using TryStrToDate or ParseDate.

Date is set to the value in NullDate if Text is not successfully converted to a TDateTime value.

Date may contain an uninitialized value at design-time.
TCustomAbstractGroupedEdit.DirectInput TCustomAbstractGroupedEdit.Text
New value for the property. Sets the value for text in 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 an EditMask based on the DateOrder for the control.

SetDateMask is a method used to update the EditMask for the control. It also updates the internal member where a FormatDateTime-compatible format string is stored. The mask value is determined by the DateOrder property, and uses the following TDateOrder and edit mask values:

doNone
EditMask is set to an empty string (''). The date format string is also an empty string.
doDMY, doMDY
EditMask is set to '99/99/9999;1;_'. The date format string is set to 'mm/dd/yyyy' (for doMDY) or 'dd/mm/yyyy' (for doDMY).
doYMD
EditMask is set to '9999/99/99;1;_'. The date format string is set to 'yyyy/mm/dd'.

SetDateMask retrieves and re-applies the current value in Date after the EditMask has been changed. This forces the display value in Text to be updated.

SetDateMask is called when a new value is assigned to the DateOrder property.

TCustomAbstractGroupedEdit.EditMask
Performs actions needed when the component has finished loading in the LCL streaming mechanism.

Loaded is an overridden method in TDateEdit. The overridden method ensures that the value in Date is re-applied at run-time.

Date defaults to the current system date when Value is a null date and DefaultToday is True. The assignment causes Date to be range-limited to the minimum and maximum values in MinDate and MaxDate (when assigned), or the limits for the Date type. Date is not updated at design-time.

The string representation for the date value is also applied to the Text property. The value in DateOrder determines the date format used for the text value.

Loaded calls the the inherited method prior to exit to update the spacing and color for the control.

Modified in version 2.2.4 (e7e585f1) to call the inherited Loaded method on exit instead of on entry. This allows the OnChange handler to be signalled once after both the Date member and Text have been updated. TCustomAbstractGroupedEdit.Loaded TCustomAbstractGroupedEdit.UpdateSpacing TCustomAbstractGroupedEdit.Color
Signals the OnDateRangeCheck event handler (when assigned).

DoDateRangeCheck is called when a date value is validated and range checked for its lower and upper limits. It is called prior to validation of the date value, and allows the OnDateRangeCheck event handler to perform any actions needed for the control. DoDateRangeCheck occurs when a new value is assigned to either the MinDate or MaxDate property, and when ButtonClick is called to display the pop-up calendar dialog for the control.

Date value for the event notification. Constructor for the class instance.

Create is the constructor for TDateEdit. It calls the inherited Create method and sets the default values for properties in the class instance.

Create initializes the dialog title, caption, display settings, and the default date.

Owner of the class instance. Gets the FormatDateTime-compatible format specification used for the current DateOrder in the control.

GetDateFormat reads the member value assigned when the SetDateMask method is called. It contains the FormatDateTime-compatible format specification used to convert values in Text and Date when DateOrder has a value other than doNone.

GetDateFormat is not used in the current LCL version.

Use the DateFormat property for the format used when DateOrder is set to doNone.

String with the fixed date format for the DateOrder in the control. Contains the TDateTime value for the control.

Date is a TDateTime property with the date value for the control. The Time component in the value is ignored in TDateEdit. Date is a public property, so it is not available in the Object Inspector at design-time. But its value can be assigned in program code at run-time.

Date provides the value displayed and updated using the Edit for the control when DirectInput is enabled. It is updated when the Button for the control is clicked and a new value is selected from the calendar dialog.

Setting a new value for the property causes the new date to be validated. An empty date is represented using the NullDate value. When the property value is NullDate and DefaultToday is enabled, the current system date is used.

MinDate and MaxDate are used (when assigned) to ensure that the new property value is within the specified range of dates. They are not used to limit the value in Date if either of the properties contain NullDate, or are not at least one day apart. When not used, the MinDateTime and MaxDateTime RTL constants are used as the lower and upper limits for the date value.

The value in Text is updated when the new value is stored in the Date property.

Use DateOrder to control the order of the date components displayed on the control and in the Text property. Use DateFormat to specify the FormatDateTime-compatible formatting string used when DateOrder is set to doNone. The default format settings for the locale are used to generate the value in Text when both DateOrder and DateFormat are not used.

Indicates the calendar dialog for the control is visible when True.

DroppedDown is a read-only Boolean property which indicates if the calendar dialog form is visible for the control. The property value is updated when the calendar dialog form is displayed or hidden in the ButtonClick method.

Display or behavior options enabled in the pop-up calendar dialog for the control.

CalendarDisplaySettings is a TDisplaySettings property with the display and behavior options enabled in the calendar dialog for the grouped edit control. It contains zero or more values from the TDisplaySetting enumeration, and enables the features or behaviors in the calendar control. The default values in the set type are [dsShowHeadings, dsShowDayNames].

See TDisplaySetting for more information about the values in the enumeration and their meanings.

The property value is passed as an argument to the ShowCalendarPopup routine when the Button is clicked for the control.

TDisplaySettings TDisplaySetting TCustomCalendar.DisplaySettings ShowCalendarPopup
Event handler signalled to accept or reject a new date value selected using the calendar dialog for the control.

OnAcceptDate is a TAcceptDateEvent property with the event handler signalled to accept or reject a new value for the Date property. The handler routine can perform actions to validate or update the TDateTime and Boolean arguments.

OnAcceptDate is signalled (when assigned) when the pop-up calendar dialog is displayed for the grouped edit control. The handler routine can update the value in the date argument if its value is not in an acceptable range. If the Boolean argument is True on exit from the handler, the date argument is stored to the Date property. Otherwise, the new date/time value is discarded.

An exception raised during execution of the pop-up calendar dialog is handled in the class instance; MessageDlg is called to display the exception message.

OnCustomDate - event handler for inserting a custom date.

OnCustomDate is a TCustomDateEvent property with the event handler signalled to validate or update a string value before it is converted to the TDateTime type. OnCustomDate is signalled (when assigned) when the value in Text is converted to the TDateTime type used in the Date property. It also occurs when a new value is assigned to DirectInput, and when reading the value for the Date property when DirectInput is enabled.

Event handler signalled prior to validating and range checking a date value.

OnDateRangeCheck is a TDateRangeCheckEvent with the event handler signalled prior to validating and range checking a date value. It allows the application to perform actions needed before a date value is potentially updated. An application can implement and assign a routine to the handler which responds to the event notification.

OnDateRangeCheck is signalled (when assigned) from the DoDateRangeCheck method. It occurs when a new value is assigned to either the MinDate or MaxDate property, and when ButtonClick is called to display the pop-up calendar for the control.

True to use the current system date when a Date value is not available.

DefaultToday is a Boolean property which indicates if the current system date is used when the Date property has not been assigned or contains an invalid date value. The default value for the property is False.

DefaultToday is used in the ButtonClick method, and causes SysUtils.Date to be used as the date value when set to True. This occurs when the date contains the NullDate value, or when the date is not within the date range allowed for a given platform. It is used when a new value is assigned to the DirectInput property and a valid date has not been assigned to the Date property. It is also used when a new value is assigned to Text and DirectInput has not been enabled for the control.

Controls the display order for Year, Month, and Day parts of the Date value.

DateOrder is a TDateOrder property which indicates the order of the Year, Month, and Day parts of the Date value. Values in the enumeration include:

doNone
No order is specified. The value in DateFormat is used instead. EditMask is set to ''.
doMDY
Displays values in Month, Day, Year order and uses the format specification 'mm/dd/yyyy'. EditMask is set to '99/99/9999;1;_'.
doDMY
Displays values in Day, Month, Year order and uses the format specification 'dd/mm/yyyy'. EditMask is set to '99/99/9999;1;_'.
doYMD
Displays values in Year, Month, Day order and uses the format specification 'yyyy/mm/dd'. EditMask is set to '9999/99/99;1;_'.

Setting a new value for the property causes SetDateMask to be called to update the EditMask for the control.

DateOrder is also used when the value in Date is converted to a String type and stored in the Text property.

Use DateFormat for the format specification used when DateOrder is doNone.

TCustomAbstractGroupedEdit.EditMask
Specifies the format string 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 used 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.

Smallest date value allowed in the date edit control.

MinDate is a TDateTime property which indicates the smallest value allowed in the Date property. Along with MaxDate, it defines a range limit for possible Date values in both the edit control and the pop-up calendar form displayed when its Button is clicked.

The default value for the property is an empty date/time value (0.0), and indicates that neither MinDate nor MaxDate are used to limit the values in Date. Setting a new value for the property causes the date value to be validated. It must be in the range of valid TDateTime values defined in the RTL MinDateTime and MaxDateTime constants. An EInvalidDate exception is raised if the new value is outside the allowed range.

The value in Date is adjusted (when needed) if its value is smaller than the new value for the MinDate property. No actions are needed if MinDate and MaxDate have not been assigned, or are not at least one day apart.

Time component values (hours, minutes, seconds, milliseconds) in MinDate are ignored in TDateEdit.

Use MaxDate to specify the largest value allowed in the Date property.

MinDate and MaxDate are not implemented for all platforms supported in the LCL. Specifically, GTK2 and GTK3 do not implement MinDate and MaxDate in their native calendar controls.
EInvalidDate MinDateTime MaxDateTime
Largest date value allowed in the date edit control.

MaxDate is a TDateTime property which indicates the largest value allowed in the Date property. Along with MinDate, it defines a range limit for possible Date values in both the edit control and the pop-up calendar form displayed when its Button is clicked.

The default value for the property is an empty date/time value (0.0), and indicates that neither MinDate nor MaxDate are used to limit the values in Date. Setting a new value for the property causes the date value to be validated. It must be in the range of valid TDateTime values defined in the RTL MinDateTime and MaxDateTime constants. An EInvalidDate exception is raised if the new value is outside the allowed range.

The value in Date is adjusted (when needed) if its value is larger than the new value for the MaxDate property. No actions are needed if MinDate and MaxDate have not been assigned, or are not at least one day apart.

Time component values (hours, minutes, seconds, milliseconds) in MaxDate are ignored in TDateEdit.

Use MinDate to specify the smallest value allowed in the Date property.

MinDate and MaxDate are not implemented for all platforms supported in the LCL. Specifically, GTK2 and GTK3 do not implement MinDate and MaxDate in their native calendar controls.
EInvalidDate MinDateTime MaxDateTime
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 NullTime 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. Tries to parse and convert the specified string to a time value. True if the text was successfully converted to a TDateTime value. String with the time to convert in the method. Returns the TDateTime with the time value converted in the method. Gets the name of the default glyph resource used for the Button on the control.

GetDefaultGlyphName is an overridden String function used to get the default resource name with the glyph image for the Button on the control. It is used in the LoadDefaultGlyph method to assign the LCLGlyphName for the TButtonGlyph instance used in the control.

In TTimeEdit, the return value is set to the ResBtnTime constant.

TButtonGlyph.LCLGlyphName
Default resource name for the glyph used on the button in the control. Performs actions needed when the Button for the control is clicked. ShowTimePopup 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.

Specifies an event handler signalled when a calculator dialog has been used to accept or reject a value.

TAcceptValueEvent is the type used for the OnAcceptValue property in TCalcEdit. Implement and assign a routine using the signature for the event handler to respond to selection of a value using a calculator dialog. Use the AValue and Accept variable arguments to determine the value and action returned from the dialog instance.

Object instance (TCalcEdit) for the event notification. Double type with the value returned from the dialog for a calculator dialog. Returns True if the OK button was used to accept the value on the dialog. Otherwise, the return value is False. 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 Lazarus component palette:

Misc Tab

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