AlertWindow statics and LookAndFeel


#1

Is there a way to set the look and feel for the AlertWindow statics (AlertWindow::showMessageBox() etc.)?

The look and feel that a small fun project I’m working on uses, rather screws with the appearance of the buttons on those components. It’d be handy therefore for the alert windows to support alternate LAFs to the main application.

I can’t see a way round this, short of creating custom alert windows. Obviously that’s not a show stopper, but it seems a little redundant.

If there isn’t an easy way of doing this, would it be possible for the AlertWindow statics be given an extra param for a custom LAF?


#2

I brought up the same point regarding T3’s AlertWindows at KVR. Beno said they hadn’t found a simple way to do it. That doesn’t help you much, I guess, but it could have already been added to the list of Juce FRs.


#3

Couldn’t you just set your custom look and feel to be global with LookAndFeel::setDefaultLookAndFeel()…? If you use a class with customised alert window methods, then it won’t affect anything else.


#4

I think we are talking at cross purposes. In my case I specifically don’t want the alert windows to inherit the global look and feel.

The way I’m implementing buttons, looks kind of wierd on the alert windows, so I need them to use the standard JUCE LAF:

the button in the alert window is depressed (even though you can’t see the pointer). Ideally it should just be a nice normal JUCE button, not a flattened one like I am using elsewhere on the interface.

I guess I could flip your suggestion, and leave the global LAF to be the default JUCE one, and then manually set the custom look and feel for the main application components.


#5

Ah, gotcha. Well if it was me, I’d probably do like you suggest and leave the global L+F as normal, and apply the custom one just to your top-level window, so it gets inherited by all the stuff inside.


#6

There’s a problem with that plan… :wink:

ComboBoxes aren’t inheriting the look and feel for their popups, and regular popup menus, don’t propagate the look and feel down to child popups.

The screengrab below shows what I mean. Note the style of the first popup[1] menu, and then the style of the child.

[1] just to be clear, that’s not a combo box, those are regular popups hung under something that looks like a combo.


#7

Ah, well that’s a little buggette then… I think a quick tweak to juce_ComboBox.cpp is all that’s missing:

[code]void ComboBox::showPopup()
{
if (! menuActive)
{
const int currentId = getSelectedId();

    PopupMenu menu;

    menu.setLookAndFeel (&getLookAndFeel());

    for (int i = 0; i < items.size(); ++i)

[/code]


#8

I actually tried that before posting, but it didn’t seem to be helping.

That said, I’d been donkeying around with various things to see if I could force propagation from inside the app, so i may have conspired to break with one hand what I fixed with the other. :slight_smile:


#9

hmm. I wonder why that wouldn’t work?


#10

I don’t know.

When I traced it, the popup menu was calling the combo box’s getLookAndFeel, which was returning a pointer to the default look and feel. Tracing into that method showed that the combo box truly believed that its own look and feel was the default one.

However, the if I stuck a button on the component that contained the combobox, that was showing up with the correct modified look and feel.

That was the point at which I got bored, switched back to global, and built a few custom alertwindow methods.


#11