Select to view content in your preferred language

MouseDown on GraphicsLayer with custom Renderer

867
8
11-01-2010 01:16 PM
DavidElies
Deactivated User
When I listen for MouseDown events on a GraphicsLayer, I usually get a Graphic as the target, but when I use a UniqueValueRenderer I get a CustomSprite.  I am using Picture Marker Symbols to display point data.  Does anybody know how to get the graphic from a MouseDown on a GraphicsLayer using a UniqueValueRenderer?

Thanks!
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
David,

  It actually has more to do with the PictureMarkerSymbol than the UniqueValueRenderer.

The way to avoid this is to set mouseChildren = "false".
0 Kudos
DavidElies
Deactivated User
David,

  It actually has more to do with the PictureMarkerSymbol than the UniqueValueRenderer.

The way to avoid this is to set mouseChildren = "false".


Thanks for your quick reply!

I was actually looking at the mouseChildren attribute.  Symbols don't seem to have a mouseChildren attribute, and the graphicAdd event never seems to be triggered, so I can't set it for the Graphic.  Do you mean that I should set mouseChildren=false for the GraphicsLayer?

Thanks again!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
David,

   No, if you are not adding your graphics in code then you will just have to climb up the parent  object with your click event so on mouseDown check to see if it is a customSprite and if it is  then do event.currentTarget.parent instead.
0 Kudos
DavidElies
Deactivated User
Thanks so much.  That got me what I was looking for.  I didn't event realize that the parent attribute existed.
0 Kudos
DasaPaddock
Esri Regular Contributor
You could also set mouseChildren to false on the Graphic.
0 Kudos
DavidElies
Deactivated User
You could also set mouseChildren to false on the Graphic.


Thanks for your response.

I was trying to set mouseChildren on the Graphic, but I couldn't get access to it, since the graphicAdd event was never fired.  I don't know why this is.  The GraphicsLayer's dataProvider is a QueryTask, and when the query returns, the graphics get updated, but no graphicAdd events.
0 Kudos
DasaPaddock
Esri Regular Contributor
You can loop through the graphics in the feature set instead.
0 Kudos
DavidElies
Deactivated User
Thanks!  I might try that.
0 Kudos