Select to view content in your preferred language

Show InfoWindow programmatically

1264
5
04-08-2011 10:48 PM
PrashanthSukumaran
Emerging Contributor
Hi,

The code below to show an infowindow programmatically doesn't seem to work.

        graphic.dispatchEvent(new MouseEvent(MouseEvent.CLICK));


How do i accomplish this? Has anybody done anything like this?
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Prashanth,

   What event is associated with the graphics click?
0 Kudos
PrashanthSukumaran
Emerging Contributor
Robert,

Since Graphic extends the UIComponent i guess it is the Mouse Click.  The only event registered with Graphic is "change" i don't see anything else.

1) I have a store graphic and i have attached a InfoWindow to the graphic. 
2) A drivetime is drawn around this graphic. 
3) On clicking the drivetime graphic i want to show the infowindow associated with the store graphic.


EDIT:   map.infoWindow.show(graphic.geometry as MapPoint);  does it.  I don't have to fire any event to do this.
0 Kudos
PrashanthSukumaran
Emerging Contributor
Robert,

Showing the infowindow using the map.infoWindow.show is working as desired.  I also have another requirement of changing the state of the infowindowrenderer.  The infowindowrenderer implements the IGraphicRenderer so everytime i click the graphic the set graphic(..) method is called.

InfoWindowRenderer with States based on the graphic attributes

When i click the graphic everything works fine as odoe suggested.  But when i call programatically show the  map.infoWindow.show(...) the set graphic method is not getting called and so my Infowindowrenderer state is not changing.  I guess i have to do this part differently.

Any ideas?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Prashanth,

   I don't have any suggestions as you are into an area I have not done anything with yet. Good luck.
0 Kudos
PrashanthSukumaran
Emerging Contributor
Robert,

I should be able to fire the event similar to what the user does by clicking the graphic.  I am clue less why the Click event is not working.  I will probably contact the esri customer support.

Thank you very much for replying.

Regards
Prashanth Sukumaran
0 Kudos