Client-Side: how to set tooltip.set_showEvent() to "FromCode" ?

5 posts, 0 answers
  1. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 20 Apr 2009 Link to this post

    Hi,

    Using version 2009 Q1 SP1 (2009.1.402.35), I'm dynamically creating a tooltip from a ToolTipManager client-object as explained here : http://demos.telerik.com/aspnet-ajax/tooltip/examples/radtooltipmanagerclientapi/defaultcs.aspx

    I want to display the tooltip only when the user clicks an image, not when hovering over it. It works for the first click since no tooltip exists for the image, but after that, hovering over the image opens the tooltip. So my question is how to correctly use the client-side function set_showEvent() to set the event to "FromCode" ? There does not seem to be any documentation about that function.

    Thanks for your help,

    dstj.
  2. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 21 Apr 2009 Link to this post

    I did an "alert(tooltip.get_showEvent());" on a tooltip created in the .aspx markup file to get the correct codes for ShowEvent. Here are my findings :
    OnMouseOver = 1
    OnClick = 2
    OnRightClick = 4
    OnFocus = 8
    FromCode = 16

    I tried passing 16 to set_showEvent() as in the following code, but the newly created toolitp still opens on "onmouseover" instead of from my code hooked to the "click" event.

    1    function PopupTooltipManager(anchor) 
    2    { 
    3       //If the user hovers the image before the page has loaded, there is no manager created 
    4       if (!window.toolTipManager) return
    5          
    6       //Find the tooltip for this element if it has been created 
    7       var tooltip = toolTipManager.getToolTipByElement(anchor); 
    8          
    9       //Create a tooltip if no tooltip exists for such element 
    10       if (!tooltip) { 
    11          tooltip = toolTipManager.createToolTip(anchor); 
    12          tooltip.show(); tooltip.hide(); // fixes "this._contentCell is null" bug. 
    13           
    14          tooltip.set_showEvent(16); 
    15           
    16          var contentElement = document.createElement('SPAN');   
    17          contentElement.innerHTML = 'Testing' 
    18          tooltip.set_contentElement(contentElement); 
    19       } 
    20  
    21       //show the tooltip 
    22       tooltip.show(); 
    23    } 

    Is there a problem with the Client side API ?

    Thanks,

    dstj.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Apr 2009 Link to this post

    Hi dstj,

    The RadToolTip control is designed to show up under the same circumstances and we do not recommend to change its show event on the client. Would you please provide more details about your exact scenario and why you need to do this? Once we have a better understanding on your scenario and requirements, we will suggest you a reasonable solution to achieve your goal.

    Sincerely yours,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. dstj
    dstj avatar
    82 posts
    Member since:
    Oct 2006

    Posted 23 Apr 2009 Link to this post

    Hi,

    I think I understand what you're saying. You suggest setting the maximum tooltip settings from the .aspx markup file. So instead of using the client-side function set_showEvent(), I should set ShowEvent="FromCode" in the RadToolTipManager like so :

    <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" RelativeTo="Mouse" Position="BottomLeft"
                               Width="400px" ManualClose="true" ShowEvent="FromCode"
       <WebServiceSettings Path="~/services/RadControlsHelper.asmx" Method="GetItemData" /> 
    </telerik:RadToolTipManager> 

    I tried it, it works well.

    I think that I was thrown off by the fact that there are some set functions in the client api like set_manualClose(), set_modal(), set_relativeTo(). I assumed that set_showEvent() would work the same way.

    Might I suggest adding some more explications either in the "ToolTip / RadToolTipManager Client-side API" demo or in the "Client-Side Basics" documentation about this?

    Thanks for your support,

    dstj.
  6. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 24 Apr 2009 Link to this post

    Hello dstj,

    The show event is the most fundamental property of the RadToolTip and we believe that it will be confusing for the end user if the tooltip sometimes show on one event and on another next times. That is why we do not think that it is appropriate to change this on the client.

    That is why we have not included the set_showEvent method in the RadToolTip's client side API reference - you can see that it is not listed below:

    http://www.telerik.com/help/aspnet-ajax/tooltip_clientradtooltip.html

    The method is not listed there exactly because of the above explained reasons and we do not expect it to be used by our clients. However, as I already explained in case of a very particular scenario in which this is a must we are ready to provide reasonable solution after getting a better understanding on the scenario itself.

    Kind regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017