nswindow

Cocoa - How to bring particular window to come in foreground from StatusMenu

不打扰是莪最后的温柔 提交于 2019-12-04 20:12:52
I am working on an Mac Application. I have set Application is agent (UIElement) = YES in plist, and App have a Window (lets say Popup Window) that acts as custom PopOver for StatusMenu. One more window is there (lets say Window B) that should opened on selecting a Link from StatusMenu that i have made, but Problems that I am facing are as follow: On Application launch, When I opens status Menu It also showing Window B , that actually should not be Shown. Window B is allocated and initialised in Application Delegate. Another Issue is When Window B is made Visible by Selecting it from StatusMenu

Hotkeys? Key events?

自古美人都是妖i 提交于 2019-12-04 18:47:50
I'm trying to make a window open when the user pressed Cmd + L but how can I make my controller object listen to that particular key combination? Create a menu item, set its shortcut to Cmd-L, and connect it to an action on that controller (or on another controller, which forwards to your desired controller). Or ... read the Handling Key Events section of the Cocoa Event-Handling Guide and implement a custom view that, when it is the first responder, interprets this key event and notifies your controller. Or ... insert your controller into the responder chain. ... but the easiest method is the

Document sheet not responding to keyboard events

孤街醉人 提交于 2019-12-04 17:52:06
问题 I think it's a first responder problem, but I'm not sure. I'm implementing an edit window for data in a table view. Very similar in concept to the UI for editing filter rules in Mail.app. I have an editing window that I attach to my primary window with: [NSApp beginSheet: criteriaEditPanel modalForWindow: [self window] modalDelegate: self didEndSelector: @selector(criteriaEditDidEnd:returnCode:contextInfo:) contextInfo: (void *)[criteriaList objectAtIndex: index]]; The panel displays properly

Any NSWindowRestoration examples?

ぃ、小莉子 提交于 2019-12-04 11:45:38
I'm having some trouble implementing NSWindowRestoration (in 10.7 Lion). I'm not getting the protocol notifications. Is there an example app with this implemented somewhere? I cannot find one on the Apple Developer site. Thanks! Edit: The question marked as answer is helpful, but the problem in my case was that I was using a menubar-only application. I guess window restoration doesn't work with dockless apps yet. Snap! The class method + (void)restoreWindowWithIdentifier:(NSString *)identifier state:(NSCoder *)state completionHandler:(void (^)(NSWindow *, NSError *))completionHandler as

how to get window with semi-transparent blurred background

﹥>﹥吖頭↗ 提交于 2019-12-04 11:37:00
问题 I'd like to get a window that has a semi-transparent blurred background, just like what the Terminal can do. See this video, about 30 sec in, to see what I mean: http://www.youtube.com/watch?v=zo8KPRY6-Mk See an image here: http://osxdaily.com/wp-content/uploads/2011/04/mac-os-x-lion-terminal.jpg I've been googling for an hour, and can't get anything to work. I believe I need to somehow create a core animation layer and add a background filter, but I've been unsuccessful so far... I just see

Rounded NSView in a Transparent Window

爱⌒轻易说出口 提交于 2019-12-04 11:28:06
I'm trying to make a transparent NSWindow with a rounded view in there. I'm trying to have a rounded view with a transparent window. This is what it looks like now: (see the little dots in the corners) Here's another example with the border radius set to 10px (set in NSView drawRect): I am using code from this Apple sample: https://developer.apple.com/library/mac/#samplecode/RoundTransparentWindow/Introduction/Intro.html Specifically this method in my NSWindow subclass: - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:

How do I create a custom borderless NSWindow in Objective-C + Cocoa?

吃可爱长大的小学妹 提交于 2019-12-04 10:09:01
Let me start off by saying that this is my first real Cocoa app. It's a simple app that pretty much displays my website in a borderless window. The way I'm currently creating a borderless window is using the following: - (void) awakeFromNib { [window setStyleMask:NSBorderlessWindowMask]; [window setAcceptsMouseMovedEvents:YES]; [window setMovableByWindowBackground:YES]; [window setLevel:NSNormalWindowLevel]; } The problem with this is that as a result, the WebView within the window does not pass mouse over events to elements on the loaded page, nor does it provide the ability to type in text

How show sheet loaded from xib? (MacOSx)

帅比萌擦擦* 提交于 2019-12-04 09:56:13
I have a xib file with only an NSPanel in it, I'm trying to show this panel as modal sheet (with beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo: ). The file's owner for this xib is a controller class "MyController" which has the IBOutlet to the NSPanel. What I am looking for is something like: ... MyController *controller = [[MyController alloc] init]; [NSApp beginSheet:controller.panel modalForWindow:[NSApp mainWindow] modalDelegate:controller didEndSelector:nil contextInfo:nil]; ... Question: Must MyController inherit from NSWindowController or NSObject ?. I tried

How to give focus to NSWindow loaded from NIB?

二次信任 提交于 2019-12-04 09:37:20
I'm using NSWindowController to load a window from a NIB. However, when I call showWindow: , the window is visually topmost, but the focus remains where it was (instead of moving it to the new window). It's easy to see this happening when the first window (with keyboard focus) is moved slightly, before creating the new window (via cmd+n). This is the result: The bottom, focused window is the original window. The unfocused window on top is the newly created window. This is the relevant code: AppDelegate.h: - (IBAction)newDocument:(id) sender; AppDelegate.m: - (IBAction)newDocument:(id) sender {

Resizing NSWindow to fit child NSView

橙三吉。 提交于 2019-12-04 08:03:49
问题 I have one main NSWindow which is empty, and 5 NSViews. The NSViews have different buttons and labels etc, and the window is empty. The first view displayed is a menu, linking to the other views and back. This works fine and the views switch well. However if the NSWindow is a certain size, and the NSView is bigger, then it spills out of the NSWindow and gets cut off. Is there any way such that when I do: [_window setContentView: theNewView]; to also have _window resize to fit the new view? If