Create a tooltip in AdvancedDataGrid
Hi,
I would I to ask how to create a tooltip in AdvancedDataGrid.
I created a new MXML component named CustomToolTip, based on a VBox.
This is my code for custom tooltip:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:fx="http://ns.adobe.com/mxml/2009"
implements="mx.core.IToolTip"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:services="services.*">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
[Bindable]
public var _dataId:String;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
var dataid:String;
dataid = _dataId;
getSpecificUserDataCResult.token = twitterSentimentManager.getSpecificUserDataC(dataid);
protected function dataGrid2_creationCompleteHandler(event:FlexEvent):void
var dataid:String;
dataid = _dataId;
getSpecificUserDataUResult.token = twitterSentimentManager.getSpecificUserDataU(dataid);
public var _text:String;
public function get text():String {
return _text;
public function set text(value:String):void {
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getSpecificUserDataCResult"/>
<services:TwitterSentimentManager id="twitterSentimentManager" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<s:CallResponder id="getSpecificUserDataUResult"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Panel width="401" height="300">
<mx:Image x="52" y="10" width="105" height="91" creationComplete="dataGrid_creationCompleteHandler(event)" source="{getSpecificUserDataUResult.lastResult[0].category}"/>
<s:Label x="197" y="22" text="Username"/>
<s:Label x="197" y="55" text="Name"/>
<s:Label x="197" y="89" text="Bio Info"/>
<s:Label x="261" y="22" id="username0" text="{getSpecificUserDataUResult.lastResult[0].userID}"/>
<s:Label x="261" y="55" id="name0" text="{getSpecificUserDataUResult.lastResult[0].name}"/>
<s:Label x="261" y="89" id="bioinfo0" text="{getSpecificUserDataUResult.lastResult[0].bioData}"/>
<s:Label x="52" y="140" text="Content"/>
<s:TextArea x="105" y="140" height="90" text="{getSpecificUserDataCResult.lastResult[0].content}"/>
</s:Panel>
<mx:DataGrid id="dataGrid2" creationComplete="dataGrid2_creationCompleteHandler(event)" dataProvider="{getSpecificUserDataUResult.lastResult}" visible="false">
<mx:columns>
<mx:DataGridColumn headerText="userID" dataField="userID"/>
<mx:DataGridColumn headerText="weeklyInfluentialIndex" dataField="weeklyInfluentialIndex"/>
<mx:DataGridColumn headerText="following" dataField="following"/>
<mx:DataGridColumn headerText="category" dataField="category"/>
<mx:DataGridColumn headerText="follower" dataField="follower"/>
<mx:DataGridColumn headerText="bioData" dataField="bioData"/>
<mx:DataGridColumn headerText="location" dataField="location"/>
<mx:DataGridColumn headerText="influentialIndex" dataField="influentialIndex"/>
<mx:DataGridColumn headerText="name" dataField="name"/>
</mx:columns>
</mx:DataGrid>
<mx:DataGrid id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getSpecificUserDataCResult.lastResult}" visible="false">
<mx:columns>
<mx:DataGridColumn headerText="content" dataField="content"/>
<mx:DataGridColumn headerText="userID" dataField="userID"/>
<mx:DataGridColumn headerText="sentiment" dataField="sentiment"/>
<mx:DataGridColumn headerText="dateTime" dataField="dateTime"/>
<mx:DataGridColumn headerText="contentID" dataField="contentID"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
This is the code for AdvancedDataGrid "AllSentiments.mxml" :
<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:component="component.*, com.hillelcoren.components.*"
xmlns:components="com.hillelcoren.components.*"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:services="services.*"
close="titleWindow_close(event)" title="Sentiments">
<fx:Script>
<![CDATA[
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;
import mx.events.CloseEvent;
import mx.events.FlexEvent;
import mx.events.ListEvent;
import mx.events.ToolTipEvent;
import mx.managers.PopUpManager;
import spark.components.IItemRenderer;
import spark.components.TitleWindow;
[Bindable]
public var _currentCountryName:String;
protected function myADG_creationCompleteHandler(event:FlexEvent):void
var currentCountryName:String;
currentCountryName = _currentCountryName;
getSpecificCountryResult.token = twitterSentimentManager.getSpecificCountry(currentCountryName);
private function createCustomToolTip(event:ToolTipEvent):void {
var toolTip:CustomToolTip = new CustomToolTip();
var dataid:String = AdvancedDataGridItemRenderer(event.itemRenderer).data.userID;
toolTip._dataId = dataid;
event.toolTip=toolTip;
private function deleteToolTip(event:ListEvent):void {
myADG.toolTip = null;
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getSpecificCountryResult" result="getSpecificCountryCollection.refresh()"/>
<services:TwitterSentimentManager id="twitterSentimentManager" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
<mx:GroupingCollection2 id="getSpecificCountryCollection" source="{getSpecificCountryResult.lastResult}">
<mx:Grouping>
<mx:GroupingField name="sentiment"/>
</mx:Grouping>
</mx:GroupingCollection2>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:AdvancedDataGrid x="48" y="50" id="myADG" designViewDataType="tree" toolTipCreate="createCustomToolTip(event)" selectedIndex="0" creationComplete="myADG_creationCompleteHandler(event)" dataProvider="{getSpecificCountryCollection}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="sentiment" dataField="sentiment"/>
<mx:AdvancedDataGridColumn headerText="userID" dataField="userID"/>
<mx:AdvancedDataGridColumn headerText="dateTime" dataField="dateTime"/>
</mx:columns>
</mx:AdvancedDataGrid>
/s:TitleWindow>
I got an error: "1119: Access of possibly undefined property itemRenderer through a reference with static type mx.events:ToolTipEvent."
May I know where I have done wrong?
Thanks
Hi,
I see that this question is unanswerd for a while, and I came across it when I encountered the same problem.
If you want to acheive the tootip for each CELL in the datagrid then you can use the ItemOver listener
setup the listener:
dg.addEventListener(ListEvent.ITEM_ROLL_OVER , itemOver);
define itemOver:
public function itemOver(event:ListEvent):void
var toolTipText:String = (AdvancedDataGridItemRenderer)(event.itemRenderer).text; //only if you want to show the text in the cell itself as the tooltip
(AdvancedDataGridItemRenderer)(event.itemRenderer).toolTip = toolTipText;
and thats all you have to do.
Regards
Faizal
Similar Messages
-
Hello,
I would I to ask how to create a tooltip in AdvancedDataGrid.
My MXML component is a VBox based component.
This is the code for my custome ToolTip using Panel:
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
[Bindable]
public var _dataId:String;
protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
var dataid:String;
dataid = _dataId;
getSpecificUserDataCResult.token = twitterSentimentManager.getSpecificUserDataC(dataid);
protected function dataGrid2_creationCompleteHandler(event:FlexEvent):void
var dataid:String;
dataid = _dataId;
getSpecificUserDataUResult.token = twitterSentimentManager.getSpecificUserDataU(dataid);
]]>
</fx:Script>
This is the code for AdvancedDataGrid:
<fx:Script>
<![CDATA[
import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer;
import mx.events.FlexEvent;
import mx.events.ListEvent;
import mx.events.ToolTipEvent;
import spark.components.IItemRenderer;
private function createCustomToolTip(event:ToolTipEvent):void {
var toolTip:CustomToolTip = new CustomToolTip();
toolTip._dataId = event.target.data;
event.toolTip=toolTip;
private function createCustomToolTip(event:ToolTipEvent):void {
var toolTip:CustomToolTip = new CustomToolTip();
var dataid:String = AdvancedDataGridItemRenderer(event.itemRenderer).data.userID;
toolTip._dataId = dataid;
event.toolTip=toolTip;
]]>
</fx:Script>
<mx:AdvancedDataGrid x="48" y="50" id="myADG" designViewDataType="tree" data="myADG.currentItem" toolTipCreate="createCustomToolTip(event)" selectedIndex="0" creationComplete="myADG_creationCompleteHandler(event)" dataProvider="{getSpecificCountryCollection}">
<mx:columns>
<mx:AdvancedDataGridColumn headerText="sentiment" dataField="sentiment"/>
<mx:AdvancedDataGridColumn headerText="userID" dataField="userID"/>
<mx:AdvancedDataGridColumn headerText="dateTime" dataField="dateTime"/>
</mx:columns>
</mx:AdvancedDataGrid>
</s:TitleWindow>
It didnt show any error, but nothing happen when mouseover.
I dont know which part is wrong?
Thank You!Hi,
I see that this question is unanswerd for a while, and I came across it when I encountered the same problem.
If you want to acheive the tootip for each CELL in the datagrid then you can use the ItemOver listener
setup the listener:
dg.addEventListener(ListEvent.ITEM_ROLL_OVER , itemOver);
define itemOver:
public function itemOver(event:ListEvent):void
var toolTipText:String = (AdvancedDataGridItemRenderer)(event.itemRenderer).text; //only if you want to show the text in the cell itself as the tooltip
(AdvancedDataGridItemRenderer)(event.itemRenderer).toolTip = toolTipText;
and thats all you have to do.
Regards
Faizal -
How create a tooltips in status bar icons
the answer is in the title
I want to create a tooltips on my application icon tray, in the status bar icon.
I think that the solution is in the SDK, but i dont know to implement this code:
source MSDN:
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
NOTIFYICONDATA IconData = {0};
IconData.cbSize = sizeof(IconData);
IconData.hWnd = hwndNI;
IconData.uFlags = NIF_INFO;
HRESULT hr = StringCchCopy(IconData.szInfo, ARRAYSIZE(IconData.szInfo), TEXT("Your message text goes here."));
if(FAILED(hr))
// TODO: Write an error handler in case the call to StringCchCopy fails.
IconData.uTimeout = 15000; // in milliseconds
Shell_NotifyIcon(NIM_MODIFY, &IconData);If you're interested in the icons in the notification area, I think the easiest solution is to use the "System Tray Icons" functions in toolbox.fp.
You can create a new icon calling InstallSysTrayIcon(), and you can also set the tooltip text.
Vix
In claris non fit interpretatio
Using LV 2013 SP1 on Win 7 64bit
Using LV 8.2.1 on WinXP SP3
Using CVI 2012 SP1 on Win 7 64bit, WinXP and WinXP Embedded
Using CVI 6.0 on Win2k, WinXP and WinXP Embedded -
Creating a "ToolTip" like function with a small delay
I have created a tool tip type of a function. The problem is that it constantly shows! How can I go about adding a delay, so the user has to hover the mouse over a particular spot for a second or two before the tip shows? I was thinking up something with a timer and a thread...I'd appreciate advice!
ThanksI don't see why not. The API documentation specifically mentions tooltips, and the component has getToolTipText() and setToolTipText() methods. (I once tried overriding the getText() method for JButton, and it didn't work at all the way I expected it to work, so I don't exactly know how you would use those methods.)
There's a tutorial about JToolTip that you may not have seen yet:
http://java.sun.com/docs/books/tutorial/uiswing/components/tooltip.html
However this may not help you in deciding exactly where you should be calling the logic to decide what to display in the tool tip. Good luck. -
Unable to create a tooltip for a line drawn on cartesiandatacanvas in flex
I am trying to draw a line on cartesiandatacanvas. While I am able to draw lines easily using the canvas.moveTo and canvas.lineTo methods, I cannot provide a tooltip to the line if I use that functionality. I have tried creating a label(when ever I draw a line) and adding a tooltip to it but since I show the lines in a 10*10 grid both vertical and horizontal there is a overlap and it is confusing.
So now I am trying to create a line object that extends shape or UIComponent. I cannot add this object to canvas using the addChild method it does not work. The addDataChild method works but it messes with the positioning of the line. Can someone help with a solution to this.
Simply put I want to draw lines on a datacanvas and add tooltips to them.
Here is my code for the line object:
package
import flash.display.CapsStyle;
import flash.display.JointStyle;
import flash.display.LineScaleMode;
import mx.core.UIComponent;
public class Line extends UIComponent
public var x1:Number;
public var x2:Number;
public var y1:Number;
public var y2:Number;
public var color:Number;
public function Line(x1:Number,
y1:Number,
x2:Number,
y2:Number,color:Number)
super();
this.graphics.lineStyle(4,
color,
1,
true,
LineScaleMode.NORMAL,
CapsStyle.ROUND,
JointStyle.MITER,
1
this.graphics.moveTo(x1,y1);
this.graphics.lineTo(x2,y2);
Here is a sample MXML that has a canvas and tries to use the line object above:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="init()">
<mx:Script>
<![CDATA[
import Line;
import mx.charts.chartClasses.CartesianCanvasValue;
public function init():void
var line:Line = new Line(10,10,40,40,0XFF0000);
// canvas.addChild(line); *Does not Work*
canvas.addDataChild(line,10,10,null,null,null,null);
]]>
</mx:Script>
<mx:Panel x="60" y="53" width="517" height="472" layout="absolute">
<mx:PlotChart x="48" y="10" id="plotchart1">
<mx:series>
<mx:PlotSeries displayName="Series 1" yField=""/>
</mx:series>
<mx:annotationElements>
<mx:CartesianDataCanvas id="canvas" includeInRanges="true"/>
</mx:annotationElements>
<mx:verticalAxis>
<mx:LinearAxis id="axis11" minimum="0" maximum="100" interval="10" padding="10"/>
</mx:verticalAxis>
<mx:horizontalAxis>
<mx:LinearAxis id="axis21" minimum="0" maximum="100" interval="10" padding="10"/>
</mx:horizontalAxis>
</mx:PlotChart>
<mx:Legend dataProvider="{plotchart1}"/>
</mx:Panel>
</mx:WindowedApplication>this sovled my problem:
try the following:
# cd /etc
# cp driver_aliases driver_aliases.BKP
# rem_drv sgen
Then try adding it again:
# add_drv -m '* 0666 bin bin' -i '"scsiclass,01" "scsiclass,08" "scsa,0.1.bmpt" "scsa,0.8.bmpt"' sgen
this should come back to the prompt if it is ok.
Then we can check the at the 'scsiclass,01' entry has been added to the 'driver_aliases'.
# cd /etc
# grep sgen driver_aliases
sgen "scsiclass,01"
sgen "scsiclass,08"
sgen "scsa,0.1.bmpt"
sgen "scsa,0.8.bmpt"
after reboot /dev/scsi/sequential was created and tapes bounded to sg -
Hi,
I looked every where for a popup in AdvancedDataGrid over cells,
I found a good example for DataGrid but not for AdvancedDataGrid :(
Can you please help me here?
Thanks
JoSince this is happening with a web application, and doesn't appear to be AIR specific, could you repost this question over on the Flex forums?
Thanks,
Chris -
Spry tooltip works in IE but not Firefox
Hi,
I don't understand or can't figure out what I have done wrong. I have created a tooltip for the last product (4 inch diameter Vortex Water Revitalizer in copper (special order)) on the page: http://www.alivewater.net/order.htm
It works in IE but not Firefox... I can't figure out why... can you help me and see what I have done wrong?
Eternally grateful,
StarryI think I fixed the problem.. maybe you had looked at it after it was fixed. I do appreciate your help though!
-
How to create a toolitip with JLabel with thread
hi,
i need to create a tooltip which, when i focus on a button the label should appear from the bottom of the window and slowly it should move up to some range.it setted null layout to the frame.
can any one tell me here is code goes using thread
public void run()
try{
for(int i=700;i>600;i=i-10)
final int y=i;
try {
Thread.sleep(1000);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
la.setText("df"+y);
la.setBounds(300,y-50,500,400);
catch (Exception e) {}
System.out.println(i);
}catch(Exception e){}
advance congrats to the candidates.{color:#ff0080}Multi post - including this --
{color}{color:#0000ff}http://forum.java.sun.com/thread.jspa?threadID=5222831
http://forum.java.sun.com/thread.jspa?threadID=5221700
http://forum.java.sun.com/thread.jspa?threadID=5221761
http://forum.java.sun.com/thread.jspa?threadID=5130970{color}{color:000080}
db{color} -
How to display cusomized custom tooltip(jwindow) in jtable cell position
Hi,
i am trying to display custom tooltip for jtable cell. i created custom tooltip(jwindow) and on mouseover of jtable cell i am trying to display the custom tooltip.
But it is not display the position of jtable cell. How to display the exact position of jtable cell
please help me on this.Did you read the posting directly below yours which was also about a custom tool tip?
JScrollableToolTip is buggy
The code presented there shows the tool tip in the proper location.
For more help create a [url http://sscce.org]SSCCE, that demonstrates the incorrect behaviour.
Don't forget to read the "Welcome to the new home" posting at the start of the forum to learn how to use the "code tags" so posted code is formatted and readable. -
How to put image in tooltip?
I know that to create a tooltip I would put the following code into the HTML Form Element Attributes property of a page item.
onmouseover="toolTip_enable(event,this,'my tooltip text');"
But, how do I get an image in the tooltip?
Thanks,
MaggieHi,
What is your Apex version?
Regards,
Jari -
Tooltip for points in 'Chart Engine'-diagram
Hi,
I am using the Chart Engine (Class CL_GUI_CHART_ENGINE) to display a column chart.
Is there a way to show the value of a point in a tooltip when placing the mouse cursor on a column?
Thanks for any suggestions!
Regards, MathisHave you already updated your SAPGUI installation? Make sure to use the latest SAPGUI 6.40 or 7.10 patchlevel!
Mathis, you are right: the control checks the data XML for alt within the extension attributes. If you define alt the text is used as a tooltip. If there's no alt (or even no extension) in the data XML then the control automatically creates the tooltip as described above (displaying Series/Point/Value).
Example:
<Series label="Coffee" extension="alt='Tooltip of the series'">
<Point extension="alt='Tooltip of the point'">
<Value type="y">94</Value>
</Point>
<Point>
<Value type="y">10</Value>
</Point>
</Series>
<Series>
<Point>
<Value type="y">20</Value>
</Point>
</Series>
Here the first point displays 'Tooltip of the point', the second one 'Tooltip of the series', and the first one of the second series displays 'Series: 2 / Point: 1 / Value: 20.000'.
@Jonathan: the href sapevent thing is used for firing events from the control to ABAP. Using this feature you can implement an event handler as in graphics_gui_ce_demo on_click (also check create_custom_demo and look for href).
Regards, Kai -
Problem about lightbox with tooltips
I create a slideshow. There is lightbox on a slideshow. I want to create 6 tooltips in the lightbox but other slideshow will show tooltips after I drag tooltips on the lightbox. I want to show 6 tooltips which are only in one slideshow. How to do it? Thank You very much!!!!!
I create a slideshow. There is lightbox on a slideshow. I want to create 6 tooltips in the lightbox but other slideshow will show tooltips after I drag tooltips on the lightbox. I want to show 6 tooltips which are only in one slideshow. How to do it? Thank You very much!!!!!
-
Applying tooltip styles from defaults.css file problem
in flex library, create custom tooltip extend ToolTip
CustomToolTip code:
public class CustomToolTip extends ToolTip
then i want use custom skin like ToolTipBorderSkin, so i add into defaults.css
defaults.css code:
CustomToolTip
borderSkin: ClassReference("my.skins.ToolTipBorderSkin");
build it into swc file, then in my application use
when i set textinput tips, it doesn't use the new skin
if write this line in the application, it works fine.
import my.controls.CustomToolTip; CustomToolTip
i don't know why.
Thanks for any help.Thank you for your reply, alex.
i have assign the tooltip as the tooltipClass
CustomToolTipManagerImpl.as the code like this;
public class CustomToolTipManagerImpl extends ToolTipManagerImpl
public function CustomToolTipManagerImpl ()
super();
toolTipClass = CustomToolTip;
and custome define the application preloader
public class PreloaderBar extends DownloadProgressBar
public function PreloaderBar()
super();
registerClasses();
protected function registerClasses():void
Singleton.registerClass("mx.managers::IToolTipManager2", CustomToolTipManagerImpl);
the application add this line:
preloader="my.preloaders.PreloaderBar"
i build this in flex library, and define the CustomeToolTip borderSkin in defaults.css
if i set borderSkin in actionscript, it is ok, but if i set in defaults.css, it doesn't work
setStyle("borderSkin", ToolTipBorderSkin); -
How create grouped column in DataGrid ?
Hi all,
I can create grouped column in AdvancedDataGrid. So in DataGrid, how I create grouped column ?
Thanks.I have a problem that no anyone can help me to now. Sometime, I think that it's bug of ADG.
My goal same as from http://blogs.adobe.com/aharui/BlinkWhenChanged/dg.swf . But if I use ADG and with a scroll ! And when scroll up or down background color change not right.
It's a big problem ! Yep, when I use ADG, I can create group columns but ADG, I can't !
Is there any ways for me? -
i’m creating a toolTip on a movieclip. so far i got the
text to load on the toolTip. i need some help on adding an image to
the right of the toolTip. what should I do ...i'm thinking that an (img src="sampleimage.jpg" ) might work
but how do i change the tags so images are allowed .... anybody got
some ideas.
Maybe you are looking for
-
New to bt vision. need a question answered!
I always turn appliances such as tv. stereos etc off by mains as have a phobia of overheating. fires etc. but i would like to know with the new black bt vision box i got i see in book it says purple for standby and red for low mode. but when i turned
-
Error Message "No logical port exists to call web services" installing SM7
I am trying to use SLM to download a service stack. However, the option is not available in step 2.5. There is an error message "No logical port exists to call web services". I have performed the Wizard install, but the Wizard seems to have left o
-
Illustrator won't open clipboard
When I open illustrator and click new file it brings me to the new file prompt and after selecting ok, nothing opens? When I try to open a file it says it's open I just can't see see the clipboard. How can I resolve this?
-
Oracle 9i reports body/margin
I am creating a report the fills the whole 8 1/2 x 11 paper. Oracle 9i reports defaults a 1" margin all around the report. Is there a way to modify this margin?
-
In 555 lamp dimmer circuit, lamp is not seen glowing?? wht should be done? Is there any mistake in the circuit? Solved! Go to Solution. Attachments: lamp dimmer.ms11 119 KB lamp2.ms11 442 KB