Relaying Mouse Messages to the Tooltip
A tooltip control needs to receive mouse messages to determine when to display
the tooltip window. Because Windows sends mouse messages only to the window
that contains the cursor, you must use the
TTM_RELAYEVENT message to relay mouse messages to the tooltip control.
If a tool is implemented as a rectangular area in an application-defined
window, the window procedure receives mouse messages and can relay them to the
tooltip control. However, if a tool is implemented as a system-defined window, the
mouse messages are sent to the window and are not readily available to the
application. You must use a message hook to access and relay the mouse messages, or
you must subclass the window.
When a tooltip control receives a relayed
WM_MOUSEMOVE message, it determines whether the cursor is in the bounding rectangle of a
tool. If the cursor is there, the tooltip control sets a timer. At the end of
the time-out duration, the tooltip control checks the position of the cursor to
see whether it has moved. If the cursor has not, the tooltip control retrieves
the text for the tool, copies the text into the tooltip window, and shows the
window. The tooltip control continues to show the window until it receives a
relayed button-up or button-down message or until a relayed WM_MOUSEMOVE message
indicates that the cursor has moved outside the bounding rectangle of the tool.
A tooltip control actually has three time-out durations associated with it.
The
initial duration is the length of time that the cursor must remain stationary within the
bounding rectangle of a tool before the tooltip window is displayed. The
reshow duration is the length of the delay before subsequent tooltip windows are displayed
when the cursor moves from one tool to another. The
autopopup duration is the length of time that the tooltip window remains displayed before it is
hidden. That is, if the cursor remains stationary within the bounding rectangle
after the tooltip window is displayed, the tooltip window is automatically
hidden at the end of the autopopup duration. You can adjust all of the time-out
durations by using the
TTM_SETDELAYTIME message.
If an application includes a tool implemented as a rectangular area and the
size or position of the control changes, it can use the
TTM_NEWTOOLRECT message to report the change to the tooltip control. An application does not
need to report size and position changes for a tool implemented as a window.
Reporting that is not necessary because the tooltip control uses the window
handle of a tool to determine if the cursor is on the tool, not the tool's bounding
rectangle.
When it is about to be displayed, a tootip control sends the
TTN_SHOW notification to the owner window. A tooltip control sends the
TTN_POP notification when it is about to be hidden. Each notification is sent in the
context of a
WM_NOTIFY message.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database