Non Visual Components

On this page we will cover objects from the HBasicComponents.pas (Class Tcomponent).

ThFileSearch

Implements a component for searching files and directories within a specified path on the filesystem.
Allows configuration of search mask, root path, inclusion of all subfolders, and custom filtering logic.
Supports event-driven notification for each found file or directory via the OnFoundFile event.
Designed to simplify recursive searches and provide flexible control over search behavior and results.
Intended for use in Delphi applications needing directory or file discovery capabilities.

Execute

Initiates the file search process according to the current component properties and parameters.
Performs a directory scan based on the
SearchMask
,
SearchPath
, and search options.
Triggers the
OnFoundFile
event for each file or directory found.
function Execute: Boolean;

Return Value

Returns True if the search completed successfully.
Returns False if the operation was interrupted or failed.

Scan_Only_For_Directories

Configures the search to return only directories, ignoring regular files.
Adjusts the search behavior so that only folders matching the mask and path are processed.
function Scan_Only_For_Directories: Boolean;

Return Value

Returns True if the component is set to scan only for directories.
Returns False if both files and directories are included in the search.

SearchMask

Defines the file mask or pattern used to match files or directories during the search.
This property determines which files or folders will be found based on their names.
property SearchMask: String;

SearchPath

Specifies the root directory where the search begins. All file and folder matching operations are performed under this path.
property SearchPath: String;

AllFolders

Determines if the search includes all subfolders under
SearchPath
.
When set to True, the component recursively scans all nested directories.
When False, only the specified folder is scanned.
property AllFolders: Boolean;

Usage_Notes

Provides a text field for storing user or developer notes about how to use the component or specific settings.
property Usage_Notes: String;

OnFoundFile

Assigns an event handler that is called whenever a file or directory is found during the search process.
The handler receives information about each matched item and allows for custom processing or filtering.
property OnFoundFile: ThFileSearchEventType;

ThFileSearchEventType

Defines the procedure type for handling file or directory search events in the ThFileSearch component.
Called for each found file or directory during a search operation, providing details about the item.
Allows the event handler to process or filter results and optionally stop the search by setting the Stop parameter.
ThFileSearchEventType = procedure(Path, Name: String; Size: Int64; Time: TDateTime; Directory: Boolean; Attr: String; var Stop: Boolean) of object;

Parameters

  • Path: String; The directory path where the file or folder was found.
  • Name: String; The name of the file or directory found.
  • Size: Int64; The size of the file in bytes, or 0 for directories.
  • Time: TDateTime; The last modified timestamp of the file or directory.
  • Directory: Boolean; True if the found item is a directory; False if it is a file.
  • Attr: String; A string representing the file or directory attributes.
  • Stop: Boolean; Set to True to stop the search process; leave as False to continue searching.

ThThread_Delphi

Provides a Delphi-specific thread class for executing operations in the background within a VCL application.
Designed to encapsulate thread handling with focus on Delphi’s threading model.
Enables execution of user-defined code in parallel to the main application thread, improving responsiveness.
Includes properties and methods for thread control, such as starting, stopping, and monitoring execution.
Supports safe communication and synchronization with the main thread for UI updates or result processing.
Intended for developers needing reliable multithreading in Delphi applications.

ThThread

Defines a general-purpose thread base class for multithreaded operations in applications.
Abstracts the essential mechanisms for creating and managing threads, independent of specific UI frameworks.
Allows user code to run asynchronously, improving application performance and separating background logic from the main flow.
Provides virtual methods and customizable hooks for extending thread behavior in derived classes.
Designed for flexibility, supporting both Delphi and cross-platform scenarios where threading is needed.

Thread_Is_Running

Checks if the thread is currently active and running in the background.
Returns the current state of thread execution for status monitoring or control logic.
function Thread_Is_Running: Boolean;

Return Value

Returns True if the thread is running.
Returns False if the thread is not running or has completed.

Execute_Thread

Starts the execution of the thread and launches the background operation.
Triggers the main code defined for the thread to run asynchronously from the main application.
procedure Execute_Thread;

Terminate_NOW_With_Memory_Leak

Forcibly terminates the thread immediately, without cleanup or resource release.
This may cause memory leaks or unstable application state, and should only be used as a last resort.
Bypasses standard thread termination mechanisms.
procedure Terminate_NOW_With_Memory_Leak;

Wait_For_Thread

Pauses execution until the thread completes, or until the specified timeout (in seconds) elapses.
Optionally processes VCL messages during the wait to keep the application responsive.
procedure Wait_For_Thread(Seconds: Double{Max 1200 = 20 minutes}; VCL_ProcessMessages: Boolean = True);

Parameters

  • Seconds: Double; Maximum number of seconds to wait for the thread to finish (up to 1200 seconds).
  • VCL_ProcessMessages: Boolean; If True, processes application messages during the wait to keep the UI responsive (default is True).

Sync_Notify_Event_With_App_GUI

Synchronizes invocation of an event handler with the main application GUI thread.
Allows notification events to be triggered safely in the context of the main thread, avoiding cross-thread violations.
Useful for triggering events that interact with UI controls or perform user interface updates from a background thread.
procedure Sync_Notify_Event_With_App_GUI(Event: TNotifyEvent);

Parameters

  • Event: TNotifyEvent; The event handler to be called in the main GUI thread context.

Direct_OS_Threading_API

Specifies whether the thread uses direct operating system threading APIs for execution and management.
When set to True, bypasses certain Delphi thread abstractions and interacts more directly with OS-level threading.
Default is False for standard Delphi-style thread management.
property Direct_OS_Threading_API: Boolean;

Command_For_Thread

Provides a command value (as a 16-bit word) that can be used to send instructions or control codes to the thread during its execution.
Useful for signaling thread actions or switching thread logic based on received commands.
Default value is 0.
property Command_For_Thread: Word;

Usage_Notes

Text property for storing usage tips, instructions, or developer notes relevant to the thread’s implementation or expected behavior.
property Usage_Notes: String;

OnExecute

Specifies the event handler that will be triggered when the thread begins its main execution routine.
Use this event to assign the logic to be performed by the thread in the background.
property OnExecute: TNotifyEvent;

After_Exec_Under_Thread

Assigns a method to be executed immediately after the thread’s background operation completes, while still running in the thread context.
Intended for cleanup or additional processing that should happen before returning to the main application thread.
property After_Exec_Under_Thread: TThreadMethod;

After_Exec_On_App_Thread

Assigns a method to be executed after the thread finishes, but within the main application thread context.
Used for finalization steps, UI updates, or any actions that must be performed safely on the main thread after thread completion.
property After_Exec_On_App_Thread: TThreadMethod;

ThTimer

Implements a timer component that triggers events at specified intervals in a Delphi application.
Provides properties to control the timing interval, enable or disable the timer, and configure one-shot or repeated triggering.
Can execute custom code when the timer elapses, using event handlers.
Supports safe use in both main and background threads, making it suitable for general-purpose timing tasks, periodic actions, or delayed execution.
Intended for applications needing flexible and reliable timing functionality.

Run

Starts the timer and initiates its countdown or interval triggering. Can be set to run either once or repeatedly depending on the parameter.
Used to activate the timer and begin event firing.
procedure Run(Once: Boolean = False);

Parameters

  • Once: Boolean; If True, the timer triggers a single event and then stops. If False, the timer repeats at each interval (default is False).

Stop

Stops the timer and halts any further triggering.
Optionally terminates an associated thread if it exists.
procedure Stop(Term_Thread_If_Exist: Boolean = False);

Parameters

  • Term_Thread_If_Exist: Boolean; If True, forcibly terminates any related thread when stopping the timer (default is False).

Thread_Is_Running

Checks if the timer’s internal thread or background process is currently running.
Allows monitoring of timer state for logic control or debugging.
function Thread_Is_Running: Boolean;

Return Value

Returns True if the timer’s thread is active.
Returns False if the timer is not running.

Calc_Interval_By_DateTime

Calculates the timer interval needed to reach a specified future date and time.
Sets the timer to trigger at the time represented by Future_Trigger, counting from From_Now.
function Calc_Interval_By_DateTime(const From_Now, Future_Trigger: TDateTime): Boolean;

Parameters

  • From_Now: TDateTime; The reference date and time to start calculation from.
  • Future_Trigger: TDateTime; The target date and time when the timer should trigger.

Return Value

Returns True if the interval was calculated and set successfully.
Returns False if the calculation failed (for example, if Future_Trigger is before From_Now).

Calc_Interval_For_Next_Hour

Calculates the timer interval required to reach a specific hour and minute in the future, starting from a given time.
Sets the timer to trigger at the next occurrence of the specified hour and minute after From_Now.
function Calc_Interval_For_Next_Hour(const From_Now: TDateTime; const HH, MM: Word): Boolean;

Parameters

  • From_Now: TDateTime; The reference starting date and time.
  • HH: Word; Target hour (0–23) for the timer to trigger.
  • MM: Word; Target minute (0–59) for the timer to trigger.

Return Value

Returns True if the interval was calculated and set successfully.
Returns False if calculation was not possible.

Calc_Interval_For_Next_Round_Hour

Calculates the interval to the next round hour, optionally adding extra minutes.
Useful for scheduling actions precisely on the hour or at an offset.
function Calc_Interval_For_Next_Round_Hour(PlusMinutes: Byte = 0): Boolean;

Parameters

  • PlusMinutes: Byte; Number of minutes to add to the next round hour when setting the timer (default is 0).

Return Value

Returns True if the interval was successfully calculated and set.
Returns False if calculation was not possible.

Timer_Is_ON

Indicates whether the timer is currently active and enabled.
Returns True if the timer is running and scheduled to trigger events.
Returns False if the timer is stopped or inactive.
property Timer_Is_ON: Boolean read _Timer_Is_ON;

Thread

Provides access to the internal ThThread instance used by the timer component for background processing.
Allows inspection or control of the timer’s dedicated thread.
property Thread: ThThread read EThread;

Busy_On_Que

Indicates if the timer or its thread is currently processing a queued execution or operation.
Returns True when the timer is busy handling a queued event.
Returns False when the timer is idle and ready for new tasks.
property Busy_On_Que: Boolean read _Execute_Que_Busy_Flag;

Interval

Specifies the time interval, in seconds (as a double-precision value), between timer events.
Used to set how often the timer triggers its assigned actions.
Assigning a new value updates the timer schedule.
property Interval: Double;

OnQue

Assigns an event handler to be called each time the timer interval elapses. This event is triggered in the context of the main application thread.
Used for actions that require safe interaction with the UI or main logic.
property OnQue: TNotifyEvent;

Que_On_Thread

Assigns an event handler to be executed when the timer interval elapses, but running inside the timer's thread context.
Useful for background or time-consuming actions that do not require UI access.
property Que_On_Thread: TNotifyEvent;

ThKeyboardSpy

Implements a component for monitoring and intercepting keyboard input events at the application or system level.
Allows detection of key presses, key releases, and other keyboard activities in real time.
Supports event handlers for reacting to specific keys or combinations, and can be used for hotkey handling, logging, or custom keyboard shortcuts.
Designed to operate transparently, capturing keyboard input regardless of which control is focused.
Intended for applications requiring enhanced keyboard control, input logging, or advanced shortcut management.

Enabled

Controls whether the keyboard spying functionality is currently active.
When True, the component monitors and captures keyboard events.
When False, all keyboard monitoring is disabled.
Default is False.
property Enabled: Boolean read Get_Enabled write Set_Enabled default False;

Usage_Notes

Stores usage instructions, notes, or remarks relevant to the component’s configuration or intended use.
property Usage_Notes: String;

OnKeyDown

Assigns an event handler that is triggered when a key is pressed down.
Enables the application to respond immediately to specific key presses or combinations.
property OnKeyDown: ThKeyEvent;

OnKeyPress

Assigns an event handler that is triggered for key press events, typically when a character is entered.
Useful for capturing typed input or implementing custom character-level logic.
property OnKeyPress: TKeyPressEvent;

ThKeyEvent

Defines the procedure type for keyboard event handlers that respond to key down or key event notifications.
Provides information about the key pressed, modifier keys state, and allows the event to be marked as handled.
Used by components such as ThKeyboardSpy to implement custom reactions to keyboard input.
ThKeyEvent = procedure(Key: Word; Shift: TShiftState; var Handled: Boolean) of object;

Parameters

  • Key: Word; The virtual key code of the key that was pressed or released.
  • Shift: TShiftState; Set of modifier keys (such as Shift, Ctrl, Alt) held down during the event.
  • Handled: Boolean; Set to True to indicate the event was processed and prevent further handling.

TClipboardChanged

Implements a component that monitors the system clipboard for changes in content.
Notifies the application when the clipboard data is updated, allowing for custom reactions to copy, cut, or clipboard events.
Provides event handlers to react to clipboard changes and optionally filter or process new clipboard content.
Useful for applications that need to track user copy-paste activity, implement clipboard history, or trigger automation based on clipboard data.
Designed for seamless integration into Delphi applications, providing robust clipboard monitoring functionality.

OnClipboardChanged

Assigns an event handler that is triggered whenever the system clipboard content changes.
Allows the application to respond immediately to clipboard updates, such as new copied or cut data.
Used for actions like updating UI, processing clipboard content, or maintaining clipboard history.
property OnClipboardChanged: TNotifyEvent;

TTaskbarIcon

Implements a component that adds an icon to the Windows taskbar notification area (system tray).
Allows the application to display status icons, show balloon hints, and handle user interaction through icon events such as clicks or hovers.
Provides properties to set the icon image, tooltip text, and configure appearance or visibility.
Supports event handlers for mouse and click actions on the taskbar icon.
Useful for background utilities, status monitoring, or applications that need a persistent presence in the system tray.
Designed for seamless use in Delphi VCL applications.

Add

Adds the icon to the Windows taskbar notification area (system tray).
Makes the icon visible and interactive for the user.
Typically called during application startup or when the icon needs to appear in the tray.
procedure Add;

Remove

Removes the icon from the Windows taskbar notification area (system tray).
Hides the icon and prevents further user interaction with it.
Useful for application shutdown or when the icon should no longer be displayed.
procedure Remove;

Generate_Taskbar_Text_Icon

Creates and sets a taskbar icon that displays custom text, with configurable background and font colors.
Allows dynamic creation of icons showing numbers, letters, or status messages directly in the system tray.
Useful for displaying notifications, counts, or short status information visually.
procedure Generate_Taskbar_Text_Icon(Text: String; BgColor, FontColor: TColor);

Parameters

  • Text: String; The text to be rendered on the icon.
  • BgColor: TColor; The background color for the icon.
  • FontColor: TColor; The color of the text displayed on the icon.

Balloon

Displays a balloon notification popup associated with the taskbar icon.
Shows a title and message body to provide information or alerts to the user.
Useful for unobtrusive notifications, reminders, or status updates.
procedure Balloon(Title, MsgBody: String);

Parameters

  • Title: String; The caption of the balloon notification.
  • MsgBody: String; The content text of the notification popup.

Icon

Specifies the icon image to be displayed in the Windows taskbar notification area (system tray).
Can be assigned to visually represent the application, status, or custom information.
Supports updates at runtime for dynamic icon changes.
property Icon: TIcon;

IconHint

Specifies the tooltip text that appears when the mouse hovers over the taskbar icon.
Used to provide additional information or status to the user without taking focus.
Can be dynamically updated as needed.
property IconHint: String;

OnClick

Assigns an event handler that is triggered when the user clicks the taskbar icon.
Enables the application to respond to single, double, or custom mouse click events on the icon.
Used for actions such as restoring a window, showing a menu, or performing status updates.
property OnClick: TTaskClickEvent;

TTaskClickEvent

Defines the procedure type for handling mouse click events on the taskbar icon.
Provides information about which mouse button was used and the position of the cursor during the click.
Used by the OnClick event of the TTaskbarIcon component to implement custom responses to user actions in the system tray.
TTaskClickEvent = procedure(RightButton: Boolean; MousePos: TPoint) of object;

Parameters

  • RightButton: Boolean; True if the right mouse button was clicked; False for the left mouse button.
  • MousePos: TPoint; The screen coordinates of the mouse cursor at the time of the click event.