-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example to embedding webview with exist UI framework #965
Comments
Note: This is a "living" comment. I update it with the current information as I make progress with my experiments related to this topic. I think this is a great idea, and is from what I can understand supposed to be a supported use case, but I'm not sure if the feature has ever really been in a usable state. I doubt that the library in its current state can be integrated cleanly with an existing UI framework. wxWidgets (Windows 10)On Windows we might need to get rid of the library's dependency on internal event/message loops as to not interfere with the existing loop provided by the UI framework. Here's a demo of the library being integrated with wxWidgets on Windows 10. I was only able to do it this by making changes to the library itself. wxwidgets.webmIn my experimental code, it creates a new child window which is used as the parent window for WebView2, and a message-only window for internal messaging ( GTK3 (Ubuntu 22.04)gtk3.webmWinAPI/Win32 (Windows)Kind of cumbersome to work with but here's a demo for native Windows API. win32.webmCocoa (macOS)ARC EnabledNot much luck yet due to memory-related crashes ( We also can't use ARC DisabledIt's possible to create an Objective-C++ class with ARC disabled for its source file. The implementation can call the C++ webview library with ARC disabled. The Objective-C side can look similar to this: #import "ViewController.h"
#import "WebviewBridge.h"
@implementation ViewController {
WebviewBridge *_bridge;
}
- (void)viewDidLoad {
[super viewDidLoad];
_bridge = [[WebviewBridge alloc] initWithDebug:NO window:_webContainer.window];
// add _bridge.widget as subview of _webContainer
[_bridge bindWithName: @"increment" block:^(NSString * req) {
// ...
return @"";
}];
// [_bridge setHTML:html];
}
@end |
Take a look at fpwebview, my Pascal binding, especially the demo lclembed, which embeds Lazarus is an IDE-cum-widget set interface for developing cross platform GUI applications in Pascal. The demo works on macOS (using Lazarus Cocoa widget set) and Windows (using Lazarus Windows widget set). For Linux:
|
I am an absolute beginner, I wanted to try to embed webview in gtk using nim language. But from what I can understand it seems it is not possibile at now. But why the function webview_create() offers the possibility to pass a window handler if the embedding does not work?
but if it is so hard to make it work why is it there? |
For making webview library release more power, the example should consider to add example to embedding webview with exist UI framework, like GTK / wxWidgets / QT / MAUI / ...
pls see #938 #842 #466 #787 #243
The text was updated successfully, but these errors were encountered: