I tried this in createToolbar and I still get the error. I don't know if the styleMask isn't set yet or if it's somehow using the toolbar from the previous window? Seems odd. I haven't played with it too much, but I just wanted to let you know that this didn't appear to work in case you were planning on taking a look at some point.

Figured it out. Please try the attached patch.

Thanks,

Aaron