PDA

View Full Version : splitter and onDblClick



kuzynpiy
14 Oct 2006, 1:30 PM
Hello,

Does anybody know how to make the splitter (horizontal or vertical) change the size to minsize automaticly when I double click on the splitter ?

Ths in advance.
--
Peter

jack.slocum
14 Oct 2006, 11:24 PM
Assuming your splitter is called split.



split.el.on('dblclick', split.setCurrentSize.createDelegate(split, [split.minSize]));

kuzynpiy
15 Oct 2006, 6:58 AM
Hello,

Thx for Your sugestion.

I save localy Your site (http://www.jackslocum.com/yui/) and then add the code you write:
split.el.on('dblclick', split.setCurrentSize.createDelegate(split, [150]));
to blog.js in initUI function, just after the code:
(...)
var split = new YAHOO.ext.SplitBar('splitter', 'sidebar');
split.setAdapter(new YAHOO.ext.SplitBar.AbsoluteLayoutAdapter('blogBody'));
split.minSize = 150;
split.maxSize = 400;
split.animate = true;
split.onMoved.subscribe(this.splitterMoved.createDelegate(this));
(..)
and it doesn't work. Maybe because the splitter divide the navbar and the main body of the site.

I do not test the code You send with other splitters.

jack.slocum
15 Oct 2006, 9:09 AM
The problem there is my site responds to the splitters onMoved event and setCurrentSize doesn't trigger the event.

Try this:



split.el.on('dblclick', function(){
split.setCurrentSize(150);
split.onMoved.fireDirect(split, 150);
});

kuzynpiy
16 Oct 2006, 11:46 AM
Hey,

That works perfectly. Thank You vary much indeed.

Peter

jack.slocum
16 Oct 2006, 11:52 AM
No problem. Keep an eye on my site over the next couple days, I am getting ready to release something that will make a layout like my site (actually much better) automatic.