From 6d30732ad9113134c85bc25ce79624e67deae097 Mon Sep 17 00:00:00 2001
From: dsiders
- When the dialog is executed, the selected font is made available in the Font property. The OnApplyClicked event handler can be used to perform actions needed when the optional Apply button is clicked in the dialog. + At run-time, TFontDialog is mapped to the native font selection dialog used for a given platform. Use Options to enable or disable features or behaviors in the dialog. Enabling an option does not mean that it is automatically available. Some options may not be supported in the native dialog for a given platform. +
++ When the dialog is executed, the selected font and its attributes is made available in the Font property. The OnApplyClicked event handler can be used to perform actions needed when the optional Apply button is clicked in the dialog.
- Font is a TFont property with the font selected using the dialog. The value in Font is updated in widgetset classes when the OK or Apply button is clicked during execution of the dialog. + Font is a TFont property with the font selected using the dialog. The value in Font is updated in widgetset classes when the OK or Apply button is clicked during execution of the dialog. It includes any attributes applied to font in the native font selection dialog for the platform.
Use the OnApplyClicked event handler to perform actions needed when the Apply button is enabled and clicked in the dialog. @@ -2062,6 +2071,9 @@ ADialog.CustomColors.Values['ColorA'] := 'FFFF00';
Include or Exclude values for the property prior to calling the Execute method.
++ TFindOption is an enumerated type with values representing options that can enabled in TFindDialog and descendants. Values from TFindOption are stored in the TFindOptions set type, and used to implement the TFindDialog.Options property. +
++ TFindOptions is a set type used to store zero (0) or more values from the TFindOption enumeration type. Adding an enumeration value to the set indicates that the option is enabled. +
++ TFindOptions is the type used to implement the TFindDialog.Options property. +
++ DefaultTitle is an overridden String function in TFindDialog. It reimplements the method to return the value in the rsFind constant as the default caption or title for the dialog. The return value is assigned to the Title property in the inherited constructor for the class instance. +
++ FindClick is a method which implements the event handler signalled when the Find button on the dialog form is clicked. +
++ FindClick calls GetFormValues to update Options from the settings on the internal form instance for the dialog. It also ensures that Options contains only find-related enumeration values, and not those intended for a replace dialog. +
++ FindClick calls Find to signal the OnFind event handler (when assigned). +
++ The method is assigned to the OnClick event handler for the Find button in the CreateForm method. +
++ HelpClick is a method which implements the event handler signalled when the Help button on the dialog form is clicked. +
++ HelpClick calls the Help method to signal the OnHelpClicked event handler (when assigned). +
++ The method is assigned to the OnClick event handler for the Help button in the CreateForm method. +
++ CancelClick is a method which implements the event handler signalled when the Cancel button on the dialog form is clicked. +
++ CancelClick calls the CloseDialog method to close the internal form instance for the dialog (when assigned). +
++ The method is assigned to the OnClick event handler for the Cancel button in the CreateForm method. +
++ GetHeight is an overridden method in TFindDialog. It checks whether the internal TForm instance has been assigned for the dialog, and returns the form height when it is available. Otherwise, the inherited method is called to get the value in the Height member. +
++ GetWidth is an overridden method in TFindDialog. It checks whether the internal TForm instance has been assigned for the dialog, and returns the form width when it is available. Otherwise, the inherited method is called to get the value in the Width member. +
++ DoCloseForm is a method which implements the event handler signalled when the internal form instance for the dialog is closed. No actions are performed in the method at design-time (csDesigning is in ComponentState property). +
++ DoCloseForm stores the Left and Top coordinates from the form to the corresponding properties in the class instance. The property values are assigned as default values when a new form instance is created in CreateForm. +
++ DoCloseForm is assigned to the OnClose event handler for the internal TForm instance when the Execute method is called. +
++ DoShowForm is a method which implements the event handler signalled when the internal form instance for the dialog is displayed. No actions are performed in the method at design-time (csDesigning is in ComponentState property). +
++ DoShowForm signals the OnShow event handler (when assigned) in TFindDialog to notify the dialog when the form calls its Show method. +
++ DoShowForm is assigned to the OnShow event handler for the internal TForm instance when the Execute method is called. +
++ Find is called from the FindClick method, and occurs when the dialog is executed. An application must assign a TNotifyEvent routine to OnFind to perform the actions needed for the dialog. No actions are performed in the method if an event handler routine has not been assigned to OnFind. +
++ Help is a method used to perform actions needed when the Help button on the dialog form is clicked. Help signals the OnHelpClicked event handler (when assigned) to perform the required actions. An application must assign a TNotifyEvent handler routine to OnHelpClicked. No actions are performed in the method when OnHelpClicked has not been assigned. +
++ Help is called from the HelpClick method, and occurs when the dialog is Executed. +
++ Replace is introduced in TFindDialog, but it is used in the implementation of the TReplaceDialog descendant. +
++ CreateForm is a TForm function used to create the form displayed for the dialog. The form class is defined in the implementation section. It contains the controls needed for the edits, labels, buttons, radio buttons, and check boxes displayed for the dialog. It includes the controls needed to represent the TFindOption values in the Options property. +
++ CreateForm ensures that translated/localized resource strings are assigned to the captions for the form controls. OnClick event handlers are assigned for the Find, Help, and Cancel buttons on the form. The initial Left and Top coordinate are also assigned to the form. +
++ Use the OnFind, OnHelpClicked, OnShow, and OnClose event handlers to implement the specific actions performed when the dialog is executed. +
++ CreateForm is called from the Execute method when the form instance has not already been assigned. +
++ SetFormValues copies values from the properties in the class instance to the controls displayed on the dialog form. This includes the values in FindText and Options. +
++ Enumeration values in Options are examined and applied to the radio button or check box used to represent a specific value. The Help button on the dialog form is made visible when frShowHelp is included in Options. The Scope check box is made visible when frHideEntireScope is not present in Options. +
++ SetFormValues ensures that the edit control for FindText is the active control on the form and its text content is selected. +
++ SetFormValues is called from the Execute method, and occurs after the form instance has been created and positioned. It is called before the form is displayed and executed using its buttons. +
++ See GetFormValues for the actions performed when the Find button is clicked on the dialog form. +
++ GetFormValue is used to update the dialog class instance with the values entered on the dialog form at run-time. +
++ GetFormValue is called from the FindClick method which is used as the OnClick event handler for the Find button on the dialog form. It is called before the values in Options are sanitized and the Find method is called to perform the search. +
++ See SetFormValues for the actions performed to load properties to the dialog form. +
++ CalcPosition ensures that both the form and the class instance are updated with the location where the form is displayed. The Position property in the form instance is updated to display the form in the correct relative location. +
++ At design-time, the dialog form is aligned to the center of the Screen (poScreenCenter). +
++ At run-time, the dialog form is aligned to the center of the main form in the application (poMainFormCenter) when the Left and Top coordinates in the dialog are set to their unassigned values. The Left and Top coordinates are stored in the class instance for subsequent use in the CreateForm method. +
++ ReplaceText is introduced in TFindDialog, but it is used in the implementation of the TReplaceDialog descendant. +
++ An application must implement and assign a TNotifyEvent handler routine to OnReplace which responds to the event notification. +
++ The Sender argument contains the object instance with the TFindDialog or descendant for the event notification. It can be cast to a TFindDialog or a TReplaceDialog type to access properties and methods in the dialog class, including: FindText, ReplaceText, and Options. +
++ OnReplace is introduced in TFindDialog, but it is used in the implementation of the TReplaceDialog descendant. Use TReplaceDialog when the additional controls and buttons implemented in the replace dialog are needed. +
+- Create is the constructor for TFindDialog, and calls the inherited Create method. It sets the initial option values for Find only. + Create is the constructor for TFindDialog, and calls the inherited Create method. It sets the initial value in Options to [frDown]. It also stores the unassigned value (-1) for both the Left and Top properties in the class instance.
+ Destroy is the overridden destructor for the class instance. It ensures that the internal TForm instance for the dialog form is freed (when assigned). Destroy calls the inherited destructor to perform and remove free notifications for the referenced counted component. +
++ CloseDialog is called from the CancelClick method (the OnClick handler for the Cancel button on the dialog form). CloseDialog ensures that the internal TForm instance for the dialog class has been assigned, and calls its Close method. This initiates a series of method calls and event handler notifications needed to close the form. +
++TCustomForm.Close -> + TCustomForm.OnClose -> + TFindDialog.DoCloseForm -> + TCommonDialog.OnClose ++
+ Execute is an overridden Boolean function used to display the internal dialog form and respond to button clicks on the form. Execute reimplements the method defined in the ancestor class, and does not call the inherited method. +
++ If a TForm instance already exists in the dialog class, it is reused. If not, CreateForm is called to create and configure the TForm instance displayed for the dialog. The return value is False if a TForm instance was not successfully created in CreateForm. +
++ When a valid form exists for the dialog, it is positioned on the screen by calling CalcPosition. SetFormValues is called to transfer property values in the class instance to the dialog form. The Title, HelpContext, OnClose and OnShow properties in the form are updated and its Show method is called to display and execute the form. Values from the Height and Width properties in the form are stored in the dialog class for use as the default size. +
++ The return value is True if the form was successfully configured and displayed in the method. +
++ Use the OnFind, OnHelpClicked event handlers to perform actions needed when either the Find or the Help button on the dialog form is clicked. The Cancel button calls CloseDialog when the button is clicked. +
++ Left is an Integer property which contains the horizontal coordinate where the left edge of the dialog form is located. The default value for the property is -1 and represents the unassigned value. +
++ The property value is read from the Left property in the internal TForm instance for the dialog (when assigned). Changing the value in the property causes the Left property in the dialog form to be updated with the new coordinate value. The value for the property is updated in the CalcPosition method when the dialog is executed. +
++ Left and Top are used in the CreateForm method to set the default coordinates for the dialog form. +
++ Position is a TPoint property with the coordinates where the dialog is displayed. The X and Y members in the TPoint instance contain the values from the Left and Top properties (respectively). Changing the value for the property causes the Left and Top properties to be updated with the new member values. +
++ Top is an Integer property which contains the vertical coordinate where the top edge of the dialog form is located. The default value for the property is -1 and represents the unassigned value. +
++ The property value is read from the Top property in the internal TForm instance for the dialog (when assigned). Changing the value in the property causes the Top property in the dialog form to be updated with the new coordinate value. The value for the property is updated in the CalcPosition method when the dialog is executed. +
++ Left and Top are used in the CreateForm method to set the default coordinates for the dialog form. +
++ FindText is a String property with the value to locate when Find button is clicked on the dialog form. Changing the value for the property causes the corresponding edit control on the dialog form to be updated (when assigned) with the new value. +
++ Use the OnFind event handler to perform the actions needed to located the value in FindText using the Options enabled for the dialog. +
++ Options is a TFindOptions property which contains the set of find / replace options enabled for the dialog. The set type contains zero (0) or more values from the TFindOption enumeration. The default value for the property is [frDown] and indicates the search direction in the dialog. +
++ Changing the values in the property causes the controls on the dialog form to be updated (when assigned). For example: +
++ Other values in Options control whether controls on the dialog form are visible or enabled, and are applied when the SetFormValues method is called. These include: +
++ Values in Options are updated in the GetFormValues method, which is called when the Find button is clicked on the dialog form. The Option values affected include: +
++ OnFind is a TNotifyEvent property with the event handler signalled to perform the find operation for the dialog. OnFind is signalled (when assigned) from the Find method, and occurs when the Find button is clicked on the dialog form. +
++ An application must implement and assign a handler routine to the property to respond to the event notification. +
++ The Sender argument is the object instance for the event notification. It can be cast to TFindDialog (or TReplaceDialog in the descendent class) to access the properties and methods in the dialog class instance. Use its FindText and Options properties to perform the actions needed in the handler routine. +
++ OnHelpClicked is a TNotifyEvent property with the event handler signalled to display context help for the find dialog. It can be used to locate, format, and display the help associated with the dialog. OnHelpClicked is signalled from the Help method (when assigned), and occurs when the Help button is clicked on the dialog form. +
++ An application can implement and assign a handler routine to the property to respond to the event notification. The Sender argument contains the object instance for the event notification. It can be cast to TFindDialog (or TReplaceDialog for the descendent class) to access properties and methods specific to the dialog class instance. The handler routine is responsible for all aspects of the context help display. +
++ Include frShowHelp in the Options property to enable the Help button on the dialog form. +
+
The dialog appears and offers boxes for the user to enter text for searching and text to replace it, for example while editing a file or large piece of text.
@@ -4688,6 +5148,81 @@ var
+ PromptForFileName is a Boolean function used to display an Open or Save dialog using the values passed as arguments to the routine. It creates a TOpenDialog or a TSaveDialog instance for use in the routine. The AIsSaveDialog argument determines which dialog class is used in the routine. +
++ Argument values are assigned to the corresponding properties in the dialog class. The Execute method in the dialog class is called to perform file selection or creation as needed, and its return value is used as the return value for the routine. The return value is True when the Execute method for the dialog class returns True. +
++ AFilename contains the initially selected file name in the dialog, and is updated with the value selected using the dialog. A default value is not provided for the argument. If the dialog returns True, the FileName property in the dialog class is assigned to the AFileName argument. +
++ AFilter contains file masks that can be selected in the dialog. The default value is an empty string ('') and causes the all files mask ('*.*' or '*') to be used. See TFileDialog.Filter for more information about the notation allowed in the argument. +
++ ADefaultExt contains the file extension used for the file name selected in the routine. The default value for the argument is an empty string ('') and indicates that a default file extension is not used. See TFileDialog.DefaultExt for more information about default extensions. +
++ ATitle contains the caption displayed on the dialog. The default value is an empty string ('') and allows the default value provided by the dialog class to be used. +
++ AInitialDir indicates the initial directory when the dialog is displayed. The default value is an empty string ('') and causes the current directory in the application to be used as the initial directory in the dialog. +
+