problem about nswindow-Collection of common programming errors


  • NobleK
    objective-c cocoa nswindow
    I have an borderless subclass of NSWindow with custom graphics with rounded corners:MyCustomWindow:- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];if (self) {// Start with no transparency for all drawing into the window[self setAlphaValue:1.0];// Turn off opacity so that the p

  • Moshe
    objective-c osx gui skinning nswindow
    How do I make custom buttons for my app window on OSX? I’d also like to skin the entire window.Are there any easy classes or ways to do this? Any tutorials that show how?

  • Sjoerd van Geffen
    objective-c cocoa nswindow
    My Cocoa app needs some small dynamically generated windows. How can I programmatically create Cocoa windows at runtime?This is my non-working attempt so far. I see no result whatsoever.NSRect frame = NSMakeRect(0, 0, 200, 200); NSUInteger styleMask = NSBorderlessWindowMask; NSRect rect = [NSWindow contentRectForFrameRect:frame styleMask:styleMask];NSWindow * window = [[NSWindow alloc] initWithContentRect:rect styleMask:styleMask backing: NSBackingStoreRetained defer:false]; [window setBa

  • Nitin Bhatt
    objective-c nswindow nsdocument
    I am trying to change the proxy icon of a document window at runtime using[[[self window] standardWindowButton:NSWindowDocumentIconButton] setImage:img];This is getting executed but the setting in info.plist is overriding this.What is the right place to call this.

  • j yrez
    runtime-error nswindow setbackground
    I added a background color to the window of a well-running simple draw project and build succeeded. Then the fun began: runtime errors appeared in the console window. I found no help in Apple docs and Google. When the same happened in another draw project, I knew I had to ask for help.Here’s what happened each time I did a build & debug and stop — runs 1) through 4). “continue” means I clicked the Continue icon. It kept on erring in no consistent order.1)Program received signal:”EXC_BAD_ACC

  • justin
    osx cocoa nsview nswindow appkit
    I have a problem understanding how to initialize a view without hooking it up in my nib-file. So what I want to do is, instead of dragging in a view and assigning it a dedicated class, I want to programmatically add it to my window in my app delegate. I don’t really know how wrong this is, but I tried something like this in my AppDelegate: – (void)applicationDidFinishLaunching:(NSNotification *)aNotification {DView *dV = [[DView alloc]initWithFrame:NSMakeRect(0, 0, 1000, 600)];[self.window addS

  • Irwan
    cocoa osx nswindow
    I tried this but my program crashed.- (void)windowWillClose:(NSNotification *)notification {[modalWindow orderOut:self];[NSApp stopModal]; }Thanks in advance.

  • Shog9
    objective-c webview nswindow
    I have a WebView in a NSWindow and when I close the window and open it again the app crashes ;(The window is called by a menu item button.Here is the output:2011-10-22 15:55:32.440 Textis[17176:903] -[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90 2011-10-22 15:55:32.544 Textis[17176:903] HIToolbox: ignoring exception ‘-[__NSCFType mainFrame]: unrecognized selector sent to instance 0x100514e90’ that raised inside Carbon event dispatch ( 0 CoreFoundation 0x00007fff838

  • Aleks
    c++ objective-c nswindow objective-c++ nswindowcontroller
    I’m currently building a C++ plugin for some software, which, when the relevant function is called, displays a nib which I built in XCode. Up until today everything has been working fine, displaying and working with the nib / Objective-C++ / C++ has caused no problems.However out of the blue everything started crashing at the call to show the preferences dialog. I’ve narrowed the crashing code down to this line:PreferencesWindowController *prefsWindowController = [[PreferencesWindowController al

  • user1139069
    objective-c cocoa crash nswindow
    I’m trying to create a full screen window to contain a core profile opengl viewNSScreen *screen = [[NSScreen screens] lastObject]; NSRect displayRect = [screen frame];NSOpenGLPixelFormatAttribute attr[] = {NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,NSOpenGLPFAColorSize, 24,NSOpenGLPFAAlphaSize, 8,NSOpenGLPFAAccelerated,NSOpenGLPFADoubleBuffer,NSOpenGLPFAMultisample,NSOpenGLPFASampleBuffers, 1,NSOpenGLPFASamples, 4,0 };NSOpenGLPixelFormat *pix = [[NSOpenGLPixelFormat al

  • user2110045
    objective-c cocoa nsview nswindow
    I have an NSWindow with 2 NSViews (an NSSplitView and a custom NSView). Accessing the data to populate these views can take some time. During this period, I’d like to gray out the content of these views. My first approach was to have a black third NSView that covered the other 2 and achieve the graying out effect by changing its alpha value. However I’ve since learned having a hierarchy with sibling views is undefined. What is the best approach here?Cache the NSBitmapImageRep of the 2 views, the

  • brigadir
    initialization nib nswindow iboutlet
    I show modal subclassed window:NSWindowController* controller = [[NSWindowController alloc] initWithWindowNibName: @”MyWindow”]; [NSApp runModalForWindow: [controller window]];And I override initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag in my window subclass to setup children views which are linked to nib file. But these children are not initialized at this moment (are nil).Where to place my initialization code?

Web site is in building