Hi Frédéric,
I use the fireRequestToolTip method in Layer to set the tool tip. Assuming that you can get a mouse event (the "e" below) to figure out which
OMGraphic the pointer is over then you can do something like this:
OMGraphic g = gList.getOMGraphicAt(selectedOMG); //
Get the graphic
FeaturePlotPoint fpp = (FeaturePlotPoint)g.getAppObject(); //
Get the FeaturePlotPoint
SegmentFeature f = fpp.getSegmentFeature(); //
Get the feature
StringBuffer sb = new StringBuffer("<html>" + //
Start off the HTML tool tip
"<b><u>" + f.getFeatureType() + "</u></b>" + // Feature type
"<small>"); // Then go into small text
String[] stuff = f.getFieldsAndData(); //
Get field names and data
for (int i = 0; i < stuff.length;) //
For each one
sb.append("<br><b>" + stuff[i++] + ": </b>" + stuff[i++]); // Make
into a line of HTML
sb.append("</small></html>"); // Wind it up
fireRequestToolTip(e, sb.toString()); // Set as the tool tip
My OMGraphics use the AppObject to hold a reference to the object the
OMGraphic was made from. I go back to that object and build a tool tip in HTML and set it. This seems to set the tool tip for the whole layer so
when there is no OMGraphic under the mouse pointer you need to:
fireHideToolTip(e); // Hide tool tips
to turn them off. I have also found that if you set the tool tip in one
layer and have a code path that allows you to switch layers without
turning the tip off then you can get the tool tip for the other layer
appearing. I have code that makes sure that the tool tip is cleared by
using the initToolTip() method of the InformationDelegator.
I hope that helps. If you need more information then drop me a line.
all the best,
Adrian
_____________________________________________
Dr. Adrian Lumsden
Product Specialist
Scientific Software and Systems Limited
Tel: +64 4 917-6680 (direct)
+64 4 917-6670 (reception)
Fax: +64 4 917-6671
E-mail: Adrian.Lumsden@blackhole4spam.sss.co.nz
Visit us on the Web at: http://www.sss.co.nz
_____________________________________________
This e-mail passed SSS's content security scan.
It is covered by the confidentiality clauses at
http://www.sss.co.nz/content_and_confidentiality
Frédéric Trifiro <job@trifiro.net>
Sent by: owner-openmap-users@bbn.com
03/06/04 02:35
To: openmap-users@bbn.com
cc:
Subject: [OpenMap Users] ToolTip for OMGraphic
Hi everyone,
I want to add a tooltip when the mouse comes over an OMGraphic. I saw that the
mechanism was used in the DemoLayer but i don't really understand how it
works.
I saw the method getToolTipFor() but i can't see where, when and how it is
called :p !
Thanks, Fred
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Wed Jun 2 19:39:19 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT