*doh* I've made a nice GUI, but


OK thanks for bearing with me, I’m new to JUCE but got a little bit of Java under my belt… so the c++ is coming along (similar to Java :roll: ) and to be honest JUCE is the canine’s gonads for making GUI apps IMHO. I’ve got a nice little GUI going, based on Haydxn’s tutorial, but with 5 child components (all different boxes containing menus or groups of icons) added on top of his MainComponent box. It looks quite good, all my image buttons work OK and I’ve got the knack of positioning the components so they are all referencing OK if screen is resized etc. I’m working on a drag-and-drop thing now, and I’ve got a component box with, say, 8 objects (child component objects if necessary) These 8 objects are going to be drag and drop icons, ie, ImageButtons. I’ve started off with just one imagebutton, positioned correctly inside it’s box component, and I want to “iterate” the instantiation of these icon components by looking at a bunch of files (so, for 8 files in ./foo/ my parent component will have 8 imageButtons - little square .png files - and these will be instantiated one-by-one in a loop inside their parent component box, with 4-to-a-line. I think I’ve got my mind round this, my Q. is basically I think I’m going to have to make some kind of UML diagram to make sure I get my app Objectified the right way-

Reason I mention this is that I remember in java there was a thing called an array iterator (?) which we used in Java with UML diagrams when dealing with multiple instantiations of classes. (for instance a bank account prog. with one-to-many relationship in the structure of a customer object and an account object etc.). This would be what I want for my file icon drag and drop boxes I should imagine? I’m pretty sure JUCE will be able to do this kind of thing easily, like java did? Sorry if I’m vague, I need to brush up on my O.O.Programming! Thanks chaps - I had a quick look at JUCE iterator class but nothing seemed to jump out - I’ve got a feeling the JUCE array class / functions will be what I need to look at? Will ramble on at you lot once I get it going (just for reference’s sake) :? .


Hard to tell exactly what it is that you’re looking for… Maybe just an OwnedArray or an Array<Component*> …?


prob just a JUCE Array, methinks, I’ll post some code if I get in any difficulty, once I’ve got it going !

It’s all about this… http://www.oodesign.com/iterator-pattern.html

"Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

The abstraction provided by the iterator pattern allows you to modify the collection implementation without making any changes outside of collection. It enables you to create a general purpose GUI component that will be able to iterate through any collection of the application."

I’m pretty sure JUCE libs can be implemented like this -Abstraction!