nswindow

Setting NSWindow position in current screen

心不动则不痛 提交于 2019-12-12 17:00:25
问题 I am newbie in objective-c.I have created a main window which I want to display in the right bottom of the current screen. I tried the following code - (void)windowDidLoad { NSPoint pos; pos.x = [[NSScreen mainScreen] visibleFrame].origin.x + [[NSScreen mainScreen] visibleFrame].size.width - [mywindow frame].size.width ; pos.y = [[NSScreen mainScreen] visibleFrame].origin.y + [[NSScreen mainScreen] visibleFrame].size.height - [mywindow frame].size.height; [mywindow setFrameTopLeftPoint:pos];

cocoa — What is the proper way to tell an NSWindow to redisplay its contents?

梦想的初衷 提交于 2019-12-12 13:34:23
问题 According to the NSWindow Class Reference, you should "rarely need to invoke" the NSWindow methods "display" or "setViewsNeedDisplay". So what is the usual way to redisplay the window's contents? EDIT: I am having trouble dealing with resizing events. I just want to have everything scale proportionally. See this question. As no one seems to have any ideas for using masks to get it to happen, I want to redraw the whole thing. 回答1: Jason's comment really should be an answer: Generally you don't

NSTextField inside NSPopover is not key until mouse click

隐身守侯 提交于 2019-12-12 10:09:04
问题 I've got an NSPopover that is shown from interaction with an NSStatusItem. I've blogged about the hacks I needed to do to make input even possible in this situation here: http://blog.brokenrobotllc.com/using-nspopover-with-nsstatusitem I have an NSTextField inside the NSPopover's content view. When I open the NSPopover, the NSTextField appears as if it is key (the cursor blinks). But, when typing, nothing shows up. If I click the mouse in the field, my input starts showing up there. I've

Getting NSWindow resizing right in an auto layout world

心不动则不痛 提交于 2019-12-12 09:03:16
问题 I'm having problem getting vertical window resizing working with an auto layout scroll view. What I Want I would like to replicate, as closely as possible, my app's current window resizing behaviour. The width of the window is flexible, but the height of the window should generally track the height of the contents. Specifically: Normally, the window automatically resizes its height to exactly match its contents (with the exception of #2). The user can choose to manually resize the window so

NSPopover to start in a detached state

夙愿已清 提交于 2019-12-12 08:09:54
问题 Is there a way to force the NSPopover to start in the detached state? I only see isDetached which is a read-only property for the state of the popover and an NSPopoverDelegate method detachableWindow(forPopover:) which lets me override the window that gets created. I'd like to essentially click a button and have the NSPopover start in the state in this photo. The style of this window is exactly what a product requirement is and I can't seem to find any NSWindow style settings that would make

NSTextView wont update unless I click on it, and it wont focus. Any ideas?

我们两清 提交于 2019-12-11 15:06:44
问题 I dont have time right this second to put some sample code, (Ill edit my question tomorrow and add some) but basically what happens is that I have a Window. It works fine usually, but if I use [myWindow setStyleMask:NSBorderlessWindowMask] to make it borderless, the NSTextView it contains will stop gaining focus even when you click on it: the ring will never appear, the cursor wont change and the scroll bar will remain gray. Something else that happens when I make it borderless is that it

npWindow->window gives 0 value in NPP_SetWindow function, plugin for Safari browser on Mac

守給你的承諾、 提交于 2019-12-11 13:57:46
问题 A plugin, which works fine in firefox on windows, is being now ported to safari on Mac. we are using Xcode for development. we want a window in safari browser over which a video can be displayed. I read a code regarding NSwindow being used in NPP_SetWindow function as following: NPError NPP_SetWindow(NPP instance, NPWindow* npWindow) { // Get a Cocoa window reference of the browser window NP_CGContext* npContext = (NP_CGContext*)npWindow->window; WindowRef window = npContext->window; NSWindow

window floating above desktop but behind everything else

守給你的承諾、 提交于 2019-12-11 13:07:01
问题 I have my app all setup to do what i want it to do. But there is one thing i can't figure out how to do. How do i make the window appear on the desktop. As in its like on your desktop and it will be above the desktop, but behind everything else. I haven't figured out how to do this... Any ideas?? 回答1: Found the key you are looking for is: kCGDesktopWindowLevelKey, had a look for example and found Re: NSWindow order back and stay, dammit! -Applle mailing list "I think it would be better to do

Resise NSWindow without showing resize button

别等时光非礼了梦想. 提交于 2019-12-11 12:19:29
问题 I would like to have an NSWindow that is resizable but without showing the little green resize button in the top left corner. Is this possible? 回答1: Create custom subclass of NSWindow and override "standardWindowButton: forStyleMask:" class method @interface CustomWindow : NSWindow @end @implementation CustomWindow + (NSButton *)standardWindowButton:(NSWindowButton)b forStyleMask:(NSUInteger)styleMask { NSButton *button = [super standardWindowButton:b forStyleMask:styleMask]; if (b ==

Flipping a Window in Cocoa

人走茶凉 提交于 2019-12-11 04:05:05
问题 How can I flip an NSWindow so I can press a button, and the window will "flip" like on Dashboard and the content view of the NSWindow changes. 回答1: Step 1: Center the window on a vertically-aligned fulcrum. Step 2: Push down on one side. OK, that's not it. ☺ Mike Lee wrote one and put it in the public domain, and Drew McCormack improved it. Rainer Brockerhoff wrote one, too, and put his under an MIT license. So you have your choice. 来源: https://stackoverflow.com/questions/2490069/flipping-a