New windows and accepting input...
New windows and accepting input...
- Subject: New windows and accepting input...
- From: d2kagw <email@hidden>
- Date: Sun, 16 Apr 2006 19:09:41 +1000
Hi There everyone - Happy Easter !
I need to be able to create new windows on demand for a little app im
writing, and im having some difficulty getting the new windows to
accept key inputs?
this is a sample of the code im using to create the windows:
// just show it in a window
NSRect screenRect;
screenRect = NSMakeRect(10.0, 10.0, 800.0, 600.0);
// Put up a new window
ZWindow = [[ZanooWindow alloc] initWithContentRect:screenRect
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:YES screen:[NSScreen
mainScreen]];
// set the windows title
[ZWindow setTitle:@"Zanoo"];
// set the view
[ZWindow setContentView:ZView];
// display the window
[ZWindow makeKeyAndOrderFront:nil];
I based it on this tutorial :http://www.cocoadevcentral.com/articles/
000028.php cause yes, the application does work in both windowed mode
as well as full screen...
Anyway, I followed the advice given at the base of the page where it
mentions sub-classing the NSWindow object, and adding:
- (BOOL)canBecomeKeyWindow
{
return YES;
}
everything works fine.. the window pops up, the ZView is placed
inside it, the only issue is that whenever I strike the keyboard, I
get the dreaded OSX "alert/can't do this" ding, I can click on the
new window as much as I like [and the controls inside the NSView],
and but it just never allows keypresses....
Any Ideas where I may be going wrong?
Many thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden