Login Register

deleting circles in dojo draggable circle demo

[edit -- support questions believe it or not, go in the Support forums]

I want to delete the circle in dojo draggable circle demo one by one .But as these circle do not have any Id .I am unable to delete it. And trying delete aShape give error that object does not support the following method.

Pls help

surface.remove

Hi there,

I think what you're looking for is Surface.remove, which takes a reference to the shape (so for instance, one of the elements in gShapes in the circles demo) and removes it from the surface. In that particular example, you'll probably want to remove it from gShapes as well.

But I'm a Dojo noob, take that with a grain of salt.

Hope this helps,
--
T.J. Crowder
tj at crowdersoftware dot com

works fine

Hi T.j,
Thanks for valuable information.I used surface.remove and its work .I have to cancell all the event associated to this marker its work fine for that also.
...
Anurag Srivastava

no, that's correct for the most part.

[surface].remove or [group].remove both take a shape object as an argument; this is what you want to use when removing a shape. In that case, I believe you'd use gShapes.remove(circle).

Hi ,

Hi ttrenka,
Thanks for ur input. i have tried this option also.I am unable to understand what argument shound be passed in the gShapes.remove(?).What should be done so that the event associated with the circle will be cancelled in IE.dojo.event.disconnect or event.connect(.........,stopbrowser) doesnt work in this context.

Anurag Srivastava

gShapes is just an object

Heya,

I think ttrenka was thinking that -- given its name -- gShapes was a dojox.gfx.Group instance, but in circles.html it's just a generic object ("var gShapes = {}") being used as a kind of associative array by storing each shape by its ID ("gShapes[id] = aShape;"). If gShapes were a GFX Group instance, you'd use the remove method, but since it isn't you probably just set gShapes[id] to null.

Hope this helps,
--
T.J. Crowder
tj at crowdersoftware dot com

zIndex for circles

Hi,
Its working fine.But will you please specify me whether we can set zIndex for circles.If i am using aShape.style.zIndex it give an error.either zIndex can be set at run time or only when we are creating circles.

Thanks,
Anurag Srivastava

That one I don't know

Sorry. :-) Presumably you can, though. (I'll be watching for the answer.) You'll may want to post a different thread with that question, since it's off-topic for this thread.
--
T.J. Crowder
tj at crowdersoftware dot com

z Index is determined by the order of shapes in on the surface.

...unlike with HTML, with any of the vector graphics languages the rendering order is determined by the order of the shape in on the surface. In other words, if you want to bring something to the top of a stack, you have to remove it from the parent and place it on the end of the children.

IIRC there are methods already in dojox.gfx to do this but I don't remember what they are off the top of my head.

All shapes implement

All shapes implement moveToFront() and moveToBack() methods, which are used for reordering.

hi eugene,

Thanks for ur valuable information.but movetoFront() or movetoBack().does'nt allowed to set Zindex.Actually if you want to bypass event from gshape to the container.you have to set zIndex for that.

Thanks,
Anurag

Hi ttrenka,

I think for the dom node relation its easy to set Zindex,but in this example these circle are not the children of the container.thats why I am unable to set z index.Object aShape does not support Zindex property or method to set zindex .if you have any other view regarding the setting zIndex for dojo.gfx shapes.please let me know.looking forward for your answer.

Thanks,
Anurag

Which part of the answers didn't you see?

There is no z-index with vector graphics; where a shape lies on the z plane is dependant on the order of the shape within the document.

As Eugene said, you use the shape's moveToFront() and moveToBack() methods. This means on the circle itself:

myCircle.moveToFront();

...no z-index required.

Removing from a dictionary

Removing from a dictionary is simple:
delete gShapes[id];

hi

.......using surface.remove(shape),remove the current shape only if we apply for previous shape ,we can not remove it from the surface ,Can you please help me for removing previous shapes.
Thanks
Anurag Srivastava

hi

[ADMIN: Content was deleted. These are forums for discussing and working with the Dojo Toolkit; random links to SOA sites are not an acceptable use of the forums.]