
Quote from Punglisin on February 10, 2020, 12:47 amHi,
is it possible to use the DuplicateObject command recursively? That is, you add an object to a parent container and then create another object within the child that was created..
Thank you
Hi,
is it possible to use the DuplicateObject command recursively? That is, you add an object to a parent container and then create another object within the child that was created..
Thank you

Quote from luishp on February 10, 2020, 2:36 pm@punglishin I'm not sure about what you want to achieve, but wouldn't be easier if you duplicate the object as many times as needed and then move it to the desired Container using MoveObjectIntoContainer?
@punglishin I'm not sure about what you want to achieve, but wouldn't be easier if you duplicate the object as many times as needed and then move it to the desired Container using MoveObjectIntoContainer?

Quote from Punglisin on February 10, 2020, 3:27 pm@luishp, I want to insert an object (in this case a container) into another container other than the parent container: in fact this container is one of the objects (containers) added to the parent container.
I noticed that with the duplicateObject the id of the new object that is added is always the id of the initial object, and the name of the new object is associated with the variable VisualNEOWebName.
@luishp, I want to insert an object (in this case a container) into another container other than the parent container: in fact this container is one of the objects (containers) added to the parent container.
I noticed that with the duplicateObject the id of the new object that is added is always the id of the initial object, and the name of the new object is associated with the variable VisualNEOWebName.

Quote from luishp on February 10, 2020, 9:46 pmI want to insert an object (in this case a container) into another container other than the parent container: in fact this container is one of the objects (containers) added to the parent container.
Sorry, I'm lost.
I noticed that with the duplicateObject the id of the new object that is added is always the id of the initial object, and the name of the new object is associated with the variable VisualNEOWebName.
Yes, I did not find any way to update the id of the cloned object so using a customized property was the best solution I found.
That could be a limitation for certain applications so not sure if what you want to accomplish is possible or not. Anyway, you can allways try using plain JavaScript or JQuery.
I want to insert an object (in this case a container) into another container other than the parent container: in fact this container is one of the objects (containers) added to the parent container.
Sorry, I'm lost.
I noticed that with the duplicateObject the id of the new object that is added is always the id of the initial object, and the name of the new object is associated with the variable VisualNEOWebName.
Yes, I did not find any way to update the id of the cloned object so using a customized property was the best solution I found.
That could be a limitation for certain applications so not sure if what you want to accomplish is possible or not. Anyway, you can allways try using plain JavaScript or JQuery.

Quote from Punglisin on February 10, 2020, 10:38 pmSorry, I'm lost.
aahahaha
sorry Luis I said it badly. I just wanted to say this:
For example: DuplicateObject "initContainer" "g1" "parentContainer" DuplicateObject "initContainer" "g2" "g1" DuplicateObject "initContainer" "g3" "g1" DuplicateObject "initContainer" "g4" "g1" DuplicateObject "initContainer" "g5" "g2" DuplicateObject "initContainer" "g6" "g3" DuplicateObject "initContainer" "g7" "g4"...and so on
If I change the id of one of the objects via Javascript it disappears from "parentContainer".
Sorry, I'm lost.
aahahaha
sorry Luis I said it badly. I just wanted to say this:
For example: DuplicateObject "initContainer" "g1" "parentContainer" DuplicateObject "initContainer" "g2" "g1" DuplicateObject "initContainer" "g3" "g1" DuplicateObject "initContainer" "g4" "g1" DuplicateObject "initContainer" "g5" "g2" DuplicateObject "initContainer" "g6" "g3" DuplicateObject "initContainer" "g7" "g4"
...and so on
If I change the id of one of the objects via Javascript it disappears from "parentContainer".

Quote from luishp on February 11, 2020, 11:13 am@punglisin can you attach an example app showing the problem?
Thank you!
@punglisin can you attach an example app showing the problem?
Thank you!

Quote from Punglisin on February 11, 2020, 3:35 pm@luishp of course! I sent it in the attachment! Thank you!
@luishp of course! I sent it in the attachment! Thank you! 

Quote from luishp on February 11, 2020, 6:30 pm@punglisin I have discovered how to modify the cloned object ID. I will fix it in the next version.
Meanwhile use this in your first button, then the second one should work:
DuplicateObject "group" "g0" "parentContainer" BeginJS //This line modifies the id of the newly created object. $('[visualneowebname="g0"]').attr("id","g0"); EndJS GetObjectHTML "parentContainer" [html] EnableObject "PushButton3"Regards.
@punglisin I have discovered how to modify the cloned object ID. I will fix it in the next version.
Meanwhile use this in your first button, then the second one should work:
DuplicateObject "group" "g0" "parentContainer"
BeginJS
//This line modifies the id of the newly created object.
$('[visualneowebname="g0"]').attr("id","g0");
EndJS
GetObjectHTML "parentContainer" [html]
EnableObject "PushButton3"
Regards.

Quote from Punglisin on February 11, 2020, 8:34 pm@luishp The change to the id now works correctly! :-) In fact, now the container "g1" is the child of the container "g0". However, as a side effect, changing the id from "group" to "g0" implies that the object is no longer visible within the parentContainer. To test it, just press the first button: you cannot see the cloned object. Only with the click on the second button you can see the cloned object which is the child of the first.
@luishp The change to the id now works correctly! :-) In fact, now the container "g1" is the child of the container "g0". However, as a side effect, changing the id from "group" to "g0" implies that the object is no longer visible within the parentContainer. To test it, just press the first button: you cannot see the cloned object. Only with the click on the second button you can see the cloned object which is the child of the first.

Quote from luishp on February 11, 2020, 9:19 pm@punglisin you are right. I think it's better to left it as it was, even with the known limitations.
I'm not sure why changing the "id" makes the cloned objects not visible at all. I will need to do some research.
@punglisin you are right. I think it's better to left it as it was, even with the known limitations.
I'm not sure why changing the "id" makes the cloned objects not visible at all. I will need to do some research.

Quote from Punglisin on February 12, 2020, 12:14 am@luishp OK! I also found another solution: change the "id" of the container and then apply a series of CSS styles so that the cloned object becomes the same as the initial object. I also applied the click attribute; in this case I added the JS command to call a subroutine and then the command to stop the propagation of the click event, otherwise the event is propagated and the associated method is called from the parent container to the one that was actually clicked. The VisualNeoWeb OnMouseEvent command propagates the event in the case of nested elements.
Example:
DuplicateObject "group" "g[num]" "[gselected]" CreateEmptyObject [csspanel] SetVar [csssubpanel("background-color")] "white" SetVar [csssubpanel("border")] "solid 3px black" SetVar [csssubpanel("border-radius")] "15px" SetVar [csssubpanel("position")] "absolute" SetVar [csssubpanel("top")] "5px" SetVar [csssubpanel("left")] "5px" SetVar [csssubpanel("width")] "24px" SetVar [csssubpanel("height")] "34px" BeginJS //This line modifies the id of the newly created object. $('[visualneowebname="g'+$App.num+'"]').attr("id","g"+$App.num); //click event attr EndJS SetObjectcss "g[num]" [csspanel]In the help page 'CallingactionsfromJavaScript' I suggest the change from "neoscript" to "neosubroutine" in the example at the end of the page because to call a subroutine you need to call "neosubroutine.subroutinename.."
@luishp OK! I also found another solution: change the "id" of the container and then apply a series of CSS styles so that the cloned object becomes the same as the initial object. I also applied the click attribute; in this case I added the JS command to call a subroutine and then the command to stop the propagation of the click event, otherwise the event is propagated and the associated method is called from the parent container to the one that was actually clicked. The VisualNeoWeb OnMouseEvent command propagates the event in the case of nested elements.
Example:
DuplicateObject "group" "g[num]" "[gselected]"
CreateEmptyObject [csspanel]
SetVar [csssubpanel("background-color")] "white"
SetVar [csssubpanel("border")] "solid 3px black"
SetVar [csssubpanel("border-radius")] "15px"
SetVar [csssubpanel("position")] "absolute"
SetVar [csssubpanel("top")] "5px"
SetVar [csssubpanel("left")] "5px"
SetVar [csssubpanel("width")] "24px"
SetVar [csssubpanel("height")] "34px"
BeginJS
//This line modifies the id of the newly created object.
$('[visualneowebname="g'+$App.num+'"]').attr("id","g"+$App.num);
//click event attr
EndJS
SetObjectcss "g[num]" [csspanel]
In the help page 'CallingactionsfromJavaScript' I suggest the change from "neoscript" to "neosubroutine" in the example at the end of the page because to call a subroutine you need to call "neosubroutine.subroutinename.."