Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to scroll in this composite with Page-Up/Down?(I have to make a dialog accessible, but I cannot scroll with Page-Up/Down within this composite)
How to scroll in this composite with Page-Up/Down? [message #760150] Thu, 01 December 2011 13:43 Go to next message
Simon Mising name is currently offline Simon Mising name
Messages: 12
Registered: December 2011
Junior Member
I have a little problem:
There exists a composite which contains a Textfield and a Button. This composite is wrapped with a scrolled-composite.
If the focus is on either the Textfield or the Button, it is not possible to scroll the parent composite with the Page Up/Down keys.

My question is now, how to obtain my goal, to enable scrolling within this composite by using Page Up/Down?
Is there a possibility to use a KeyListener or something else, to enable scrolling?

Thanks for you help!

Here my little sample class:

public class Test {

	protected Shell shell;
	private Text txtLdfjslkdflksjflks;

	 * Launch the application.
	 * @param args
	public static void main(String[] args) {
		try {
			Test window = new Test();;
		} catch (Exception e) {

	 * Open the window.
	public void open() {
		Display display = Display.getDefault();
		shell.setSize(300, 300);;
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {

	 * Create contents of the window.
	protected void createContents() {
		shell = new Shell();
		shell.setSize(300, 300);
		shell.setText("SWT Application");
		shell.setLayout(new FillLayout());
		ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
		sc.setLayout(new GridLayout(1, false));
		Composite comp = new Composite(sc, SWT.NONE);
		comp.setLayout(new GridLayout(1, true));
		txtLdfjslkdflksjflks = new Text(comp, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
		Button b = new Button(comp, SWT.PUSH);
		sc.setMinSize(comp.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));

Re: How to scroll in this composite with Page-Up/Down? [message #760846 is a reply to message #760150] Mon, 05 December 2011 12:37 Go to previous message
Simon Mising name is currently offline Simon Mising name
Messages: 12
Registered: December 2011
Junior Member
This thread can be closed.

Previous Topic:masked value for swt text field based on indicator
Next Topic:Converting a BufferedImage which uses ComponentColorModel
Goto Forum:

Current Time: Sat Oct 25 17:46:05 GMT 2014

Powered by FUDForum. Page generated in 0.05807 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software