This is a migrated thread and some comments may be shown as answers.

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

4 Answers 124 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
dstj
Top achievements
Rank 1
dstj asked on 20 Apr 2009, 09:27 PM
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.

4 Answers, 1 is accepted

Sort by
0
dstj
Top achievements
Rank 1
answered on 21 Apr 2009, 04:40 PM
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.

   function PopupTooltipManager(anchor) 
   { 
      //If the user hovers the image before the page has loaded, there is no manager created 
      if (!window.toolTipManager) return
         
      //Find the tooltip for this element if it has been created 
      var tooltip = toolTipManager.getToolTipByElement(anchor); 
         
      //Create a tooltip if no tooltip exists for such element 
      if (!tooltip) { 
         tooltip = toolTipManager.createToolTip(anchor); 
         tooltip.show(); tooltip.hide(); // fixes "this._contentCell is null" bug. 
          
         tooltip.set_showEvent(16); 
          
         var contentElement = document.createElement('SPAN');   
         contentElement.innerHTML = 'Testing' 
         tooltip.set_contentElement(contentElement); 
      } 
 
      //show the tooltip 
      tooltip.show(); 
   } 

Is there a problem with the Client side API ?

Thanks,

dstj.

0
Svetlina Anati
Telerik team
answered on 23 Apr 2009, 08:52 AM
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.
0
dstj
Top achievements
Rank 1
answered on 23 Apr 2009, 01:01 PM
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.
0
Svetlina Anati
Telerik team
answered on 24 Apr 2009, 09:17 AM
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.
Tags
ToolTip
Asked by
dstj
Top achievements
Rank 1
Answers by
dstj
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or