Can cef1 be used in multiple tabs?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Can cef1 be used in multiple tabs?

Postby wjywbs » Thu Jul 19, 2012 9:40 am

Recently, I'm trying to embed cef1 into multiple tabs in a window. And I found out that repeated initializing cef won't work (same procedure: call CefInitialize, a new g_handler, same HWND, run message loop). The browser only exists in one tab. So does cef1 support tabs like Chrome? Or do I need to use a different method? (I'm using org.eclipse.swt.custom.CTabItem in Java. I tried to use org.eclipse.swt.browser.Browser in several CTabItem and it worked. But cef does not work with several CTabItem.)


Thanks
wjywbs
Techie
 
Posts: 19
Joined: Thu Jul 19, 2012 9:03 am

Re: Can cef1 be used in multiple tabs?

Postby magreenblatt » Thu Jul 19, 2012 12:39 pm

I can't speak to the swt implementation but in general you should initialize CEF once and then call CreateBrowser multiple times.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Can cef1 be used in multiple tabs?

Postby pchuong » Tue Nov 06, 2012 1:56 pm

wjywbs wrote:Recently, I'm trying to embed cef1 into multiple tabs in a window. And I found out that repeated initializing cef won't work (same procedure: call CefInitialize, a new g_handler, same HWND, run message loop). The browser only exists in one tab. So does cef1 support tabs like Chrome? Or do I need to use a different method? (I'm using org.eclipse.swt.custom.CTabItem in Java. I tried to use org.eclipse.swt.browser.Browser in several CTabItem and it worked. But cef does not work with several CTabItem.)


I was able to create multiple browser window within multiple views in Eclipse using CEF3 on Windows. I believe eclipse view is not much different than CTabItem. From my understanding, you need to pass in a different HWND for each instance of the browser. Try to use a different window handle, perhaps create a composite for each tab item and pass in the composite handle to the browser create method.

I have a different problem related to multiple instances of the browser within the same process. I was able to create multiple browsers with CEF3 using my JNI java wrapper, but as soon as I close the last browser and re-open a new browser. The new browser doesn't render the html page, it displays text in the browser instead.

Does any one experienced this issue before, or might have any idea what I might be doing wrong?

Thanks!
pchuong
Mentor
 
Posts: 73
Joined: Tue Nov 06, 2012 1:41 pm

Re: Can cef1 be used in multiple tabs?

Postby wjywbs » Mon Dec 17, 2012 1:55 am

pchuong wrote:
wjywbs wrote:Recently, I'm trying to embed cef1 into multiple tabs in a window. And I found out that repeated initializing cef won't work (same procedure: call CefInitialize, a new g_handler, same HWND, run message loop). The browser only exists in one tab. So does cef1 support tabs like Chrome? Or do I need to use a different method? (I'm using org.eclipse.swt.custom.CTabItem in Java. I tried to use org.eclipse.swt.browser.Browser in several CTabItem and it worked. But cef does not work with several CTabItem.)


I was able to create multiple browser window within multiple views in Eclipse using CEF3 on Windows. I believe eclipse view is not much different than CTabItem. From my understanding, you need to pass in a different HWND for each instance of the browser. Try to use a different window handle, perhaps create a composite for each tab item and pass in the composite handle to the browser create method.

I have a different problem related to multiple instances of the browser within the same process. I was able to create multiple browsers with CEF3 using my JNI java wrapper, but as soon as I close the last browser and re-open a new browser. The new browser doesn't render the html page, it displays text in the browser instead.

Does any one experienced this issue before, or might have any idea what I might be doing wrong?

Thanks!

CefRunMessageLoop() and CefShutdown() should only be called once in the whole process. Then the new browsers won't display text.
wjywbs
Techie
 
Posts: 19
Joined: Thu Jul 19, 2012 9:03 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 208 guests