tags:

views:

281

answers:

3

Hi, I want to set a minimum size for my xulrunner applications' main window.I have tried minwidth and minheight but didnt work.wat am i missing out?

A: 

No, you can't.

If you don't believe me, try firefox -- it can resize to just the title bar.

J-16 SDiZ
A: 

A dirty way to keep the xul window minimum size to to listen to the resize event and use window.resizeTo()

NightCoder
A: 

Here is an example:

window.addEventListener("resize", function() {
    if(window.outerWidth > 100 && window.outerHeight > 100 &&
       (window.outerWidth < window.document.documentElement.minWidth ||
        window.outerHeight < window.document.documentElement.minHeight)) {

        window.resizeTo(
            window.document.documentElement.minWidth,
            window.document.documentElement.minHeight            
        );
    }
}, false);

This assumes you have the minwidth and minheight properties set on the XUL window tag.

The > 100 check is needed as the window size is 1 or 23 during loading in my case and resize fires multiple times during loading.

cadorn