Base class initialising


#1

I’m having a bit of a gripe with the jucer at the moment. it’s only subtle, but quite important:

It allows you to specify base classes for your components, but it does not provide any means to pass constructor parameters on to them.

I have a base class, which takes a particular data type. The base class is for an editor, which i was hoping to be able to design in the Jucer (different types of source data use different editors). But if i make them in the jucer, the only way i can use them is to patch up the code in a way that is not stored when the file is edited.

I’ve considered that i can just use the Jucer to make plain Components which the editor class can display, but then there would have to be workarounds to make it easy for the data to be accessed…

i expect it’s probably a bit of a pig to add such a feature tho!


#2

There’s a “constructor params” field on the class settings page… or am I misunderstanding your question??


#3

yeah, imagine this:

class Dog : public Animal
{
public:

Dog (int legs, bool barks)
: Animal (legs)
{
}

};

the constructor parameter lets me specify barks and legs for dog, but doesn’t let me pass legs onto the animals constructor in the initialiser list


#4

Ok, I see. Yes, that’s a bit of a tricky one to do, but I’ll put it on my to-do list…


#5