Useful lower-level helper functions and classes.

lclproc.pas contains lower-level classes and helper routines that are useful in LCL applications.

This file is part of the Lazarus Component Library (LCL).

A list for method references.

TMethodList is an alias for the TMethodList type in the LazMethodList unit.

TMethodList
A node in TDebugLCLItems, holding information about a heap object. The address of the item. True when the item has been destroyed. A descriptive string for the item. Stack trace at creation of the object. Stack trace at destruction of the object. All information about the object as a string value. True to include stack traces. Destructor for the class instance. A list describing dynamically allocated (and destroyed) memory objects. The list holds descriptive information about the object, and stack traces at the time of creation and destruction. The list entries, organized as an AVL tree. Constructor for the class instance.

Sets the Name property to the value in TheName. Allocates resources for the internal TAvlTree instance used in the class.

The descriptive name of the list. Destructor for the class instance. Returns information about an item, optionally creating an entry if not found. The item information, or Nil if none was found or created. The address of the item to find. True means create an according list entry, if none existed yet. True when the item has been destroyed. True when destroyed, False when alive or not listed. The address to find. True when the item is alive. True when the item is listed and has not yet been destroyed. The address to find. Checked insert of an item. GDB exception 'RaiseDoubleCreated' when the address is already in use. The info object describing the address. The address to add. Descriptive text about the item. Checked destruction notification.
  • GDB exception 'TDebugLCLItems.MarkDestroyed' when the item was not yet created.
  • GDB exception 'RaiseDoubleDestroyed' when the item was already destroyed.
The address to mark as destroyed. Returns textual information about an object. The descriptive string. The address to find. True means include stack traces. The descriptive name of the list. Compare function for the TDebugLCLItems AVL tree. Compares the Item addresses. Compare function for Specifies a comparison function type for string values in a TStrings instance.

TStringsSortCompare is an Integer function type used to compare string values to determine the relative sort order. The return value indicates the relative sort order for the compared items, and normally contains a value like the one returned from CompareText. For example:

<0
Item1 has a value that comes before Item2.
0
Item1 and Item2 have the same value.
>0
Item1 has a value that comes after Item2.

The address for a TStringsSortCompare type is passed as an argument to the MergeSort routine.

Integer with the relative sort order for the compared values. First string value for the comparison. Second string value for the comparison. Implements a merge/sort for TStrings or TFPList.

MergeSort is an overloaded routine used to implement a comparison-based sort routine for values in List. List can be a TStrings or TFPList instance. No actions are performed in the routine when List has not been assigned (contains Nil).

The StartIndex and EndIndex arguments allow the initial and final entries in a TFPList instance to be specified. When the values are omitted, they default to the first value (position 0) and the last value (Count-1) in List.

OnCompare is the comparison routine used to determine the order for the sorted values. It can be a TListSortCompare or TStringsSortCompare function, depending on the overloaded variant of the called routine.

MergeSort implements the J. von Nuemann divide-and-conquer algorithm, with an insertion sort used for lists with 6 or fewer elements.

The list of values to sort (overloaded type). The sort compare function. The initial entry in List used in the merge/sort. The final entry in List used in the merge/sort. Converts the specified key code and shift modifier to their representation as a String. String representation for the specified value; i. e. 'Ctrl+Home'. Key code converted in the routine. Shift, Ctrl, Alt modifier converted in the routine. Indicates if the string contains the 'Word(nn)' representation for an unknown key code. True when the string is not a named virtual key code. Value examined in the method. Returns the textual representation for a shortcut value. Localized text value for the specified shortcut. Converts a shortcut value to its text representation without localization. Non-localized text value for the specified shortcut. Shortcut value converted in the method. Converts the textual representation for a shortcut into a shortcut value. TShortcut value for the specified text. Text converted to a shortcut value in the method. Converts the non-localized textual representation for a shortcut into a shortcut value. Finds a string in a list, given its first few characters. The found string. The begin of the string to find. The list index where the search should start. True means case-sensitive comparison. True means search ascending from iSelStart. The list to search. Indicates if the specified key code has a value allowed in an editable text string. The virtual key code examined in the routine. Hook used to prevent circular unit references. Hook used to prevent circular unit references. Component for the change notification. Function used to send an application message using the specified parameter values. Routine used to notify the form designer which owns the specified component when it has been changed. Modified component that needs to be updated on its form design surface. Sends an application message using the specified parameter values. Executes the routine which notifies the form designer when the specified component has been changed.

The forms.pp unit provides a private implementation in its IfOwnerIsFormThenDesignerModified routine which is assigned to the variable during unit initialization.

The modified component which needs to be updated on its form design surface. Frees the TObject instance (when assigned) before setting the reference to Nil.

Calls the FreeThenNil routine in the lazutilities.pas unit from the lazutils package.

LazUtilities.FreeThenNil
The object reference freed and Nil'd in the routine. Registers an initialization routine needed before the LCL is initialized. Procedure registered in the routine. Calls each of the registered initialization handlers. Registers an finalization routine needed after the LCL has been finalized. Calls each of the registered finalization handlers. Increments the Top, Left and Bottom, Right rectangle coordinates by the specified amounts. True when the TopLeft coordinates are all positive. Moves the rectangle origin to the given coordinates. Adjusts an rectangle to fit entirely into another one. The bounding rectangle. Eventually swaps the variable contents, so that i1 is not higher than i2. Receives the minimum value of both variables. Receives the maximum value of both variables. Transposes coordinates to ensure Width and Height are positive Integer values. Removes all Ampersand ('&') characters Str, and return the position for the first occurrence.

DeleteAmpersands is an Integer function used to remove all occurrences of the Ampersand character in Str. The return value contains the position in Str where the first occurrence of the of the character was found.

Double Ampersands (&&) are converted to a single & character in Str.

DeleteAmpersands can be used to remove the prefix used for accelerator keys in button, tool bar, and menu captions.

Position where the first ampersand character was found. String with values converted in the method. Removes single Ampersand characters, and returns the converted value.

RemoveAmpersands is an overloaded function used to remove all occurrences of a single Ampersand (&) character from the specified value. It provides variants that operate on String and PChar types. The return value contains the original value after all single Ampersand characters have been removed. Double Ampersand (&&) characters are converted into a single Ampersand character.

Use DeleteAmpersands to remove Ampersand character in the original String value.

Value after single Ampersand characters are removed. String with the values examined in the routine. PChar value examined in the routine. Length of the value in Src. Compares two Handles, returning the relative order for the handle values.

The return value contains the following:

-1
h1 has a lower value than h2.
0
h1 and h2 have the same value.
1
h1 has a higher value than h2.
Relative order for the compared handle values. First handle for the comparison. Second handle for the comparison. Indicates if the specified rectangle pointers have the same coordinate values. True when the top, left, bottom, and right values in each rectangle are the same. Pointer to the first rectangle for the comparison. Pointer to the second rectangle for the comparison. Compares the specified TPoint values to get their relative order.

ComparePoints is an Integer function used to compare the coordinates in the specified TPoint instances to determine their relative order. The return value contains -1, 0, or 1 for the following conditions:

-1
p1.y is smaller than p2.y, or p1.x is smaller than p2.x.
0
p1 and p2 have the same x and y values.
1
p1.y is larger than p2.y, or p1.x is larger than p2.x.
Relative order for the compared TPoint values. First TPoint instance for the comparison. Second TPoint instance for the comparison. See ComparePoints.

See ComparePoints.

Raises a catchable exception.

Normally, GDB does not catch FPC Exception objects. This procedure raises a standard divide by zero exception which is caught by GDB.

Writes a number of strings (heavily overloaded) to the debug output. A single string, or a Format string when followed by an argument list. Writes the formatted dump of the typed arguments. Optionally writes a value to the debugger and increases the indentation level. Optionally writes a value to the debugger and decreases the indentation level. Signals the OnDbgOut event handler for the debug logger class instance. Formats debug output for various argument types (overloaded).
  • boolean: "True" or "False".
  • pointer: hexadecimal address.
  • TRect, TPoint: shows the x/y coordinates.
  • TComponentState: set.
  • TObject: Name:ClassName.
  • TClass: ClassName.
  • String, WideString: chars > #126 are translated into #nn (or #nnnn) character constants.
Returns the component or class name. Converts control characters, or characters above #126 into #hex format. Converts control characters, or characters above #126 into #hex format. Provides an hex dump of a memory section. The formatted dump. The start address. The number of bytes to dump. The number of bytes per line, zero for no line breaks. Provides a hex dump of an memory stream.

The dump starts at the current stream position, the position moves to the end of the dumped range.

The maximum number of bytes to dump. Provides an hex dump of an TObject. Provides a hex dump of an Int64 value, (sign + absolute value). Provides a dump of SetWindowPosition flags. Converts a virtual key code to its String representation. Writes a debugging message to the log file for the current thread. Writes a debugging message to the log file for the current thread which includes the thread identifier. Writes data to a file. Appends a line to the given file. Appends (pre-formatted) text to an file. Calls the Finish method for the debug logger class instance. Indicates if a TClass instance is found in the specified array. Ordinal position in ACase where the TClass instance was found, or -1 when not found. TClass instance to locate in ACase. Array of TClass instances to examine in the routine. True to consider descendants of AClass as a match in the routine. Alias to the UnicodeString type. Pointer to the UTF16String type. Deprecated, see the LazUTF16 unit in the LazUtils package for replacements. Deprecated, see the LazUTF16 unit in the LazUtils package for replacements. Deprecated, see the LazUTF16 unit in the LazUtils package for replacements. Deprecated, see the LazUTF16 unit in the LazUtils package for replacements. Replaces last digits with 1.

For example Name321 becomes Name1.

Deprecated, see the LazUTF8 unit in the LazUtils package for replacements. Indicates if the specified name contains 'default'. True when AName contains 'default'. Font name examined in the routine.