Confirmed LookAndFeel problem. (SOLVED)


#1

Edit: solved!

Ok, now, if I´m doing something wrong, please, do tell, as this is driving me nuts.

I´m creating my own LookAndFeel, and so far a few things work, but not some. So I tested with the Juce Demo, it works, but not with the Audio Plugin Demo.

Here´s a quick test to see the problem. (unless my compiler is going nuts, but I tested with VC2010 and VC2013 preview) Just open the JuceDemoPlugin from the Extras folder and add the new look and feel stuff below.

Or download here http://wusik.com/temp/JuceProblemAudioPluginDemoSource.zip

//============================================================================== JuceDemoPluginAudioProcessorEditor::JuceDemoPluginAudioProcessorEditor (JuceDemoPluginAudioProcessor* ownerFilter) : AudioProcessorEditor (ownerFilter), midiKeyboard (ownerFilter->keyboardState, MidiKeyboardComponent::horizontalKeyboard), infoLabel (String::empty), gainLabel ("", "Throughput level:"), delayLabel ("", "Delay:"), gainSlider ("gain"), delaySlider ("delay") { newLook = new LookAndFeelEx(); setLookAndFeel(newLook);

class JUCE_API LookAndFeelEx : public LookAndFeel { public: Font getPopupMenuFont() { return Font(2.0f); } };

And now open a popup menu:

[code]void JuceDemoPluginAudioProcessorEditor::sliderValueChanged (Slider* slider)
{
if (slider == &gainSlider)
{
// It’s vital to use setParameterNotifyingHost to change any parameters that are automatable
// by the host, rather than just modifying them directly, otherwise the host won’t know
// that they’ve changed.
getProcessor()->setParameterNotifyingHost (JuceDemoPluginAudioProcessor::gainParam,
(float) gainSlider.getValue());
}
else if (slider == &delaySlider)
{
getProcessor()->setParameterNotifyingHost (JuceDemoPluginAudioProcessor::delayParam,
(float) delaySlider.getValue());

	PopupMenu m;
	m.addItem(1, "Save Preset");
	m.addItem(2, "Show on Tree-View");
	const int result = m.show();
}

}[/code]

It should show a very tiny font, but instead, it shows the regular font.

Please, HELP! :oops:


#2

Can only mean your L&F isn’t being applied. It’s possible your sliders aren’t deriving their parent’s L&F because they’re being constructed before it’s set on the parent…

Try the static method for setting a global L&F, if convenient. But attempt doing so before the construction of your editor.

newLook = new LookAndFeelEx();
juce::LookAndFeel::setDefaultLookAndFeel (newLook )

#3

Yes!!! Thank you so much, still a lot to learn after all this years… :oops:

I´m doing this during the constructor, and it works perfectly.

Wusik4000AudioProcessor::Wusik4000AudioProcessor(): dataFiles(0) { dataFiles = Wusik4000DataFiles::getInstance(); juce::LookAndFeel::setDefaultLookAndFeel(dataFiles->myLookAndFeel); }


#4

Glad you got it working!