Need help with ComboBox

gui

#1

Hello! I need some help with ComboBox. I just followed the JUCE guide about this. So I added next lines into MainComponent.h :
public ComboBox::Listener
ComboBox Combo;
After in MainComponent.cpp I added this code :
addAndMakeVisible(Combo);
Combo.setTopLeftPosition(0,100);
Combo.setSize(100, 30);
Combo.setSize (600, 400);
But when I am trying to compile this it gives me a mistake in Main.cpp. It underlines me this line : setContentOwned (new MainComponent(), true);
And returns me this mistake:
Comb4
Thanks for Help!


#2

edit : it wasn’t actually that clear what is going on in the code. Please post more of the code.


#3

Hi, you need to override the Listener method:

    virtual void comboBoxChanged (ComboBox* comboBoxThatHasChanged) = 0;

#4

@leehu Sorry but where do I have to write it?


#5

You need to put the delcaration in your head file and then the implementation in your .cpp file. FYI, this is not specific to JUCE per se, and if you’re struggling with C++ concepts such as overrides in classes I’d suggest you do some reading as I think you’re going to run into more problems. Cheers


#6

Uhh, Thanks)