XML Feeds

.

[javascript-dev] Re: Callback for bpatcher resize event?

vade doktorp at mac.com
Wed Dec 5 22:24:01 MST 2007


So, I have a resize function which reflows my gui - I was able to use a task within the loadbang function with a delay to get my initial resize working. No idea how on earth to do others, but I think its ok, since resizing will be an editing task, and users can just click the damn resize message box if they need to reflow.

Once they set it, this function will do it for them when the patch is saved.

function loadbang()
{
	var loadtask = new Task(resize, this);
	loadtask.schedule(100);
}

function resize()
{
	prev = 0; 
	owner = this.patcher;
	while (owner)
	{ 
		prev = owner; 
		owner = owner.patcher.parentpatcher; 
	} 
	if (prev) 
	top = prev.box;
	
	// width of our parent bpatcher	
	width = top.rect[2] - top.rect[0];

        <snip> do your reflow here if you want </snip>

// refresh our parent patchers on down (?).
	prev.parentpatcher.refresh();
	prev.refresh();
	this.patcher.refresh();

}


More information about the javascript-dev mailing list