Hello,
I'm using Delphi 7. I have a form with over one hundred checkboxes layed out on a diagram of seats in an auditorium. A check means the seat is taken, unchecked means it is open. The checkbox components are named by the seat name, A1, A2...A34,B1,B2,...B36,C1...etc so form1.a1.checked:=true means seat A1 is taken.
I need to read all of the checkbox components and tell if they are checked and I need to modify a component's "checked" property. How do I do this without writing a line of code for every component? (I'll have 900 seats total!) I do have an array with every seat name in it.
My ideas: (that I cannot get to work!)
1. Put all of the checkbox components into an array so I can loop through the array and search or modify the "checked" property.
2. Refer to the component by a variable name. Since I have all seat names in an array, can I somehow refer to
form.A2.checked (but replace the A2 with a variable with a value of 'A2'?)
3. Use pointers. I found the componentcount and componentsindex and components[x].name properties. I can loop from 0 to componentcount and display every component name (seat name) but I cannot figure out how to change the "checked" property of say form1.components[3].componentname
I'm fairly certain this can be done, I just need a little help!
Thanks in advance.
Matt
I'm using Delphi 7. I have a form with over one hundred checkboxes layed out on a diagram of seats in an auditorium. A check means the seat is taken, unchecked means it is open. The checkbox components are named by the seat name, A1, A2...A34,B1,B2,...B36,C1...etc so form1.a1.checked:=true means seat A1 is taken.
I need to read all of the checkbox components and tell if they are checked and I need to modify a component's "checked" property. How do I do this without writing a line of code for every component? (I'll have 900 seats total!) I do have an array with every seat name in it.
My ideas: (that I cannot get to work!)
1. Put all of the checkbox components into an array so I can loop through the array and search or modify the "checked" property.
2. Refer to the component by a variable name. Since I have all seat names in an array, can I somehow refer to
form.A2.checked (but replace the A2 with a variable with a value of 'A2'?)
3. Use pointers. I found the componentcount and componentsindex and components[x].name properties. I can loop from 0 to componentcount and display every component name (seat name) but I cannot figure out how to change the "checked" property of say form1.components[3].componentname
I'm fairly certain this can be done, I just need a little help!
Thanks in advance.
Matt