*/
public void layoutHorizontal()
{
Control[] c = getChildren();
if ( c.length > 1 ) {
final Sash sash = new Sash( this, SWT.HORIZONTAL );
final int height = getBounds().height;
FormData data = new FormData();
data.left = new FormAttachment( 0, 0 ); // Attach halfway across
data.right = new FormAttachment( 100, 0 ); // Attach to bottom
data.top = new FormAttachment( location * 100 / height, 0 ); // Attach to
// top
data.width = size;
sash.setLayoutData( data );
sash.addSelectionListener( new SelectionAdapter()
{
public void widgetSelected( SelectionEvent event )
{
// We reattach to the left edge, and we use the x value of the event
// to determine the offset from the left
( (FormData)sash.getLayoutData() ).top = new FormAttachment( event.y * 100 / height, 0 );
// Until the parent window does a layout, the sash will not be redrawn
// in its new location.
superLayout();
}
} );