PDA

View Full Version : [CLOSED] Tooltip autosize



FpNetWorth
Jan 30, 2013, 3:08 PM
Hi all,

I have a tooltip which shows the value of the combo's selected item.
The problem is that the combo may contain different size text. So i want that the size of the tooltip changes dynamically.


<ToolTips>
<ext:ToolTip Height="40" Width="130" runat="server" TrackMouse="true">
<Listeners>
<Show Handler="this.body.update(#{myCombo}.getRawValue()); />
</Listeners>
</ext:ToolTip>
</ToolTips>


Any idea about this?

Thanks

Baidaly
Jan 30, 2013, 11:11 PM
Hello!

You have to use setWidth method. Look at the following example:


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">

protected void Page_Load()
{
myCombo.SelectedItems.Add(new Ext.Net.ListItem(60));
}

private object Sizes
{
get
{
return new object[]
{
new object[] { 60, 60 },
new object[] { 120, 120 },
new object[] { 180, 180 }
};
}
}

</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET Examples</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" SourceFormatting="True" />

<ext:ComboBox
runat="server"
FieldLabel="Sizes combo"
ID="myCombo"
DisplayField="size"
Width="320"
LabelWidth="130"
QueryMode="Local"
TypeAhead="true">
<Store>
<ext:Store runat="server" Data="<%# Sizes %>" AutoDataBind="true">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="size" />
<ext:ModelField Name="sizeText" />
</Fields>
</ext:Model>
</Model>
<Reader>
<ext:ArrayReader />
</Reader>
</ext:Store>
</Store>
<ToolTips>
<ext:ToolTip Height="40" Width="60" runat="server" TrackMouse="true">
<Listeners>
<BeforeShow Handler="item.setWidth(#{myCombo}.getValue());" ></BeforeShow>
<Show Handler="this.body.update(#{myCombo}.getRawValue());" />
</Listeners>
</ext:ToolTip>
</ToolTips>
</ext:ComboBox>
</form>
</body>
</html>