[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] window-setInnerExtent bug



hmm, you are right, the actually adding of the window bar height (22 pixels i think) takes place already somewhere else. i will change this.

ciao, -sciss-

Am 16.12.2006 um 12:34 schrieb Fredrik Olofsson:

hi list,
found this odd offset of 45 pixels in SCWindow and JSCWindow.

setInnerExtent { arg w,h; // resize window keeping top left corner fixed
		var b;
		b = this.bounds;
		w = w ? b.width;
		if(h.isNil,{ h = b.height }, { h = h + 45 }); //+ 45 for window bar
		this.bounds = Rect(b.left,b.top + (b.height - h  ),w,h);
	}

//--code to spot the bug...
	GUI.swing
	GUI.cocoa
	w= GUI.window.new("asdf", Rect(128, 64, 200, 200)).front
	w.setInnerExtent(200, 200)	//height should not change right, 200=200?
	w.bounds


//--proposed fix...
setInnerExtent { arg w,h; // resize window keeping top left corner fixed
		var b;
		b = this.bounds;
		w = w ? b.width;
		h = h ? b.height;
		this.bounds = Rect(b.left,b.top + (b.height - h), w,h);
	}

only place i found it used was in MultiPageLayout:resizeToFit

setInnerExtent is an awkward name. shouldn't it be renamed resize anyway?
_f