destroy a graphic

Develop and Deploy Cross-Browser Web Apps .

destroy a graphic

Postby kevinotton » Fri Jan 09, 2015 4:16 pm

I am trying to remove a graphic using a variable to define it.

Building a graphic with

_ctl_htmlbutton2_onclick:function (profile, e, value){
var ns = this, uictrl = profile.boxing();
kevin = "ctl_circle"+"01";
ns.ctl_svgpaper1.append((new xui.svg.circle())
.setHost(ns,kevin )
.setSvgTag("Shapes:Circle")
.setAttr({"KEY":{"cx":"110", "cy":"120", "r":10, "stroke-width":"1", "stroke":"#00ff00", "fill":"#ff00ff", "title":"my title" }})
.onClick("_connector_onclick")
);
},

how can I get the object id to destroy it using a variable along the lines below

_connector_onclick:function(profile){
ns=this; uictrl = profile.boxing();
console.log("profile.alias = "+profile.alias);
kevin = ????? // So i can play with the choice
ns.kevin.destroy();
},

Many thanks
Kevin
kevinotton
 
Posts: 39
Joined: Thu May 15, 2014 8:18 am
Location: Needham Market, Suffolk, UK

Re: destroy a graphic

Postby support » Sat Jan 10, 2015 3:10 am

   
Class('App', 'xui.Com',{
Instance:{
iniComponents : function(){
// [[Code created by CrossUI RAD Studio
var host=this, children=[], append=function(child){children.push(child.get(0));};

append(
(new xui.UI.SVGPaper())
.setHost(host,"ctl_svgpaper1")
.setLeft(20)
.setTop(10)
);

append(
(new xui.UI.HTMLButton())
.setHost(host,"ctl_htmlbutton1")
.setLeft(120)
.setTop(320)
.setWidth(160)
.setHeight(22)
.setHtml("Create a circle")
.onClick("_ctl_htmlbutton1_onclick")
);

return children;
// ]]Code created by CrossUI RAD Studio
},
_ctl_htmlbutton1_onclick:function (profile, e, value){
var ns = this, uictrl = profile.boxing();
var kevin = "ctl_circle"+"01";
ns.ctl_svgpaper1.append((new xui.svg.circle())
.setHost(ns,kevin )
.setSvgTag("Shapes:Circle")
.setAttr({"KEY":{"cx":"110", "cy":"120", "r":10, "stroke-width":"1", "stroke":"#00ff00", "fill":"#ff00ff", "title":"my title" }})
.onClick("_connector_onclick")
);
},
_connector_onclick:function(profile){
var ns=this, uictrl = profile.boxing();
var kevin = "ctl_circle"+"01";
ns[kevin].destroy();

// or
// uictrl.destroy();
}
}
});
   
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am


Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron