Alertwindow buttons not visible


#1

After updating to the latest GIT, my buttons are not visible in my Alertwindows anymore. Have the changes in LookandFeel has anything to do with this? How can I correct this?

 

Kind regards,

 

Harrie


#2

Maybe a l+f change conflicting with your own l+f customisations, but impossible to say what's wrong without more info.


#3

Here is the Custom L+F.cpp: 

 

 

#include "EMpTy250LookAndFeel.h"

 

static const Colour createBaseColour (const Colour& buttonColour,

                                      const bool hasKeyboardFocus,

                                      const bool isMouseOverButton,

                                      const bool isButtonDown) throw()

{

    const float sat = hasKeyboardFocus ? 1.3f : 0.9f;

    const Colour baseColour (buttonColour.withMultipliedSaturation (sat));

 

    if (isButtonDown)

        return baseColour.contrasting (0.2f);

    else if (isMouseOverButton)

        return baseColour.contrasting (0.1f);

 

    return baseColour;

}

 

EMpTy250LookAndFeel::EMpTy250LookAndFeel()

{   

    

    EMpTy250Font=Font(11,0);

    

    

    DecaySliderImages[0]=IC->getFromMemory(decayhandle::emt250_decay0_png,decayhandle::emt250_decay0_pngSize);

    DecaySliderImages[1]=IC->getFromMemory(decayhandle::emt250_decay20_png,decayhandle::emt250_decay20_pngSize);

       

        

}

 

EMpTy250LookAndFeel::~EMpTy250LookAndFeel()

{

}

 

void EMpTy250LookAndFeel::setFontSize(float s)

{

    EMpTy250Font=Font(("Arial"),s,0);

}

 

 

 

Font EMpTy250LookAndFeel::getComboBoxFont(ComboBox &CB)

{

    return EMpTy250Font;

}

 

Label* EMpTy250LookAndFeel::createSliderTextBox(Slider &slider)

{

    Label* const l = new Label (String("n"), String::empty);

 

    l->setJustificationType (Justification::right);

 

    l->setColour (Label::textColourId, Colours::crimson.withAlpha(0.5f));// (Slider::textBoxTextColourId));

 

    l->setColour (Label::backgroundColourId,Colours::transparentBlack);

                  

    l->setColour (Label::outlineColourId, Colours::transparentBlack);

 

    l->setColour (TextEditor::textColourId, slider.findColour (Slider::textBoxTextColourId));

 

    l->setColour (TextEditor::backgroundColourId,

                  slider.findColour (Slider::textBoxBackgroundColourId)

                        .withAlpha (slider.getSliderStyle() == Slider::LinearBar ? 0.7f : 1.0f));

    l->setColour (TextEditor::highlightColourId,slider.findColour(Slider::textBoxHighlightColourId));

 

    l->setColour (TextEditor::outlineColourId, slider.findColour (Slider::textBoxOutlineColourId));

 

    l->setFont(EMT250Font);

 

    return l;

}

 

 

void EMT250LookAndFeel::drawComboBox(juce::Graphics &g, int width, int height, const bool isButtonDown,

                                   int buttonX, int buttonY, int buttonW, int buttonH, juce::ComboBox &box)

{

    g.setColour(Colours::beige);

    g.setFont(13);

    g.setColour(box.findColour(ComboBox::outlineColourId));

    g.drawRoundedRectangle(1,1,width-2,height-2,4,2);

  

}

 

 

 

Font EMpTy250LookAndFeel::getPopupMenuFont()

{

    return EMpTy250Font;

}

 

void EMpTy250LookAndFeel::drawToggleButton (Graphics& g,

                                    ToggleButton& button,

                                    bool isMouseOverButton,

                                    bool isButtonDown)

{

    int W=button.getWidth();

    int X=0.1*W;

    int Xinset = 0.3*W;

    int Yinset=0.16*W;

    //if (button.getToggleState()) LookAndFeel::drawGlassSphere(g,X,0,10.f,button.findColour(TextButton::buttonColourId),2);

    if (button.getToggleState()) LookAndFeel_V2::drawGlassSphere(g,X,0,0.2*W,button.findColour(TextButton::buttonColourId),2);

    else LookAndFeel_V2::drawGlassSphere(g,X,0,0.2*W,Colours::whitesmoke,2);

    

    g.setColour(button.findColour(ToggleButton::textColourId));

    g.setFont(EMpTy250Font);

    g.drawFittedText (button.getButtonText(),X+Xinset, 0,W - X-Xinset, button.getHeight() - Yinset,

                      Justification::centredLeft,1);

    

}

 

void EMpTy250LookAndFeel::drawRotarySlider (Graphics& g,

                                    int x, int y,

                                    int width, int height,

                                    float sliderPos,

                                    const float rotaryStartAngle,

                                    const float rotaryEndAngle,

                                    Slider& slider)

{

    int Ypos;

    if (slider.getName() == String("DecaySlider"))

    {

        sliderPos=sliderPos*16;

        Ypos=0.99*sliderPos;

        g.drawImage(DecaySliderImages[Ypos],x,y,width,height,0,0,DecaySliderImages[Ypos].getWidth(),

                    DecaySliderImages[Ypos].getHeight());

    }

   }

 

 

void EMpTy250LookAndFeel::drawButtonBackground(Graphics &g, Button &button, const Colour &backgroundColour,

                                           bool isMouseOverButton, bool isButtonDown)

{

    if (button.getName() == String("ModernVintage"))

    {

        if (!(button.getToggleState()))

        {

            g.drawImage(ModernImage,0,0,button.getWidth(),button.getHeight(),0,0,ModernImage.getWidth(),

                ModernImage.getHeight());

        }

        else

        {

            g.drawImage(VintageImage,0,0,button.getWidth(),button.getHeight(),0,0,VintageImage.getWidth(),

                VintageImage.getHeight());

        }

        return;

    }

    if (button.getName() == String("BypassButton"))

    {

        Colour C = Colours::black.withAlpha(0.5f);

        g.setColour(C);

        if (button.getToggleState()) 

        {

            g.fillRect(0,0,button.getWidth(),button.getHeight());

        }

        return;

    }

    if (button.getName() == String("SurroundButton"))

    {

        if (!(button.getToggleState()))

        {

            g.drawImage(SurroundImageNormal,0,0,button.getWidth(),button.getHeight(),0,0,

                SurroundImageNormal.getWidth(),SurroundImageNormal.getHeight(),false);

        }

        else

        {

            g.drawImage(SurroundImageInverted,0,0,button.getWidth(),button.getHeight(),0,0,

                SurroundImageInverted.getWidth(),SurroundImageInverted.getHeight(),false);

        }

        return;

    }

}

 

void EMpTy250LookAndFeel::drawButtonText(Graphics& g, TextButton& button,

                                  bool /*isMouseOverButton*/, bool /*isButtonDown*/)

{

    

}

 

 

void EMpTy250LookAndFeel::setGUIsizefactor(float s)

{

    GUIsizefactor=s;

}

 

void EMpTy250LookAndFeel::drawLinearSliderThumb(Graphics &g, int x, int y, int width, int height, 

                    float sliderPos, float minSliderPos, float maxSliderPos, 

                        const Slider::SliderStyle style, Slider &slider)

{

    if ((slider.getName() == String("MixSlider")) || (slider.getName() == String("HighcutSlider")))

    {

        int thumbwidth = SchuifKnopje.getWidth();

        int thumbheight = SchuifKnopje.getHeight();

        g.drawImage(SchuifKnopje,sliderPos-0.5*thumbwidth,y,thumbwidth*height/thumbheight,height,0,0,thumbwidth,thumbheight);

    }

    else

    {

        int thumbwidth = SchuifKnopje2.getWidth();

        int thumbheight = SchuifKnopje2.getHeight();

        g.drawImage(SchuifKnopje2,x,sliderPos-0.5*thumbheight,thumbwidth,thumbheight,0,0,thumbwidth,thumbheight);

    }

}

 

 void EMpTy250LookAndFeel::drawLinearSliderBackground (Graphics &g, int x, int y, int width, int height, float sliderPos,

                                 float minSliderPos, float maxSliderPos, 

                                 const Slider::SliderStyle style, Slider &slider)

{

    return;

}


#4

Sorry, too hard to read. Try debugging it and see what's happening, it'll probably be something simple.


#5

Okay, thanks!


#6

Hard to tell by the formatting on the iPad, but it looks like you have one line still calling the old base class

 

Rail


#7

That old part is commented out. :)


#8

The formatting here… looks like the for is commented out, but not the next line with the LookAndFeel:: in it… I guess the forum formatting adds a newline…??

Cheers,

Rail