Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT browser not rendering until shell resize on mac
SWT browser not rendering until shell resize on mac [message #1696750] Thu, 28 May 2015 11:10 Go to next message
Kiran Kumnoor is currently offline Kiran KumnoorFriend
Messages: 2
Registered: May 2015
Junior Member
I have a problem with the SWT browser. I am using Mac OS X Yosemite.
The browser is deeply placed in a composite hierarchy. i.e., The shell has say composite A, and composite A has composite B, and composite B has composite C and the Browser is placed inside this composite C. I've added location listeners and progress listeners for the browser.

GridDataFactory is org.eclipse.jface.layout.GridDataFactory




Composite compositeC= new Composite(compositeB, SWT.BORDER);

Browser browser = new Browser(compositeC, SWT.None);
GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);


browser.addLocationListener(new LocationListener() {
@Override
public void changing(LocationEvent event) {

}

@Override
public void changed(LocationEvent event) {

}

});

browser.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event e) {

}
});

browser.addProgressListener(new ProgressListener() {

@Override
public void completed(ProgressEvent event) {
browser.layout(true, true);

}

@Override
public void changed(ProgressEvent event) {


}
});

browser.setUrl("http://eclipse.org");

compositeC.layout(true);
compositeC.redraw();


But the page that loads in the browser is not visible until I resize the Shell. I tried redrawing the shell in the completed() method of Progress Listener. But nothing seems to be working.

The same code works perfectly fine in Windows. Is there something I am doing wrong here or some issue with the Webkit rendered on MAC.

[Updated on: Fri, 29 May 2015 03:12]

Report message to a moderator

Re: SWT browser not rendering until shell resize on mac [message #1696845 is a reply to message #1696750] Fri, 29 May 2015 02:50 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de AlwisFriend
Messages: 877
Registered: January 2012
Senior Member

Kiran Kumnoor wrote on Thu, 28 May 2015 07:10

    Composite compositeC= new Composite(compositeB, SWT.BORDER);
    
    Browser browser = new Browser(browserComposite, SWT.None);


You want to use SWT.NONE (a style bit), not SWT.None (an event). But this is just stylistic since they're both 0.
    GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);

You're not showing code to set a layout on the composite.
    		browser.setUrl("[url]http://eclipse.org[/url]");
    
            compositeC.layout(true);
    		compositeC.redraw();

Re: SWT browser not rendering until shell resize on mac [message #1696846 is a reply to message #1696845] Fri, 29 May 2015 03:17 Go to previous message
Kiran Kumnoor is currently offline Kiran KumnoorFriend
Messages: 2
Registered: May 2015
Junior Member
Brian de Alwis wrote on Fri, 29 May 2015 02:50
Kiran Kumnoor wrote on Thu, 28 May 2015 07:10

    Composite compositeC= new Composite(compositeB, SWT.BORDER);
    
    Browser browser = new Browser(compositeC, SWT.None);


You want to use SWT.NONE (a style bit), not SWT.None (an event). But this is just stylistic since they're both 0.
    GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);

You're not showing code to set a layout on the composite.
    		browser.setUrl("[url]http://eclipse.org[/url]");
    
            compositeC.layout(true);
    		compositeC.redraw();




Hi Brian, I've edited the code. The layout for compositeC, which is browser's parent composite is as below.
GridLayoutFactory.fillDefaults().numColumns(1).applyTo(compositeC);
GridDataFactory.fillDefaults().grab(true, true).applyTo(compositeC);

where both GridLayoutFactory and GridDataFactory are from
org.eclipse.jface.layout 

[Updated on: Fri, 29 May 2015 03:19]

Report message to a moderator

Previous Topic:Aligning composites
Next Topic:Browser.setUrl(String, String, String[]) not sending post data
Goto Forum:
  


Current Time: Wed Jan 20 04:53:42 GMT 2021

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

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

Back to the top