Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Gtk Error message when creating ExpandItems dynamically on linux(Gtk-CRITICAL **: IA__gtk_widget_map: assertion `gtk_widget_get_visible (widget)' failed)
Gtk Error message when creating ExpandItems dynamically on linux [message #1321844] Tue, 29 April 2014 14:40
Daniel Galdames is currently offline Daniel Galdames
Messages: 2
Registered: March 2011
Junior Member
To reproduce run the code below and select the menu "File->New ExpandItem". A gtk error message as above is displayed on the terminal/console.

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;

public class ExpandBarExample {
	private static int counter;
	private static ExpandBar expandBar;

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		shell.setText("Expand bar example");
		createMenuBar(shell);
		expandBar = new ExpandBar(shell, SWT.V_SCROLL);
		for (counter=0; counter < 3;counter++) {
			createExpandItem(expandBar, "item " + String.valueOf(counter));
		}
		shell.open();
	    while (!shell.isDisposed())
	    {
	        if (!display.readAndDispatch())
	        {
	            display.sleep();
	        }
	    }
	    display.dispose();
	}
	
	private static void createMenuBar(Shell shell) {
		Menu menubar = new Menu(shell, SWT.BAR);
		shell.setMenuBar(menubar);
		MenuItem fileItem = new MenuItem(menubar, SWT.CASCADE);
		fileItem.setText("&File");
		Menu submenu = new Menu(shell, SWT.DROP_DOWN);
		fileItem.setMenu(submenu);
		MenuItem item = new MenuItem(submenu, SWT.PUSH);
		item.setText("New ExpandItem");
		item.addListener(SWT.Selection, new Listener() {
			@Override
			public void handleEvent(Event event) {
				createExpandItem(expandBar, "item " + String.valueOf(counter++));				
			}
			
		});

	}
	private static void createExpandItem(ExpandBar bar, String text) {
		ExpandItem item = new ExpandItem(bar, SWT.NONE);
		item.setText(text);
	}
}

Previous Topic:SWT in Java WebStart App stopped working on OSX after upgrading to Java 7
Next Topic:Backport Firefox 24 integration to 3.X
Goto Forum:
  


Current Time: Wed Oct 22 00:20:53 GMT 2014

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

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