New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

WebView in NSWindow and keyboard events

Post Reply New Thread Subscribe

Thread Tools

Member Since: May 06, 2010
Posts: 1
albanvn is on a distinguished road

albanvn is offline
Hi everybody,

I'm new in the apple developer community.
I'm trying to make an application which open a webview in fullscreen mode and hide cursor, menu bar and dock bar.
To do this, i create an nswindow and a webview and add it to the nswindow by using the addsubview function.
This is working great but webview seems to miss all keyboard events. The mouse events are correctly catched by the view. I don't know what's wrong in my code:

    // compute the max frame rect
    NSRect fullScreenRect = NSZeroRect;
    for (NSScreen * screen in [NSScreen screens]) 
        fullScreenRect = NSUnionRect(fullScreenRect, [screen frame]);
    // Create a borderless window with the right frame
    NSWindow * aWindow = [[NSWindow alloc] initWithContentRect:fullScreenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
    // Set the correct bounds to subview
    [_myWebView setFrame:[[aWindow contentView] bounds]];

    [[aWindow contentView] addSubview:_myWebView];
    [[WebPreferences standardPreferences] setPlugInsEnabled:YES];

    // Set default URL
    [_myWebView setMainFrameURL:@""];

    // Move and hide the mouse
    CGWarpMouseCursorPosition(CGPointMake(200.f, 200.f));
    [NSCursor hide];

    // Mask menu bar and dock
    SetSystemUIMode(kUIModeAllSuppressed, 0);
    [aWindow makeKeyAndOrderFront:NSApp];
Thanks in advance for your help
QUOTE Thanks

Post Reply New Thread Subscribe

« Generating Keyboard Events | Using a proxy for NSURLConnection »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 05:25 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?