Whenever you create a GUI that contains elements in a tabular arrangement its pretty cumbersome that wxFormBuilder creates an individual pointer for each element, it would be much easier to access the elements if they would be put in an array. This patch adds this functionality for the C++ code generator, the change is fully transparent, there is no need to update any generator templates or plugins. This is only added for the C++ generator because i only know this language well enough, i'm not sure if it can be ported to the other generators.
How to use it:
Simply add an array subscript to the element name, e.g. m_item, m_item, thats all. This will create a static array of the size 2 with the name m_item. It is not necessary for the subscripts to be contigous, holes are allowed.
How its implemented:
For each class element a preprocessing step was added to the code generator. It scans through all child elements and records all array names together with the highest found index. When the code generator creates the element declarations it checks every element name against the found arrays, if it finds a match it checks if a declaration for this array was already done. If not i use the fact that to declare a static array in c++ you simply have to add a subscript with the size behind the name. Temporarily the name of the object gets changed to the name of the array with the size of the array as subscript, the code generator template gets executed and then the object name gets restored and the array gets marked as declared. Because the array is static there is no extra construction step necessary, default construction is sufficient enough. Due to this way its not necessary to update any code generator templates, but i dont know if this can be done for the other generator languages so easy as well.