Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Extending or increaing horizontal scrollbar width (Horizontal scrollbar to canvas)
Extending or increaing horizontal scrollbar width [message #1007277] Tue, 05 February 2013 05:44 Go to previous message
Chandrayya Kumarswamimath is currently offline Chandrayya Kumarswamimath
Messages: 9
Registered: August 2010
Location: Bangalore
Junior Member
I used the below code to combine two canvas.
package com.cavium.test.views;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class TwoCanvas {

    /**
     * @param args
     */
    public static void main(String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	shell.setText("Canvas Test");

	Composite mainComp = new Composite(shell, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);

	layout.horizontalSpacing = 0;

	mainComp.setLayout(layout);
	mainComp.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, true, true));

	final Canvas hwCanvas = new Canvas(mainComp, SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL);
	hwCanvas.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
	hwCanvas.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
	hwCanvas.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, true));
	hwCanvas.getVerticalBar().setVisible(false);

	final Canvas traceCanvas = new Canvas(mainComp, SWT.NO_REDRAW_RESIZE | SWT.H_SCROLL | SWT.V_SCROLL);
	traceCanvas.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
	traceCanvas.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
	traceCanvas.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, true, true));

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


Is it possible to increase the width(length) of the horizontal scrollbar as attached here
  • Attachment: canvas.jpeg
    (Size: 10.38KB, Downloaded 25 times)
 
Read Message
Read Message
Read Message
Previous Topic:GridData width hint hides field
Next Topic:loading a private key into the embedded browser widget
Goto Forum:
  


Current Time: Wed May 22 11:43:41 EDT 2013

Powered by FUDForum. Page generated in 0.02117 seconds