diff --git a/docs/xml/lcl/controls.xml b/docs/xml/lcl/controls.xml
index 0f5e75238c..c3b9d7a195 100644
--- a/docs/xml/lcl/controls.xml
+++ b/docs/xml/lcl/controls.xml
@@ -6867,46 +6867,55 @@ Without a DockManager both extents are required, because no (valid) alignment in
Does not check for invisible parents Does not check for invisible parents These values must correspond to the SB_xxx values in LCLType. Despite similarities in appearance to TCustomEdit and TCustomList,
- the class inherits no properties from these classes, but only from TWinControl
+
+ A ComboBox combines an edit box with an item list.
+ The list can be either static (always visible), or drops down when needed.
+ [Should read combines an edit box, but fpdoc errors?]
+
+ Depending on the ComboBox Style the user can type text into the edit box,
+ or he can select items from the Items list.
+ Despite similarities in appearance to TCustomEdit and TCustomList,
+ the class inherits no properties from these classes (Delphi compatible).
+ It has some interesting properties including AutoComplete and AutoCompleteText, AutoDropDown
+ and the ability to create and add a History display.
+ [how to use all that?]
It has some interesting properties including AutoComplete and AutoCompleteText, AutoDropDown and the ability to create and add a History display Software emulation of OnDrawItem event, in OwnerDraw mode. Calls the OnDrawItem handler, if installed.
@@ -928,7 +937,7 @@
- If the text AValue occurs in the list of strings, then sets the Itemindex, otherwise does the default action which is to store text as a string rather than performing read-write to a PChar buffer The inherited method provides software emulation of the event handler OnKeyDown which acts if a key has been pressed and is still down The inherited method invokes the OnKeyPress handler, allowing for further input processing.
This property exists as a Set of Options, so zero or more options may be operational If False, the drop-down box only appears when the down button at the end of the box is selected If False, the drop-down list only appears when the down button to the right of the edit box is clicked. When True, the edit control will select all its text when: True indicates that the combobox control has just performed an AutoSelect operation so that subsequent mouse-clicks and keystrokes
proceed normally without selecting the text. False is set when the combobox control loses focus. Indicates how text is displayed in a text editing control Setting the ItemIndex selects the item in the list. The first item has number 0, the second has number 1, the third number 2, etc. The first list item has index 0, up to ListCount-1. If no item is selected, ItemIndex is -1.
@@ -1310,24 +1319,24 @@
Some widgetsets like gtk call this just before the list drops down, while others do it on handle creation. This event allows to handle both cases with one event. @@ -1421,13 +1436,13 @@
The default text-string (if any, entered in the Form Designer) and the value of the text string that is ultimately selected from the drop-down list, is held in Text +
The Text property reflects the text entered into the edit box, or selected from the list.
-The values that can be selected from the drop-down list are held in the string-array Items. Clicking on the ellipsis (...) next to Items in the Object Inspector opens a pop-up string-list editor which allows the designer to enter and edit a number of lines of text to represent the selections
-At run-time, the entry selected from the drop-down list in Items is used to replace any information previously found in Text, and ItemIndex holds the (zero-origin) index number of the selected item
-If no value is selected from the drop-down list, the default text (if any) remains, or any information typed directly into Text will be returned, and ItemIndex takes the value of -1
+The selectable values are kept in the Items list. + Clicking on the ellipsis (...), next to Items in the Object Inspector, + opens an editor which allows the designer to populate the Items list.
+At run-time, the entry selected from the list replaces the text in the edit box, + and ItemIndex holds the (zero-based) index number of the selected item.
+If no value is selected from the drop-down list, the default text (if any) remains, or any information typed directly into Text will be returned, + and ItemIndex takes the value of -1
+ A ListBox can have multiple columns, not only multiple rows. +
+ When Columns is greater than zero, it specifies the number of columns that are visible without horizontal scrolling. + I.e. the width of a single column becomes Width/Columns. +
++ Normally a click into the list selects one item, and deselects all other items. +
+ When MultiSelect is True, the user can select/deselect further items with CTRL-click. +
+ When ExtendedSelect also is True, the user can SHIFT-click on an item, to select all items between this and the last selected item. +
++ Reading allows to access the contents of the list (TStrings compatible). +
+ Assign another string list to replace the items. +
+The array of strings is held in Items +
The strings are stored in the Items list.
-Clicking on the ellipsis (...) next to the Items entry in the Object Inspector at design-time opens a string-list editor in which the individual text-strings for the list can be entered or edited. The editor also allows the entries to be sorted alphabetically in normal or reverse order.
+At design time a click on the ellipsis (...) next to the Items entry in the Object Inspector + opens an string-list editor, in which the individual text-strings for the list items can be entered or edited. + The editor also allows the entries to be sorted alphabetically in normal or reverse order.
This control deals, for example, with issues such as selection of text sub-strings within the whole text string which are to be edited (cut, pasted, deleted, highlighted etc)
+This class implements various visual attributes of the control and its contained text, + as well as simple editing and clipboard operations. +
+Text attributes (bold, italic...) are not supported. + [see TSynEdit...?] +
Private variable for property AutoSelect.
-When True, the edit control will select all its text when:
-Private variable for property CharCase. - -Indicates how text is displayed in a text editing control.
-If True, indicates that the edit control has just performed an AutoSelect operation so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text.
-False is set when the edit control loses focus.
+ Character positions are relative to the string, independent of LTR/RTL display.[?] + The position reflects logical (UTF-8) characters.[?] +
+ Position zero is right before the first character. +
+ If there is a selection, the caret is considered to be right after + the last selected character. +
+Indicates how text is displayed in a text editing control in the following ways:
+The following conversions can be specified:
The rules can, of course, be overridden by use of the shift key.
+The following conversions can be specified:
+- PasswordChar - - - -: the character which appears in the Edit box replacing and masking the actual character typed.
-Typically used in password input, to prevent the typed characters from being seen by passers-by or casual observers (or even malicious observers!)
+Typically used in password input, to hide the input from other viewers. +
++ The text in a multi-line control can be accessed in two ways: +
+The overhead involved with every property depends on the internal representation representation of the text, in the widget. + In either case multiple changes to the Text property should be done in a local copy, + written back after all changes have been applied. +
++ The logical lines (paragraphs) in Lines do not always match the displayed lines. + When WordWrap is True, every paragraph can wrap into multiple display lines. + [really?] +
+
-
The result is of type TCaption, a string type for the caption of a control: may be translated
-+ The Enter key typically is used to press the default button in a form, + so that it cannot be used to add line breaks into the text. +
+ Setting WantReturns to True allows to enter line breaks, when the control has the focus. +
+ Even if WantReturns is False, CTRL-Enter inserts an line break. +
++ The Tab key is normally used to move the focus to the next control, + so that it cannot be used to add Tabs to the text. +
+ When WantTabs is True, the Tab key inserts a Tab character into the text, + instead of moving the focus to then next control. +
+ Even if WantTabs is True, the user can Tab into the control, but not out again. +
+Use this control to display a statement or comment that is not likely to change very often, or is not usually responsive to user actions
+This control can be used instead of TLabel, when a TWinControl is required. +
This class provides very few properties of its own, but inherits a lot from its ancestors, TWinControlActionLink, TControlActionLink, TActionLink and TBasicActionLink -
-- the procedure which allows programmatic simulation of a mouse click, and thus activation of the Action associated with the OnClick event -
Setting this property to true, will have the effect that when the user hits ESC this button is Clicked, even if the button does not have focus. Usually the Button which reacts to ESC sets the ModalResult of the form to mrCancel.
+Pressing ESC in a modal form is equivalent to pressing the Cancel button.
Defines if a button is the Default on a form. That is, pressing ENTER will execute its onClick method, whether the control has focus or not!
+Pressing ENTER in a modal form is equivalent to pressing the Default button.
Check boxes present the user with options that can be selected (checked) or deselected (unchecked).
- the procedure which allows programmatic simulation of a mouse click, and thus activation of the Action associated with the OnClick event -
+If AllowGrayed is set to True, the check box has three possible states: checked, unchecked and grayed. If AllowGrayed is set to False, the check box has only two possible states: checked and unchecked.
See TCheckBoxState for possible values of State.
The Application Programmer is responsible for ensuring that the OnClick event handler recognises the State of the box, takes the appropriate Action and places the State into the next appropriate value
+The Application Programmer is responsible for ensuring that the OnClick event handler recognises the State of the box, + takes the appropriate Action and places the State into the next appropriate value
The Application Programmer is responsible for ensuring that the OnClick event handler for each button has a unique Action, and that the Actions of the other (deselected and therefore inactive) buttons are turned off.
+The Application Programmer is responsible for ensuring that the OnClick event handler for each button has a unique Action, + and that the Actions of the other (deselected and therefore inactive) buttons are turned off.
TRadioGroup behaves differently from a group of TRadioButton controls placed arbitrarily around a form.
-In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, while in TRadioGroup the exclusivity applies only to buttons within the Group, which are ordered strictly according to their ItemIndex within the Items stringlist.
+In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, + and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, + while in TRadioGroup the exclusivity applies only to buttons within the Group, + which are ordered strictly according to their ItemIndex within the Items stringlist.
- TRadioButton is an entity in itself, with a number of additional properties, whereas the buttons within TRadioGroup are not separate entities, but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton.
+ TRadioButton is an entity in itself, with a number of additional properties, whereas the buttons within TRadioGroup are not separate entities, + but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton.The example shows the difference between the use of TRadioButton and TRadioGroup
E.g. when you have a NameEdit1 control on a form, preceded by a label NameLabel1, you can set NameLabel1.FocusControl to NameEdit1, and NameLabel1.Caption to '&Name'. - This makes the NameLabel1 displayed as Name. + This makes the NameLabel1 displayed as 'Name' [should be underlined, but fpdoc errors on 'Name' ?].
When False, ampersands '&' in the label's caption are displayed as ordinary characters (as in the Object Inspector). @@ -4780,10 +4529,10 @@ Unlike VCL, if a text set through the Text property has more characters then Max
- Opaque Labels have their enclosing (client) rectangle filled with the background color of the label. + Opaque Labels have their enclosing rectangle filled with the background color of the label. This can be the color of the Parent control, when ParentColor is True.
Setting Transparent to True makes the label transparent, not hiding any background details. @@ -4792,7 +4541,7 @@ Unlike VCL, if a text set through the Text property has more characters then Max while Transparent=True doesn't obscure so much of the graphic.
The Units StdCtrls, ComCtrls and ExtCtrls contain definitions and descriptions of many of the most commonly used controls for constructing Forms and other Objects in Lazarus Applications.
-Many of the final target controls that the application developer wants to use, such as TButton, TMemo, TScrollBar etc, have a corresponding ancestor class such as TCustomButton, TCustomMemo or TCustomScrollBar. Several of the properties and methods relevant to the final target control are defined (and explained) more fully in the TCustomXXX class, and are inherited by the final target control.
-If you drop a component on the form editor you don't need to add code explicitly to create it. The component is automatically created by the IDE together with the form, and destroyed when the form is destroyed.
-However, if you create the component yourself by code don't forget to free it when it is no longer needed.
-If you place a component on the Form Designer and look at the Object Inspector, you can observe the properties change as you move the component around.
-For example, if you place a button (TButton) on the form, click on it to select it, then move it around the form with the mouse, you can watch the values of Top and Left change in the Object Inspector to reflect the new position. If you use the object's re-sizing bars to adjust its size, you can watch the Height and Width properties change as well.
-On the other hand, by using the Object Inspector, you can select the value associated with a property such as height, and type in a new value; you can watch the size of the object on the form change to reflect the new value.
-You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example
++ The Units StdCtrls, ComCtrls and ExtCtrls contain definitions and descriptions + of many of the most commonly used controls for constructing Forms and other objects in Lazarus GUI applications. +
+ Most controls are split into a final class, such as TButton, TMemo, TScrollBar etc., + and a corresponding ancestor class such as TCustomButton, TCustomMemo or TCustomScrollBar. + The final class is designed for immediate use, it almost only publishes the properties of the control. + The corresponding custom ancestor class (TCustomXXX) can be used to derive controls with special (customized) appearance or behaviour. +
+ If you drop a component from the component palette on the form editor you don't need to add code explicitly to create it. + The component is automatically created by the IDE together with the form, and destroyed when the form is destroyed. +
+ However, if you create the component yourself by code, and don't specify an Owner for it (Create(Nil)), + you are responsible for freeing the component when it is no longer needed. + You better construct it with Create(Self), where Self means the containing Form or Parent control. +
+ A control also must have a Parent control, maybe the Form, so that it can become visible within the client area of its Parent. + The Top and Left properties specify the placement of the control within its Parent. + The Object Tree reflects the Parent-Client relationships of all controls on the form. +
+ Unlike controls, mere components are invisible at runtime (Open Dialogs...). + Controls can be made invisible at runtime as well, by setting their Visible property to False. +
+ If you place a component on the Form Designer and look at the Object Inspector, + you can observe the Top and Left properties change as you move the component around. + The same for the Width and Height properties, when you resize a control by dragging it's size grips. +
+ When you modify the properties in the Object Inspector, the control on the form will reflect the changes as well. +
+ You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example +
Form1.Button1.Height := 48;
- If you type this new value into the Source Editor and then look back at the Form Designer, you will see that the button on the Form has taken the new size. The new value will also be shown in the Object Inspector.
-In summary, there are usually about three different ways to determine each property of an object:
+In summary, there are usually about three different ways to determine each property of a component:
The components defined in these Units have several properties that are common to most of them, and other properties that are specific to the individual components. We shall describe the most common ones here. Unusual or control-specific properties will be described for the individual controls.
-Additional Help can always be obtained by selecting a property or keyword, in either the Object Inspector or the Source Editor, and pressing F1. You will be taken by your Help browser to the appropriate page in the documentation.
-If the description of a property on that page is insufficient, you can navigate to the corresponding description in the ancestor classes, by selecting the links in the Inheritance listing or by selecting the ancestor Type in the declaration of the object.
- Constructors such as Create allocate memory and system resources needed by the object. They also call the constructor of any sub-objects present in the class.
-- Destructors: remove the object and de-allocate memory and other resources. If you call Destroy for an object which hasn't being initialized yet it will generate an error. Always use the Free method to deallocate objects, because it checks whether an object's value is nil before invoking Destroy.
-Take the following precautions when creating your own Destroy method:
-+ Additional Help can always be obtained by selecting a property or keyword, in either the Object Inspector or the Source Editor, and pressing F1. + You will be taken by your Help browser to the appropriate page in the documentation. +
+ If the description of a property on that page is insufficient, you can navigate to the corresponding description in the ancestor classes, + by selecting the links in the Inheritance listing or by selecting the ancestor Type in the declaration of the object.
@@ -4904,55 +4673,75 @@ Unlike VCL, if a text set through the Text property has more characters then Max | ||
---|---|---|
Action | -The main action or event associated with the object. For example selecting an 'Exit' Button might cause the 'Close' action | +Use Action when e.g. a button and a menu entry shall perform the same task, e.g. the Close action. + |
Align | -Defines the way in which an object is to be lined up with the parent object. Possible values are alTop (placed at the top and using the full available width), alBottom, alLeft (placed at the left and using the full available height), alRight. alNone (place anywhere on parent control) or alClient (takes all available space next to controls aligned to top, bottom, left or right) | +Defines how a control is lined up within its parent control. Possible values are + alTop, alBottom (stacked at the top or bottom, using the full available width), + alLeft, alRight (placed at the left or right, using the full available height), + alNone (place anywhere on parent control) or + alClient (takes all available space left over by other controls). + |
Anchor | -Used to keep a control a certain distance from the defined edges of a parent control, when the parent is resized. For example [akBottom, akRight] will keep the control a fixed distance from the bottom right corner. | +Used to keep a control at a fixed distance from the edges of its Parent control, when the Parent is resized. + For example [akBottom, akRight] will keep the control a fixed distance from the bottom right corner. + Anchoring both [akLeft, akRight] will make the control extend or shrink in Width, together with its Parent. + |
AutoSelect | -When True, an editing control will select all its text when it receives focus or when the Enter key is pressed. | +When True, a text control will select all its text when it receives focus or when the Enter key is pressed. |
AutoSelected | -True indicate that the edit or combobox control has just performed an AutoSelect operation so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text. | +True indicate that the edit or combobox control has performed an AutoSelect operation, + so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text.[~remove this?] + |
BorderSpacing | -The space around the edge between an Anchored control and its parent. | +The space around the edge between an [Anchored???] control and its siblings [parent?]. |
Caption | -The text that is displayed on or near the control; it should preferably give some clue as to the function of the control, or an instruction such as 'Close' or 'Execute'. By default Caption is set to be the same as the 'Name' property, and the application programmer should substitute meaningful text instead of the default values. | +The text that is displayed on the control; it should preferably give some clue as to the function of the control, + or an instruction such as 'Close' or 'Execute'. + By default Caption is set to be the same as the 'Name' property, and the application designer should substitute meaningful text instead of the default values. |
CharCase | -Indicates how text is displayed in a text editing control: Normal (retaining the case of the letters typed by the user), converted to uppercase, or converted to lowercase | +Indicates how text is displayed in a text editing control: + Normal (retaining the case of the letters typed by the user), + converted to uppercase, or converted to lowercase |
Constraints | -Sets the minimum and maximum sizes for a control. If a control is resized the new dimensions are always within the ranges given here. You should take care when setting these options that they do not conflict with the Anchors and Align settings. | +Sets the minimum and maximum sizes for a control. + If a control is resized the new dimensions are always within the ranges given here. + You should take care when setting these options that they do not conflict with the Anchors and Align settings. |
Color | -The Colour to be used to draw the control or to write the text it contains. | +The Color to be used to draw the control's background [or to write the text it contains -> Font.Color!???]. + |
Enabled | -A Boolean property to determine whether or not a control is capable of being selected and performing an action. If it is not Enabled, it is often Grayed out on the Form. | +Determines whether a control can be selected or perform an action. + If it is not Enabled, it is often Grayed out on the Form. |
Font | -The Font to be used for writing the text associated with the control - either the caption or label, or the text-strings contained within the control. The entry on the Object Inspector usually has a (+) box on the left, and selecting this box reveals further options such as character set, colour and size. | +The Font to be used for writing the text associated with the control - either the caption or label, or the text-strings contained within the control. + The entry on the Object Inspector usually has a (+) box on the left, and selecting this box reveals further options such as character set, color and size. |
Hint | -A short piece of informative pop-up text that appears if the mouse-cursor hovers over the control. | +A short informative pop-up text that appears when the mouse-cursor moves over the control. |
Items | @@ -4960,27 +4749,32 @@ Unlike VCL, if a text set through the Text property has more characters then Max||
Lines | -An array of strings, containing the textual data in controls with more than a single line of data, such as an Edit-Box or a Combo-Box. The array is zero-indexed, ie the lines are numbered [0..numLines-1] | +An array of strings, containing the paragraph texts in Memo controls. + The array index is zero-based, ie the lines are numbered [0..numLines-1] |
Name | -The identifier by which the control is known in the program. The IDE gives it a default name based on the underlying type, for example successive instances of TBitButton would be named Form1.BitBitton1 and Form1.BitButton2; it is up to the application programmer to give them more meaningful names such as ExitButton or OKButton. By default the Name of the control is applied to the Caption for the control, but the text of the Caption may be changed separately. | +The identifier by which the control is known in the program. + The IDE gives it a default name based on the underlying type, for example successive instances of TBitButton would be named Form1.BitBitton1 and Form1.BitButton2; + it is up to the application programmer to give them more meaningful names such as ExitButton or OKButton. + By default the Name of the control is applied to the Caption for the control, but the text of the Caption may be changed separately. |
PopUpMenu | -A window containing context-sensitive menu information that pops up when the right mouse button is clicked on the object. | +A window containing context-sensitive menu entries, that pops up when the right mouse button is clicked on the object. |
Position (or Top, Left) | -Determines where the control is located on the parent form or window | +Determines where the control is located on the parent form or control. |
ReadOnly | -Boolean property which, if True, signifies that the contents of the control can be read by the user or the calling routine, but cannot be written or changed. | +If True, the user cannot change the text in the control. |
ShowHint | -Allows a small window containing a context-sensitive Help or other description to be displayed when the mouse cursor 'hovers' over the control. | +Allows to enable or suppress Hints. + |
Size (or Height and Width) | @@ -4988,92 +4782,154 @@ Unlike VCL, if a text set through the Text property has more characters then Max||
Style | -The options available for Style depend upon the sort of Control being considered: for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc. | +The options available for Style depend upon the sort of Control being considered: + for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc. |
TabOrder | -Integer defining where in the sequence of tabs on the Form this control is to lie | +Specifies the sequence of controls, that are entered when the user presses the Tab key. + |
TabStop | -Boolean property which if True places this control in the sequence of objects that the user can reach by successively pressing the Tab key | +Specifies whether the control can be reached (or is skipped) by pressing the Tab key. |
Text | -The String of Text that represents the actual data that this control contains. Applies particularly to Text, Memo and StringList types of object. Most of the editing operations (such as Select, Clear, Cut, Copy) are performed in this part of the object, which holds the actual string being edited. If the control contains more than a single line of text, for example TMemo or TComboBox, then the textual elements are arranged as an array of strings (zero-indexed, ie numbered from [0..numLines-1]) in Lines. | +Like Caption, the user editable text that appears in the control. + Applies particularly to Edit, Memo and ComboBox types of controls. + Most of the editing operations (such as Select, Clear, Cut, Copy) are performed in this property. + If the control contains more than a single line of text, + then the textual elements are arranged as a zero-based array of strings in Lines (TMemo) + or Items (TListBox, TComboBox). + |
Visible | -If true, the object can be seen on the Form; if False, object is hidden | +If true, the control can be seen on the Form; if False, it is hidden. |
WordWrap | -Logical flag to show whether or not word-wrap is enabled, ie if a word comes close to the end of a line and is going to be too long for the line, it is wrapped down to the next line. | +Allows to wrap the Text into multiple lines. + When False, the text is clipped at the right margin of the control, but it still can be inspected by moving the caret within the text. + |
Many actions are commonly listed in the 'Events' tab of the Object Inspector. If you select an entry in the list, a ComboBox appears with a DropDown list showing any actions that have aleady been defined, and allowing you to choose one to be associated with this event. Alternatively you can select the ellipsis (three dots ...) and you will be taken to an area of the Source Editor where you can begin typing your own action instructions for the selected event.
-While a large number of events is available for any given control, in practice it is only necessary to populate a few of them. For most controls, it is sufficient to provide coding for 'OnClick'; for more complex controls it may be necessary also to provide for 'OnEntry' (when the mouse cursor enters the Control and gives it focus) and 'OnExit' (when the mouse cursor leaves the Control; or you may need to write an event handler for 'OnChange' or 'OnScroll', depending on the nature of the particular control with which you are dealing.
-The pop-up menu that appears when you right-click an object in the Form Designer has, as its first item: 'Create default event' and selecting this option will have the same effect as selecting the ellipsis in the Object Inspector for the default event, usually OnClick: you are taken to the Implementation area of the Source Editor where you can type the code for the event handler.
-A common strategy in Object-Oriented programming is to provide an ActionList with the facility for entering, removing or editing a number of pre-defined actions from which the most appropriate can be selected to use in any particular instance.
+The 'Events' tab in the Object Inspector contains a list with events, which can occur for this control. + If you select an entry in the list, a ComboBox appears with a DropDown list showing any event handlers that have aleady been defined, + and allowing you to choose one for this event. + Alternatively you can select the ellipsis (three dots ...) and you will be taken to the Source Editor, + where the Object Inspector created an new event handler method for you. + You also can type the name of your handler in the Object Inspector and press Enter, to create a new handler method. +
+While a large number of events is available for any given control, in practice it is only necessary to populate a few of them. + For most controls, it is sufficient to provide coding for 'OnClick'; for more complex controls it may be necessary also to provide for + 'OnEntry' (when the control receives the focus) and + 'OnExit' (when the control looses the focus); + or you may need to write an event handler for 'OnChange' or 'OnScroll', depending on the nature of the particular control with which you are dealing. +
++ Many controls have a default event, usually OnClick, for which an handler is created with a double click on the control. + Or right click on the control, and select the first entry: 'Create default event'. +
+A common strategy in Object-Oriented programming is to provide an ActionList + with the facility for entering, removing or editing a number of pre-defined actions, + from which the most appropriate can be selected to use in any particular instance [of?]. +
- | Action | +Event | Meaning |
---|---|---|---|
OnChange | -Action to be taken if any change is detected (eg mouse move, mouse click, key press, edit text, alter picture, etc) | +Action to be taken if any change is detected (e.g. by mouse click, key press, edit text, etc) | |
OnClick | -Action to be taken when the (left) mouse button is clicked. This is usually the main or default action of the control; for example clicking on a button or checkbox initiates the action associated with the checkbox. It may alternatively initate a process of selection, for instance in a TextBox or Memo, or signal the beginning of painting with a Pen or Brush. | +Action to be taken when the (left) mouse button is clicked. + This is usually the main or default action of the control; for example clicking on a button or checkbox initiates the action associated with the checkbox. + It may alternatively initate a process of selection, for instance in a TextBox or Memo. | |
Click | +Click[here???] | A method to emulate in code the effect of clicking on a control. This method is most often found in Button-type controls (TButton, TBitBtn, TSpeedButton etc). A procedure can be written that calls the same code as the OnClick action. This facility can be particularly useful if the activation of one control by clicking causes a cascade of other controls to be activated, and the Click method can be used to initiate the action rather than having the user explicitly click on a lot of controls. | |
OnDragDrop | -Action to be taken during Drag-Drop manoeuvres, ie when the mouse is used to 'capture' an item or some text etc and move it around the screen to a new location. | +Action to be taken when a dragged control has been dropped onto this control. + [OnDragOver?] + | |
OnEntry | -Action to be taken when the mouse cursor enters the area occupied by the object, usually transfering focus to that object. This might include changes in the appearance of the object such as highlighting or raising the border. | +Action to be taken when the control receives the focus. + This might include changes in the appearance of the object such as highlighting or raising the border. | |
OnExit | -Action to be taken when the mouse moves out of the area of the object, usually transferring focus out of the object. | +Action to be taken when control is about to loose the focus. + This is the right place for validity checks of user input, with a chance to disallow moving to a different control when the input is invalid. + | |
OnKeyPress | -Action to be taken for any key-press. Subtly different from OnKeyDown, which simply responds to a key being down, whether or not it was already down when focus was given to this control. OnKeyPress requires that a key becomes pressed while focus is in this control. | +Action to be taken on an entered character. Checks... + | |
OnKeyDown | -Action to be taken if a key is down while focus is in this control. Subtly different from OnKeyPress - for example the key might already have been down when focus entered this control, whereas OnKeyPress requires the key to become pressed while focus is in the control. | +Action to be taken if a key is down while focus is in this control. + This allows to filter or process control characters in a special way. + | |
On Key Up | -Action to be taken if a key is up (ie not pressed) while focus is in this control. | +OnKeyUp | +Action to be taken if a key goes up. This event occurs only once, while auto-repeated keystrokes trigger multiple OnKeyDown or OnKeyPress events. + |
OnMouseMove | -On Mouse Down - Action to be taken if the mouse cursor moves while focus is in this control. | +Action to be taken if the mouse cursor moves over the control. + This event fires with every small move, while OnMouseEnter and OnMouseLeave occur only when the mouse enters or leaves the control. + | |
OnMouseDown | -Action to be taken if the mouse button is down while focus is in this control. | +Action to be taken when a mouse button is pressed over the control. | |
OnMouseUp | -Action to be taken if the mouse button is up while the cursor is over this control. Implies that the mouse button was previously down and has been released. The case where the cursor enters the control but the mouse button has not yet been pressed is covered by OnEntry or OnMouseEnter. | +Action to be taken if a mouse button goes up over the control. + | |
OnResize | -Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc. | +Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc. + Do not mix up with AutoSize, or you ask for trouble! + |
+ Constructors such as Create allocate memory and system resources needed by the object. + They also call the constructor of any sub-objects present in the class. +
++ Destructors: remove the object and de-allocate memory and other resources. + If you call Destroy for an object which hasn't being initialized yet it will generate an error. + Always use the Free method to deallocate objects, because it checks whether an object's value is nil before invoking Destroy. +
+Take the following precautions when creating your own Destroy method:
+