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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of StatText

Status
Not open for further replies.

GiampiZ

Programmer
Joined
Aug 6, 2008
Messages
1
Location
IT
Hi all, this is my first thread.
Is it possible to have an array of visual object on a window?
For instance an array of StaticText:

StaticText st_cod[10]
FOR li_i = 1 TO 10
st_cod[li_i].x = 200 * li_i
st_cod[li_i].y = 200
st_cod[li_i].height = 64
st_cod[li_i].width = 180
st_cod[li_i].BackColor = 255 //just to see it
NEXT

that code does not work!
Even better would be a dynamic size array:

StaticText st_cod[]
FOR li_i = 1 TO n
st_cod[li_i].x = 200 * li_i
st_cod[li_i].y = 200
st_cod[li_i].height = 64
st_cod[li_i].width = 180
st_cod[li_i].BackColor = 255 //just to see it
NEXT

Thank you in advance for your kind replay.
Giampiero (from Italy)
 
I'm guessing you're getting a NULL object reference error???

You have to instantiate each object using the CREATE command.

Long ll_cnt
StaticText st_cod[]

FOR ll_cnt = 1 TO 12
//create object & set its properties
st_cod[ ll_cnt ] = CREATE StaticText
st_cod[ ll_cnt ].Width = 180
st_cod[ ll_cnt ].Height = 60

//to open the object:
w_parent.OpenUserObject( st_cod[ ll_cnt ], 200 * ll_cnt, 200 )
NEXT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top