« Home     About     @Contact

MCHintBox component for Delphi

How to display diagnostic messages without dialog boxes

Hint Box MCHintBox component overview

The Task...

When write code that handles user inputs, it is a common practice to use WinAPI function MessageBox() to display just an information text, such as "Numeric value is too large", or "Password is incorrect", etc.

When the message box appears, then the user needs to spend time to:

  • Realize where he goes wrong (search the screen for the problematic control), then he need to...
  • Discard the message box by pressing "OK" button using the mouse or keyboard, and, finally...
  • Move the input focus to the required control.

Too much for such an easy thing, isn't it? SO LET SIMPLIFY THIS!

...And The Solution

HintBox Demo Application

Download DOWNLOAD DEMO (220KB)

Includes a demo project source and its executable. The component source is available on purchase.

Order GET SOURCE CODE NOW!

We use Share*it! service provider for secure payments processing.

You will receive a Download Link instantly* right after you have made your order!

* Applies to payments made by credit or debit cards.

The MCHintBox is a combination of Windows popup tooltips, "What's this?" context popup help, and ability to show and automatically hide the diagnostic messages.

MCHintBox simplifies the user's life:

  • User has no need to search the screen for the problematic control — the component will set focus to it, graphically point to it and display a message near to it.

  • User has no need to perform any special actions to discard this message from the screen. When he understand the message then he just continue with his task — and message will disappear.

  • Programmers may use only a single function call, HintBox, to display the message (see the "Simple Example" below).

Feature notes

  • Suitable for any version of Windows: 9x/Me/NT/2K/XP;

  • Invoked by a single function call, HintBox;

  • Appears on the screen as a modeless window (not modal or dialog) and can be discarded by any user acivity (by clicking mouse buttons or pressing keyboard) except the mouse movements;

  • Only one MCHintBox window can be visible at the same moment;

  • Under WindowsXP, it drops shadow from the right and bottom edges of the hint window.

  • This component has not to be installed into the Delphi Component Palette. It can be simple copied to any appropriate project's directory.

Example Simple Example

  • Run Delphi and start a new project.

  • Include MCHintBox into the uses clause of the Unit1. Now you've got access to HintBoxControl global variable.

  • Drop TEdit onto the Form1.

  • For the Edit1.OnChange, write the following code:

    if Length(Edit1.Text) > 5 then
       HintBox(Edit1, 'The desired maximum text length is only 5 chars', 'Did you know...');
  • Run the project. Type more than 5 characters into Edit1. You should see the hint near to Edit1. Try to press any key, or click the mouse, or switch to another application. Any user activity (except the mouse movements) causes hint window to be discarded.

MCHintBox.pas reference

The HintBox procedure

Use this procedure to activate MCHintBox message window. Its syntax is quite similar to standard MessageBox function.

HintBox

Displays the hint window near to given target control, using given message text, caption, and optional icon. It can be also positioned absolutely on screen or relatively to target control using optional coordinates.

procedure HintBox(ATarget: TWinControl; const AText, ACaption: String; AIconType: Integer = MB_ICONINFORMATION; X: Integer = -1; Y: Integer = -1); overload;

or

procedure HintBox(ATarget: TWinControl; const AText, ACaption: String; AIcon: TGraphic = nil; X: Integer = -1; Y: Integer = -1); overload;

ATarget
[in] A control to be focused.
AText
[in] Message text to be displayed. Can be empty if ACaption is not empty.
ACaption
[in] Message caption to be displayed (bold highlited). Can be empty if AText is not empty.
AIconType
[in] One of standard MB_ICONxxxx constants. It is MB_ICONINFORMATION by default. To display no icon, pass zero as an AIconType value.

or overloaded

AIcon
[in] A custom icon or bitmap. Either instances of TIcon, TBitmap, or TImage.Picture.Graphic can be passed there.
X
[in] An optional X-coordinate of HintBox window.
Y
[in] An optional Y-coordinate of HintBox window.
Remarks

Cases of Target and Coordinates

  • ATarget is NOT nil, X and Y params are both missed or equal to -1 (e.g. NOT specified):
    - The HintBox window will appear near to ATarget control and will point on it.

  • ATarget is NOT nil, the coordinates are specifed:
    - They define an offset of the HintBox window from its position near to the target control.

  • ATarget is nil, the coordinates are NOT specifed:
    - The pointing arrow will NOT be drawn and the window will be centered on screen.

  • ATarget is nil, the coordinates are specifed:
    - The HintBox window will appear at this position on screen.

SEE ALSO

Folder Jump Folder Jump.com

Let Your Fingers Rest!
Stop waste your time browsing directories!


Folder Size
FREE shell extension, adds 'Folder Size' column to Windows Explorer


Stored Procedures for SQL Server

Access file system and Internet, use data compression, and cryptography from T-SQL.


Create your own Extended Stored Procedures!

This is easy if use wrapper classes for Visual C++ or Delphi.


Delphi Components

Internet tools, PGP SDK wrapper component, User activity detection Smart message boxes...


GlyFy.com - stock glyphs and icons for software development GlyFy.com
Quality icons, glyphs, and images for software development




Copyright © 1996-2007 MasterCluster.com