XWidgetSoft Forum
https://www.bbs.xwidget.com/

getObject by id (tag)
https://www.bbs.xwidget.com/viewtopic.php?f=10&t=2084
Page 1 of 1

Author:  Shezoid [ September 5th, 2012, 7:47 am ]
Post subject:  getObject by id (tag)

Need a help :)
Please, explain how to get Object by tag number, then set param for this object... or get by children number from widget...
Is't possible? or I must use switch - case and set dynamic number to the object name?

Author:  qiancang [ September 6th, 2012, 12:04 am ]
Post subject:  Re: getObject by id (tag)

sorry for my poor English , i can't understand the question, do you want
Code:
var a = image1.tag
image1.tag=2

Author:  Shezoid [ September 6th, 2012, 2:59 am ]
Post subject:  Re: getObject by id (tag)

I want to get Image with specific tag, and set Src for this image.
for example: Image.attr(tag=i).Src = Value; Or widget.children[i].Src = Value;
or can I push all object's children to the array? I think not..

I found this solution is working for me:
Code:
switch(i)
     {
      case 1: image1.Src = images[i].ico+'.png'; break;
      case 2: image2.Src = images[i].ico+'.png'; break;
      case 3: image3.Src = images[i].ico+'.png'; break;
      case 4: image4.Src = images[i].ico+'.png'; break;
      case 5: image5.Src = images[i].ico+'.png'; break;
     }

Author:  qiancang [ September 6th, 2012, 5:00 am ]
Post subject:  Re: getObject by id (tag)

Shezoid wrote:
I want to get Image with specific tag, and set Src for this image.
for example: Image.attr(tag=i).Src = Value; Or widget.children[i].Src = Value;
or can I push all object's children to the array? I think not..

I found this solution is working for me:
Code:
switch(i)
     {
      case 1: image1.Src = images[i].ico+'.png'; break;
      case 2: image2.Src = images[i].ico+'.png'; break;
      case 3: image3.Src = images[i].ico+'.png'; break;
      case 4: image4.Src = images[i].ico+'.png'; break;
      case 5: image5.Src = images[i].ico+'.png'; break;
     }


maybe it will help
Code:
eval("image"+i).Src= images[i].ico+'.png';

Author:  Shezoid [ September 6th, 2012, 5:38 am ]
Post subject:  Re: getObject by id (tag)

Very helpful, thank you :)

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/