View Single Post
  #1 (permalink)  
Old July 12th, 2006, 03:20 AM
JMax JMax is offline
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default no scroll bar on sashform

hi,
   i have SashForm and am adding controls to it dynamically...But once the size of the controlls is more than that of sash no vertical scroll is occuring. pls help.........

here is the code

package swt;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Shell;

public class SashExample {

public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    /*final Sash sash = new Sash (shell, SWT.BORDER | SWT.VERTICAL);
    sash.setBounds (10, 10, 15, 60);
    sash.addListener (SWT.Selection, new Listener () {

        public void handleEvent (Event e) {
            System.out.println("Selected. ");
            sash.setBounds (e.x, e.y, e.width, e.height);
        }
    });*/
    Group profileGrp,sessions,interval,duration,urls,objects ,datachannel,summary;
    shell.setLayout(new FillLayout());
    SashForm composite = new SashForm( shell, SWT.HORIZONTAL );

    final Composite composite_1 = new Composite(composite, SWT.NONE);
    composite_1.setLayout(new GridLayout());
    GridLayout gridLayout = new GridLayout(2,true);


    summary = new Group(composite_1, SWT.SHADOW_IN);
    summary.setText("Output file for summary");
    summary.setLayout(new GridLayout(2,true));
    final GridData gridData_2 = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData_2.heightHint = 58;
    summary.setLayoutData(gridData_2);
    final Label summaryLabel = new Label(summary, SWT.NONE);
    summaryLabel.setText("file name");
    Text summText = new Text(summary, SWT.SINGLE | SWT.RIGHT | SWT.BORDER);
    summText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    datachannel = new Group(composite_1, SWT.SHADOW_IN);
    datachannel.setText("Output file for data channel");
    datachannel.setLayout(new GridLayout(2,true));
    datachannel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Label dChannel = new Label(datachannel, SWT.NONE);
    dChannel.setText("file name");
    Text dText = new Text(datachannel, SWT.SINGLE | SWT.RIGHT | SWT.BORDER);
    dText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    objects = new Group(composite_1, SWT.SHADOW_IN);
    objects.setText("Objects");
    objects.setLayout(new GridLayout(2,true));
    objects.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Label inclObjLabel = new Label(objects, SWT.NONE);
    inclObjLabel.setLayoutData(new GridData());
    inclObjLabel.setText("include");

    Text incObjText = new Text(objects, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
    final GridData objGgridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    objGgridData.heightHint = 40;
    incObjText.setLayoutData(objGgridData);

    final Label exclObjLabel = new Label(objects, SWT.NONE);
    exclObjLabel.setText("exclude");

    Text exclText = new Text(objects, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
    final GridData objGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    objGridData.heightHint = 40;
    exclText.setLayoutData(objGridData);

    urls = new Group(composite_1, SWT.SHADOW_IN);
    urls.setText("URLs");
    urls.setLayout(new GridLayout(2,true));
    urls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    final Label includeLabel = new Label(urls, SWT.NONE);
    includeLabel.setLayoutData(new GridData());
    includeLabel.setText("include");

    Text incText = new Text(urls, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
    final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.heightHint = 39;
    gridData.minimumHeight = 10;
    incText.setLayoutData(gridData);

    final Label excludeLabel = new Label(urls, SWT.NONE);
    excludeLabel.setText("exclude");

    Text excText = new Text(urls, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
    final GridData gridData_1 = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData_1.heightHint = 44;
    excText.setLayoutData(gridData_1);



    duration = new Group(composite_1, SWT.SHADOW_IN);
    duration.setText("Duration of the test");
    duration.setLayout(new GridLayout(2,true));
    duration.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label dur = new Label(duration,SWT.LEFT);
    dur.setText("duration");
    Text durv = new Text(duration,SWT.SINGLE|SWT.RIGHT|SWT.BORDER);
    durv.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    durv.setText("");

    interval = new Group(composite_1, SWT.SHADOW_IN);
    interval.setText("Interval between sessions in millis:");
    interval.setLayout(new GridLayout(2,true));
    interval.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label mean = new Label(interval,SWT.LEFT);
    mean.setText("mean");
    Text mv = new Text(interval,SWT.SINGLE|SWT.RIGHT|SWT.BORDER);
    mv.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    mv.setText("");
    Label dev = new Label(interval,SWT.LEFT);
    dev.setText("deviation");
    Text dv = new Text(interval,SWT.SINGLE|SWT.RIGHT|SWT.BORDER);
    dv.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    dv.setText("");

    sessions = new Group(composite_1, SWT.SHADOW_IN);
    sessions.setText("Max number of concurrent sessions:");
    sessions.setLayout(new GridLayout(2,true));
    sessions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Label s =new Label(sessions,SWT.LEFT);
    s.setText("sessions:");
    Text v = new Text(sessions,SWT.SINGLE|SWT.RIGHT|SWT.BORDER);
    v.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    v.setText("");

    profileGrp = new Group(composite_1, SWT.SHADOW_IN);
    profileGrp.setLayout(gridLayout);

    profileGrp.setText("User Profiles:");
        //profileGrp.setBackground(new Color(composite.getDisplay(),255,255,255));

        //GridData gridData = new GridData(SWT.BEGINNING,SWT.CENTER,true,false);
        //gridData.horizontalSpan = 2;

    profileGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label pname = new Label(profileGrp,SWT.LEFT);
    pname.setText("name");
    Label pweight = new Label(profileGrp,SWT.RIGHT);
    pweight.setText("weight in %");
    Label p1 = new Label(profileGrp,SWT.LEFT);
    p1.setText("Profile 1");
    Label w1 = new Label(profileGrp,SWT.RIGHT);
    w1.setText("50");
    Label p2 = new Label(profileGrp,SWT.LEFT);
    p2.setText("Profile 2");
    Label w2 = new Label(profileGrp,SWT.RIGHT);
    w2.setText("50");
    composite.setWeights(new int[] { 1 });

       Button b1 = new Button( composite, SWT.PUSH );
       b1.setText( "Button One" );

        composite.setLayout(new GridLayout(1,true));



    shell.open ();
    //sash.setFocus ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
    }
}


Reply With Quote