Tooltip for text extending beyond control bounds

R

Rangi Keen

Is there a method to display a tooltip for text that is truncated on screen
similar to the way the Windows Explorer tree control does? I don't see any
method in the ToolTip class that would allow me to position it to line up
with the underlying control text rather than showing at the default location
below and to the right of the mouse.

Here are some of the properties I'd like in such a tool tip (essentially the
same as those in the Windows Explorer tree or other similar controls such as
data grids):
* Appears when moving the mouse over the text when the length of the text
exceeds the bounds of the area in which it is displayed
* Appears over the existing text so that the text in the tool tip is in the
same location as the text in the control
* Extends as far as necessary to the right to include all text in the
control (up to the width of the screen at least)
* Extends beyond the bounds of the current application (not truncated when
reaching the right side of the application window or containing form)
* When the user clicks the mouse, the underlying control receives the click,
not the tool tip object.

Thanks,
Rangi
 
J

Jeffrey Tan[MSFT]

Hi Rangi,

Actually, Windows Explorer tree is a standard treeview control of windows.
And the truncatable tooltip of Windows Explorer tree is the default
behavior of TreeView control. If you drag a normal treeview to the form,
then add some treenodes to the treeview with long text, you will see if the
treenode text is truncated, the tooltip will display when mouse over.

But for normal control, the standard tooltip behavior does not work like
this. And the tooltip component does not give us any feature of doing this.
If you really want to get such function, I think we have to invent all the
things ourselves.

First, we need some information on whether the control's text is
truncated(because we only want to display the tooltip when the text is
truncated). This need some help of the underlying control author, so the
more reasonable way is that we only add this function for certain(our)
control, and we are the author of the control, then we can get whatever
information we needed. Then we just need to listen to the mouse message,
and draw the tooltip like window on the text.(Also, we should erase the
tooltip when the mouse move out or use click the tooltip)

All in all, there is no build-in support for normal control of this
tooltip, we have to invent all the things. I suggest you take the standard
tooltip behavior of windows, this will give customer a consistent UI view
and experience for all other windows controls.
=================================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top