Creating Custom ToolTips

转载 2004年10月28日 15:55:00

The TreeView behavior provides a default ToolTip that displays when a user hovers over a TREENODE element. You may want your users to have more specific information than is provided by the default ToolTip (Use +/- to expand/collapse) accessed by the SHOWTOOLTIP attribute. You can accomplish this by creating three simple DHTML functions that use the ONHOVER and ONUNHOVER events to replace the default ToolTip.

The following sample shows what these methods might look like. The sample uses the TEXT attribute of the TreeNode object as the ToolTip text, but you could customize this to provide any information that you choose.
// ToolTip functions include starthover(), starttip(), and endtip()
 
    // ToolTip variables
    var myTimer;
    var nodeText;
    var tipX;
    var tipY;

function starthover()
{
    var myVal = window.event.treeNodeIndex;
    var myNode = oTree.getTreeNode(myVal);

    nodeText = myNode.getAttribute("text");
    tipX = window.event.clientX + 15;
    tipY = window.event.clientY + 15;

    myTimer = window.setTimeout(starttip, 1000);
}

function starttip()
{
    results1.style.backgroundColor = "infobackground";
    results1.style.position = "absolute";
    results1.style.left = tipX;
    results1.style.top = tipY;
    results1.style.border = "1px solid black";
    results1.innerText = nodeText;

    myTimer = window.setTimeout(endtip, 5000);
}

function endtip()
{
    results1.style.backgroundColor = "";
    results1.innerText = "";
    results1.style.border = "";
    window.clearTimeout(myTimer);
}
</HEAD>
    <BODY>
    <mytree:TREEVIEW id="oTree" TREENODESRC="state_city.xml"
    SHOWTOOLTIP="false" ONHOVER="starthover();" ONUNHOVER="endtip();" />
<!--This DIV is required to display the ToolTips-->
    <DIV id=results1></DIV>
    </BODY>
</HTML>

UIGestureRecognizer Tutorial: Creating Custom Recognizers

来源:点击打开链接 Custom gesture recognizers delight users by making apps feel unique and alive. If basic ...
  • zhifengyu
  • zhifengyu
  • 2015年08月11日 13:58
  • 133

Custom Tooltips——自定义工具提示

This example shows how to customize the buttons tooltips with Bootstrap. 这个例子用来展示如何使用Bootstrap来自定义按钮...
  • SmileCoffin
  • SmileCoffin
  • 2017年06月28日 11:06
  • 144

Custom Tooltips in WinForm TreeViews

 ToolTip tip=new ToolTip ();private void tree_MouseMove(object sender, System.Windows.Forms.MouseEv...
  • yuxuanji
  • yuxuanji
  • 2009年09月09日 10:58
  • 592

Creating custom iOS UIButtons

转自:http://www.apptite.be/blog/ios/creating-custom-ios-uibuttons/ Introduction Not only...
  • workhardupc100
  • workhardupc100
  • 2012年05月05日 17:11
  • 1223

Creating Custom Listeners

原文链接:https://guides.codepath.com/android/Creating-Custom-Listeners#custom-listeners The "listener...
  • yxwbtb
  • yxwbtb
  • 2015年07月15日 17:35
  • 240

Creating custom method of Connector

Connector's mapping rule can use function to compute complicated sync data during syncing data betwe...
  • ghostbear
  • ghostbear
  • 2013年06月25日 10:09
  • 1966

Creating Custom Views --1.0

做 Android 开发已经一段时间了,有时也会用到自定义控件,多数情况下,都是直接问度娘,然后将找来的控件改吧改吧,就用到项目里面了。于是,虽然用了不少的自定义控件,但由于没有好好的总结,终究还是对...
  • zjh_1110120
  • zjh_1110120
  • 2016年03月21日 21:13
  • 407

Creating Custom Exceptions in .NET

Creating Custom Exceptions in .NET Introduction Minimal Exceptions Types Serialization Basics ...
  • metasearch
  • metasearch
  • 2012年01月17日 10:34
  • 386

Creating Custom Views

Briefly introduce to creating custom views.
  • userqiaohaibin
  • userqiaohaibin
  • 2015年04月09日 09:23
  • 231

Creating Custom FFmpeg IO-Context

How to use an IStream-Interface with FFmpeg Introduction  In this short Article I will exp...
  • weiyuefei
  • weiyuefei
  • 2016年06月16日 09:52
  • 366
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Creating Custom ToolTips
举报原因:
原因补充:

(最多只允许输入30个字)