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

accessing labels like 2d array items

Status
Not open for further replies.

ashstampede

Programmer
Aug 30, 2004
104
0
0
GB
I am building a visual guild to path finding, i am trying to use MS visual c++ so i have a bunch of label on my form and i will read in a txt file that will be a ascii art type map.

like so

xxxxxxxxxx
x00000000x
x00000000x
x00000000x
xxxxxxxxxx

so in my program i read the file assign the characters to a 2d array. I would then like to access the labels on the form and change there background image to a bmp image. based on what the current charcter is.

the labels have names lbl0_0 lbl0_1 and so forth to represent a grid system of co-ordinates with a x and y axis.

so how can i access abunch of labels to change there background image when i am A. building my map and B. when i am moving to show the path?

basically i will have a variable of x and y then i would want the name of the label lblx_y but my x and y will be int's. see i am highly confused.
 
Have you considered modelling your UI based on that of say an icon editor?

Which on the face of it would be much easier to populate from your ASCII data, and would give you x/y coordinates back when you clicked on it.



--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
ok, i didnt see icon editor in the toolbox? how do i use a icon editor?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top