Reference » Window classes » MInfoLabel

Elgrint::MInfoLabel class

Declared in WCInfoLabel.h

Description

Displays temporary textual information about its parent window.

MInfoLabel

Base class: MWindow

Properties:

Name Description
DistFromCursor The minimal separation between label and cursor during tracking.
Text Text displayed in the info label (can contain line-breaks).

Initializers:

Name Description
MInfoLabel(parent,rect,text) Standard-form constructor. Creates and opens a new info label window.

Handlers:

Name Description
OnCursorMoved

DistFromCursor support

OnHotChanged

Hide on cursor departure

OnKeysEntered

Close on any key

OnPaint

Draw background, border, and Text

OnRectChanging

Autosizing

OnTimerExpired

Close on time-out (via timer 1000)

Details

Info label is a small window with text (defined by the Text property), which provides some additional information about its parent window. For example, MButton uses an info label to display its text, if the button itself is already occupied by an icon. MListBox and MTreeListBox use an info label to display a hot item on the list, if it's partially clipped by the window. Info labels are often called "tooltips".

By default, the info label is a floating window, because it's usually displayed next to its parent window and not inside it (a non-floating label would be clipped by the parent, making it largely useless).

It is a common practice to create this label when the cursor stands still ("hovers") inside the parent window for a certain period of time. Therefore, by default, the info label is automatically closed if neither it nor its parent is a hot window (i.e. the cursor has moved elsewhere).

Even if the label or its parent remain hot, the label exists only for 5 seconds and then closes. This behavior is controlled by timer 0 (see TimerExpired), which is set in label's constructor, so if setTimer(0,n) is called right after the label's creation, it will auto-close after n milliseconds instead (or never, if n = None). Alternatively, this auto-close feature can be changed by overloading OnTimerExpired for timer 0.

The label is also closed if any key is pushed anywhere in the app.

Moving the cursor inside the parent's window does not close the label, but the label can optionally move with the cursor ("stick" to the cursor), always staying at a certain distance from it, which is defined by the DistFromCursor property (by default it's set to NonePoint, which means that the label ignores the cursor movements).

Example

Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.