Bug 39956 - Tab beomes visible when not active via setRedraw(true)
Summary: Tab beomes visible when not active via setRedraw(true)
Status: RESOLVED DUPLICATE of bug 4608
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 39957
  Show dependency tree
 
Reported: 2003-07-11 15:43 EDT by Darin Wright CLA
Modified: 2003-07-14 09:51 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2003-07-11 15:43:33 EDT
I noticed behavior in the launch dialog where a non-active tab was becoming 
visible. It uses 'setRedraw(..)' to avoid flicker. It seems that this makes the 
tab become visible when it is not active. Included is a sample program that 
exhibits the same behavior. When ever a tab at an index greater than 
the 'redrawn' tab is selected, the redrawn tab displays. In this example, tab 
(2) does a redraw when ever a tab is selected.

/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 
*******************************************************************************/

import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

/**
 * TabbedFolderExample
 */
public class TabbedFolderExample extends ApplicationWindow {
	
	private static boolean fDone = false;
	
	/* (non-Javadoc)
	 * @see org.eclipse.jface.window.Window#configureShell
(org.eclipse.swt.widgets.Shell)
	 */
	protected void configureShell(Shell shell) {
		super.configureShell(shell);
		Composite composite = new Composite(shell, SWT.NONE);
		Layout layout = new GridLayout();
		composite.setLayout(layout);
		
		GridData gd = new GridData(GridData.FILL_BOTH);
		composite.setLayoutData(gd);
		
		TabFolder folder = new TabFolder(composite, SWT.NONE);
		gd = new GridData(GridData.FILL_BOTH);
		folder.setLayoutData(gd);
		
		TabItem tab1 = new TabItem(folder, SWT.NONE);
		tab1.setText("Tab One"); 
		Button b1 = new Button(tab1.getParent(), SWT.PUSH);
		b1.setText("ONE");
		tab1.setControl(b1); 
		
		final TabItem tab2 = new TabItem(folder, SWT.NONE);
		tab2.setText("Tab Two");
		Button b2 = new Button(tab2.getParent(), SWT.PUSH);
		b2.setText("TWO");
		tab2.setControl(b2);

		TabItem tab3 = new TabItem(folder, SWT.NONE);
		tab3.setText("Tab Three");
		Button b3 = new Button(tab3.getParent(), SWT.PUSH);
		b3.setText("THREE");
		tab3.setControl(b3);
		
		folder.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				tab2.getControl().setRedraw(false);
				tab2.getControl().setRedraw(true);
			}
		});
		
	}

	public static void main(String[] args) {
		Window window = new TabbedFolderExample();
		window.open();
		window.getShell().addShellListener(new ShellAdapter() {
			public void shellClosed(ShellEvent e) {
				fDone = true;
			}
		});
		while (!fDone) {
			Display.getDefault().readAndDispatch();
		}
		
	}
	
	public TabbedFolderExample() {
		super(null);
	}

}
Comment 1 Veronika Irvine CLA 2003-07-14 09:51:08 EDT

*** This bug has been marked as a duplicate of 4608 ***