We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Mnemonics and the Tree control

If the node.text is too long to be displayed, the tooltip that is displayed converts any "&" characters to underscore. A node name such as "Profit & Loss" appears as "Profit Loss" in the tooltip. Is there a UseMnemonic property I can set on the tree to force the "&" to be displayed in the node tooltip?

9 Replies

MA Malarvizhi Syncfusion Team October 31, 2006 05:55 AM UTC

Hi Bob,

Sorry for the inconvenience caused. We were able to reproduce the issue here.

I have attached the sample, please go through that and let me know if i understood you correctly.

TreeView_tooltip.zip


Regards,
Malarvizhi.


MU Murugan Syncfusion Team October 31, 2006 06:17 PM UTC

Hi Bob,

Sorry for the inconvenience caused. We were able to reproduce the issue here. If you are using TreeNodeAdv.HelpText for displaying tooltip, Please change the helptext as TreeNodeAdv.HelpText = "Profit && Loss" and let me know the results.

Thanks,
Murugan P.S


AD Administrator Syncfusion Team October 31, 2006 08:49 PM UTC

I tried adding the following line of code immediately after I set the Node.Text property.

Node.HelpText = Node.Text.Replace("&","&&")

The result now is that if the tree control is wide enough that the entire node text is displayed then a "tooltip" is shown with the single ampersand character displayed correctly. The problem though is that if the tree control width is small enough to prevent the entire node text from being displayed, when I mouseover the node I get 2 separate tooltips popping up:
1) The first one still shows no "&" character - this tooltip seems to be displayed automatically by the tree without me requesting it.
2) The second tooltip (shown below the #1) seems to be generated based on me setting the .HelpText property (because it doesn't show up if I don't set that property). It shows correctly with one "&" character.

The .HelpText property looks like it will resolve my problem if I can find out how to prevent the default tooltip from appearing (when the entire node text can't be displayed because the tree is not wide enough).


MU Murugan Syncfusion Team October 31, 2006 10:22 PM UTC

Hi Bob,

TreeViewAdv control's default tooltip can be made invisible by cancelling the BeforePopUp event.

private void treeViewAdv2_ToolTipControl_BeforePopup(object sender, CancelEventArgs e)
{
e.Cancel = true;
}

Please try this code and let me know if you have any other issues.

Thanks,
Murugan P.S


AD Administrator Syncfusion Team November 3, 2006 11:18 PM UTC

Ok - in VB, I've tried declaring:

Private WithEvents TreeTooltip as new ToolTipAdv(MyTree)

where MyTree is the name of the TreeViewAdv control on my form.

I've added e.Cancel = True to the TreeTooltip.BeforePopup event, but the event doesn't fire. If I put a watch on my variables, MyTree.ToolTipControl is not the same object as TreeTooltip. Can you give me a code sample (VB) to correctly define my ToolTipAdv variable and associate it with my tree so the BeforePopup event fires?


GS Gopalakrishnan S Syncfusion Team November 4, 2006 12:53 AM UTC

Hi,

I have created a sample in VB.NET and attached here. Please refer the attachment sample.

Sample

Let me know if this works.

Regards,
S.Gopal.


AD Administrator Syncfusion Team November 7, 2006 09:19 PM UTC

Thanks for the sample - I have it working now. One last cosmetic question - the default node tooltip (which is now disabled) was displayed with a standard yellow background. The Node.HelpText tooltip is displayed with a different color background - a dirty brown/yellow shade. Is there a way I can get the Node.HelpText tooltip to display with the standard yellow background color?


MU Murugan Syncfusion Team November 7, 2006 09:52 PM UTC

Hi Bob,

HelperText backgroundcolor can be changed using treeViewAdv1.HelpTextControl.BackgroundColor property.

this.treeViewAdv1.HelpTextControl.BackgroundColor = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Info);

Please use the above code snippet and let me know if you need more assistance.

Thanks,
Murugan P.S


AD Administrator Syncfusion Team November 7, 2006 11:51 PM UTC

Thanks - that worked fine.

Loader.
Live Chat Icon For mobile
Up arrow icon