Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Text Boxes

Status
Not open for further replies.

klaforce

Programmer
Mar 25, 2005
124
US
Hi, what I am trying to due is pull data from a database (got that working) and trying to display the data. I do no know how many records I will have so I need to do a for loop and create text boxes. So my test is as follows:

//create some formatting for our text box
myTextFormat = new TextFormat();
myTextFormat.font = "Verdana";
myTextFormat.size = 14;
myTextFormat.color=0x000000;//black

_root.xVal = 154;
_root.yVal = 216;

//create the items on page
for(_root.i = 0; _root.i < newrecordset.mRecordsAvailable; _root.i++)
{
//create a blank text box and set its parameters
_root.qualVal = "Quality" + _root.i;
_root.createTextField(_root.qualVal,20,_root.xVal,_root.yVal,108.4, 19.2);
_root.qualVal.background=true;
_root.qualVal.border=true;
_root.qualVal.backgroundColor=0xFFFFFF;//white
_root.qualVal.borderColor=0x000000;//black
_root.qualVal.text = "Test" + _root.i;

_root.qualVal.setNewTextFormat(myTextFormat);

_root.xVal += 109;
}

However, nothing shows up. I know it has to do with the name passed to createTextBox because if I just put "Quality" in instead of _root.qualVal it works (but then overwrites itself because it is in a loop, thus the need for a name with i involved.) Any help given will be appreciated.


Keith


The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
 
Nevermind, I got it figured out. For those of you searching you need to do this[_root.qualVal].background in order to access the correct properties.


Keith


The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top