Loading ...
Sorry, an error occurred while loading the content.

Re: [OLmws] tooltip to sticky on click?

Expand Messages
  • Foteos Macrides
    ... From: etedor To: overlibmws@yahoogroups.com Sent: Monday, January 10, 2005 3:09 AM Subject: [OLmws] tooltip to sticky on click? Hey, Was wondering if it
    Message 1 of 4 , Jan 10, 2005
    • 0 Attachment
      ----- Original Message -----
      From: etedor
      Sent: Monday, January 10, 2005 3:09 AM
      Subject: [OLmws] tooltip to sticky on click?
       
      Hey,

      Was wondering if it possible to make a tooltip that turned into a sticky when it was clicked, then have the popup close when a link inside it was clicked.

      Thanks in advance.
      -Eric
       
      Eric,
       
      The easiest way to do that is by setting up nearly identical popups to be invoked via the onmouseover and onclick event attributes, but with the onclick popup including the STICKY command.  The "Close" link automatically is included or not in the caption depending on whether the STICKY command is used.  The click actually will replace the popup that was invoked via the mouseover, but visually it will appear to be a "conversion" to stickiness with the "Close" link added to the caption.  Define the popup content as a javascript variable or array entry, and use the variable name or array index for the lead argument of both overlib calls.  You need not include a caption for the mouseover-evoked version.  If you also do not want a caption for the sticky version, you can modify its content so as to include a "Close" link of its own in the main text area of the popup, with either text or an image as the anchor content.  The href for that link should be
       
      '... href="javascript:return '+OLfnRef+'cClick();" ..'
       
      but you only need the frame reference if you are using frames, i.e., otherwise you can simply use:
       
      '... href="javascript:return cClick();" ...'
       
      The first through fourth popups in the:
       
       
      support document are using javasript variable definitions for the lead argument, and either text or an image as the "Close" link's anchor content.  Also, the second through fourth popups are setting up that link in the main text area.  Use your browser's View Source button to see the markup for that support document.
       
      Fote
      --
       
    • etedor
      Well that was a lot easier than I expected it to be. Thanks. I ve run into another problem though. I m using overlib along with XML to make myself a new
      Message 2 of 4 , Jan 10, 2005
      • 0 Attachment
        Well that was a lot easier than I expected it to be. Thanks.
        I've run into another problem though. I'm using overlib along
        with XML to make myself a new desktop menu. I wanted there to
        be links inside the sticky-submenu, but the XML doesn't agree.

        If it helps, here's the code for my submenu function...

        case "sub":
        mainprint += '<a target="_self" href="javascript:void(0);"
        onmouseover="return overlib(\'' + node.getAttribute("string") + '\')"
        onclick="return overlib(\'' + node.getAttribute("string") + '\',
        STICKY,TIMEOUT,4500)"; onmouseout="return nd();"><img src=\'' + node.
        getAttribute("image") + '\'>';
        for(var i = 0 ; i < node.childNodes.length ; i++)
        {
        search_and_destroy(node.childNodes.item(i));
        }
        mainprint += '</img></a><img src="images/spacer.gif"/>';
        return;

        And an example of a submenu...

        <sub path="C:/Core" string="Test1 | Test2" image="icons/hd.gif"/>

        So yea, won't let me put links into the string, and I have no idea
        on how to get around it. This doesn't really have anything to do with
        overlib any more, but if you could help, I'd appreciate it.

        Thanks again.
      • Foteos Macrides
        ... From: etedor To: overlibmws@yahoogroups.com Sent: Monday, January 10, 2005 7:58 PM Subject: Re: [OLmws] tooltip to sticky on click? Well that was a lot
        Message 3 of 4 , Jan 10, 2005
        • 0 Attachment
          ----- Original Message -----
          From: etedor
          Sent: Monday, January 10, 2005 7:58 PM
          Subject: Re: [OLmws] tooltip to sticky on click?
           
          Well that was a lot easier than I expected it to be. Thanks. I've run into another problem though. I'm using overlib along
          with XML to make myself a new desktop menu. I wanted there to be links inside the sticky-submenu, but the XML doesn't agree.

          If it helps, here's the code for my submenu function...

          case "sub":
          mainprint += '<a target="_self" href="javascript:void(0);"
          onmouseover="return overlib(\'' + node.getAttribute("string") + '\')"
          onclick="return overlib(\'' + node.getAttribute("string") + '\',
           STICKY,TIMEOUT,4500)";
          onmouseout="return nd();"><img src=\'' + node.
          getAttribute("image") + '\'>';
          for(var i = 0 ; i < node.childNodes.length ; i++)
          {
          search_and_destroy(node.childNodes.item(i));
          }
          mainprint += '</img></a><img src="images/spacer.gif"/>';
          return;

          And an example of a submenu...

          <sub path="C:/Core" string="Test1 | Test2" image="icons/hd.gif"/>

          So yea, won't let me put links into the string, and I have no idea on how to get around it. This doesn't really have anything to do with overlib any more, but if you could help, I'd appreciate it.

          Thanks again.
           
          Off hand I suspect you are encountering embedded quoting problems.  Remember that in addition to getting embedded quotes past stages of javascript parsing, e.g., using backslash escaping as you show (\') and possibly backslash escaping of the backslash for deeper nesting (\\\'), you may need to use HTML entities such as &quot; for nested double-quotes to not have the XML/HTML parser prematurely terminate quoted strings.
           
          I notice that you are using a TIMOUT for the "onclick converted" stickies.  You might want to add the MOUSEOFF command so that if you move the mouse onto the sticky, the TIMEOUT is cancelled and the popup will persisting until OFFDELAY msecs (default is 300) after you move the mouse back off of the popup, but will persist further if you move back onto the popup within that delay period.  Read about MOUSEOFF, NOCLOSE, and OFFDELAY in the Command Reference;
           
           
          and try the:
           
           
          support document.  You also can use a time (msec) parameter in the nd() call to delay the close, with a reset if you mouse back on, as also illustrated in that support file (if you do include a time parameter, then nd() becomes cClick() after that interval and will close stickies in addition to tooltip popups).
           
          But to get back to your menu popups objective, if you get too frustrated trying to sort out any nested quoting problems, a simple fallback is to create the menu as an html file and feed it to the popup as iframe content.  See the:
           
           
          and:
           
           
          support documents.
           
          Fote
          --
           
        • etedor
          Thanks again for the quick reply. I ve added a bit since I posted. Messed around with mouseoff and the timeout, decided to stick with mouseoff. Right now, it
          Message 4 of 4 , Jan 10, 2005
          • 0 Attachment
            Thanks again for the quick reply.

            I've added a bit since I posted. Messed around with
            mouseoff and the timeout, decided to stick with mouseoff.

            Right now, it looks like this...

            case "sub":
            mainprint += '<a target="_self" href="javascript:void(0);"
            onmouseover="return overlib(\'<a href=\'' + node.getAttribute("path1")
            + '>' + node.getAttribute("string1") + '</a> \')" onclick="return
            overlib(\'' + node.getAttribute("string1") + '\',STICKY,MOUSEOFF)";
            onmouseout="return nd();"><img src=\'' + node.getAttribute("image") +
            '\'>';
            for(var i = 0 ; i < node.childNodes.length ; i++)
            {
            search_and_destroy(node.childNodes.item(i));
            }
            mainprint += '</img><img src="images/spacer.gif"/>';
            return;

            An example...

            <sub path1="C:/Core" string1="Test1" image="icons/hd.gif"/>

            Doesn't want to show the mouseover tooltip at all,
            but the onclick sticky works... Kinda.

            I think it'd be easier to fix over AIM/MSN.
            If you don't mind, I'm on...

            AIM: shotgun fiend
            MSN: jagdgewehr@...

            I could get on IRC too if that works for you.

            -Eric
          Your message has been successfully submitted and would be delivered to recipients shortly.