ComboBox troubles


I’ve created a plugin that uses a few ComboBoxes. It works great in windows xp but on the Mac when I select an item from the list it doesn’t change to that item. I’ve debugged a little bit and found that comboBoxChanged method is called properly…but getSelectedItemIndex() seems to always return -1. My sliders and other buttons all work great.

I’m using Juce 1.46, XCode 3.0, compiling 10.5|i386.

Any hints much appreciated.

Thanks in advance,


There shouldn’t be any difference on the mac - the combo box code doesn’t involve any platform specific code at all… Are you sure you’re not misinterpreting the problem?

I could be…

I just discovered on Mac it doesn’t work in Cubase4 Essential, but it works fine in Bias Peak. In Cubase on the pc it works fine.

If I use setItemIndex, it updates the ComboBoxes gui correctly (in mac cubase). It’s just when I click on it and set it with the mouse it always says the index is -1 when it goes into the comboBoxChanged method…

I’ll keep troubleshooting…

Odd… the only possible difference might be to the ordering of events. Can’t think of anything to try right now, but let me know if you find any more clues.

I’m not sure this has to do with anything but I get about 100 warnings that are similar to this when I compile…

Line Location juce_amalgamated.cpp:257776: warning: ‘GetPort’ is deprecated (declared at /System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/QuickdrawAPI.h:307)

Lots of GetPorts and SetPorts deprecated…is this usual?

Yes, completely normal. Apple are phasing those functions out, but we still need to use them in some cases.


figured this out. (just putting this here for people searching in the future)

On Mac Cubase 4 when one clicks on a combo::box

paint() gets called,
then the comboBoxChanged() gets called,
then paint() gets called again.

On the other systems the first paint() doesn’t get called. That’s what was causing my problem. For some reason cubase on pc this doesn’t happen, only mac.

(I had a line in my paint routine that set the item index of the combo box based on a variable that was changed in comboBoxChanged()…that’s why it seemed like nothing was happening when I clicked the comboBox.)