# AlertWindow Look & Feel Bug?

**URL:** <https://forum.juce.com/t/alertwindow-look-feel-bug/5185>\
**Category:** General JUCE discussion\
**Created:** [April 21, 2010, 10:44pm UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185 "2010-04-21T22:44:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wumpus](https://avatars.discourse-cdn.com/v4/letter/w/8c91f0/32.png) [@wumpus](https://forum.juce.com/u/wumpus)\
**Post date:** [April 21, 2010, 10:44pm UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185/1 "2010-04-21T22:44:34Z")

</div>

Howdy,

My app is needlessly complicated; it is basically a large tumor on an app written by a third party. There is something wrong with the the third-party app’s look & feel such that you cannot create their components unless their look & feel is set as the default. (You get exceptions in something to do with looking up Colours.) But I need components of my app to have different look & feel than theirs, so I’ve managed to create my own look & feel and to have my components use it while theirs uses theirs.

(Side question: I don’t really understand why what I’m doing works. I set their look & feel as the default and create their component in a tab of my main component. Then I create my own look & feel and apply it to the main window. This changes the look & feel for the main window and my main component (its child), but not for their component. Is their component blocked from inheriting the new look & feel by the fact that it has been explicitly set?)

At one point in my component, I need to create an AlertWindow, which I do using the static AlertWindow::showOkCancelBox() method, setting the associatedComponent to this. Problem: The alert that pops up appears to be using the default look & feel (theirs). I tried stepping to see what was up; at least to a first pass the AlertWindow seemed to be referencing my look & feel, but there were a lot of nested calls, and at least one naked getLookAndFeel() unassociated with any component (which would get the default, right?). Is this a bug? Or if I’m doing something wrong, can someone assist me?

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 22, 2010, 10:16am UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185/2 "2010-04-22T10:16:35Z")

</div>

The Component::getLookAndFeel call actually looks up the component hierarchy to see if a l+f was explicitly set for one of its parents, and returns that. That means that any embedded components inherit their parent’s l+f. The default one is used as a last resort if it can’t find an explicitly set one.

---

<div class="post-metadata">

**Author:** ![wumpus](https://avatars.discourse-cdn.com/v4/letter/w/8c91f0/32.png) [@wumpus](https://forum.juce.com/u/wumpus)\
**Post date:** [April 22, 2010, 7:17pm UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185/3 "2010-04-22T19:17:29Z")

</div>

Okay, so, then, I’m doing something wrong? Any ideas on what?

Is there something else I need to do to set the look & feel of the AlertWindow? I tried creating a local AlertWindow and setting its look & feel directly before calling the showOKCancelBox method on it. I still got the wrong look & feel.

Anybody want to address my side question?

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 22, 2010, 7:28pm UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185/4 "2010-04-22T19:28:32Z")

</div>

The AlertWindow will pick up its l+f from the associatedComponent parameter that most of the static methods take.

---

<div class="post-metadata">

**Author:** ![wumpus](https://avatars.discourse-cdn.com/v4/letter/w/8c91f0/32.png) [@wumpus](https://forum.juce.com/u/wumpus)\
**Post date:** [April 22, 2010, 7:40pm UTC](https://forum.juce.com/t/alertwindow-look-feel-bug/5185/5 "2010-04-22T19:40:38Z")

</div>

I guess something’s well and truly broken in my (or the third-party) code, then. (As I’m setting the associatedComponent to ‘this’, where ‘this’ is the MainComponent which is using the proper look & feel, and yet I’m getting the other look & feel.)

Luckily it’s just the AlertWindow that’s not behaving; it’s a small enough problem that I can probably get away with just leaving it broken. Still wish I understood why some components inherit look & feel and others don’t, though.

Thanks,  
Alex
