[Project_owners] Mimimum size for XUL window

Brian King brian at mozdev.org
Mon Nov 28 11:00:01 EST 2005


FYI, here is the code that I used that does what I need:

const WINDOW_WIDTH = 800;
const WINDOW_HEIGHT = 600;

function onResize()
{
   var tHeight = WINDOW_HEIGHT;
   if (this.outerHeight >= WINDOW_HEIGHT)
     tHeight = this.outerHeight;


   var tWidth = WINDOW_WIDTH;
   if (this.outerWidth >= WINDOW_WIDTH)
     tWidth = this.outerWidth;

   this.resizeTo(tWidth, tHeight);
}

window.addEventListener('resize', onResize, false);

The window will never go below the values defined in the const 
variables, and if either side is made bigger than the min-size, it is 
allowed to stay that way.

Thanks for the pointers.

Paul Tomlin wrote:
> Philip Chee wrote:
>> On Thu, 24 Nov 2005 12:31:40 +0100, Brian King wrote:
>>
>>> Does anyone know how to give a window a minimum width/height, so that 
>>> the user can not make it any smaller than the given values?
>>
>>> I tried CSS min-width and min-height, plus a couple of other things, 
>>> but it did not work.
>>
>> Sometime back, Paul Tomlin posted the following snippet of code to this
>> newsgroup:
> 
> check the source for quickfile, there's a tidier version there
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 
> 


-- 
Brian King
www.mozdev.org - free project hosting for the Mozilla community


More information about the Project_owners mailing list