nsview

Prevent an instance of NSView from receiving mouse events

Hi, I have an NSView in a window with core animation layer turned on. I use this view to display images with animation from time to time. I need the entire view to be the back layer not only the images. Behind this view which I call AnimationBaseView are other views which the user interacts to. Everything is ok except the AnimationBase...

Loading NSView subclass from a XIB

I need to use a custom view into a NSMenuItem. I've created a new view XIB and customized the view in it. How can I load that view and set it in the NSMenuItem using the setView: method? UPDATE: I've found a solution but now the menu item with the custom view doesn't highlight on mouse over. Ho can I solve this problem? ...

Struggling with cocoa view coordinates - selecting intersecting NSRects in NSCollectionView

Hello, I'm trying to subclass NSCollectionView in order to add item padding and eventually work on drag and drop (10.5). I've managed to add the padding but at the loss of the default selection functionality. I've gotten a selection box drawing in the NSCollectionView but I'm having trouble with selecting the items inside the selection ...

drawrect Vs layoutsubvies - NSView - Cocoa touch

Hi, I can't find a decent answer to explain me the difference between these 2 functions. when does every one gets called, and how does one different then the other ? for example , can't I just layout my views inside drawrect ? Thanks ...

Resizing Problem with a Layer-Hosting NSView

I have a layer-hosting NSView (-isFlipped = YES) with three layer-hosting subviews. The subviews are a header, a content area, and a footer. The header has a disclosure triangle which will collapse the content view and just show the header and footer stuck together. I can accomplish this pretty easily with Core Animation, but there is...

Mixing CGLayers and CALayers

Here's the setup: I have a NSView which is a CALayer-backed view, and contains many CALayers. I have a CALayer for the 'background' of the view, and many small CALayers which are sublayers. Sometimes this view can be very big (as large as 2560x1400), and when it does there is a very noticeable lag in the CALayers. My guess is that Core ...

NSView subviews and types

I have a couple of custom NSBox subclasses called OuterBox and InnerBox. I've set up my view in a XIB and arranged the hierarchy like this: OuterBox : NSBox NSButton NSBox InnerBox : NSBox ...and some other views The idea is that when the NSButton gets pressed, in an IBAction method, I want to get the superview of the ...

Send a MouseEvent to a NSView (WebView) from code

Hi Cocoa Developers, i am trying to send mouseevent (MouseClick or RightMouseClick) to a NSView... in my case a WebView, that contains a loaded Website. I want to script some clicks on links etc. How is it possible to create a NSEvent and send it to the WebView to perform clicks? Thanks a lot ksman ...

Cocoa: Does there exist an NSView with user resize capability?

I want an NSView that can be resized by dragging its the bottom right corner around, just like an NSWindow. I want to be able to embed this NSView into a parent NSView. Is there a component like this in Cocoa or any of its extensions? ...

Repeating background image in an NSView.

I am trying to draw a repeating background image in my NSView, I have this till now: // INIT - (id)initWithFrame:(NSRect)frame { if (self = [super initWithFrame:frame]) { self.backgroundImage = [NSImage imageNamed:@"progressBackground.pdf"]; } return self; } // DRAW - (void)drawRect:(NSRect)dirtyRect { // Draw the backgrou...

Loading NSView from NIB won't work.

I have this code to load an NSView from a NIB and add it to another NSView: // INIT - (void)awakeFromNib { // Load nib DNListViewController *listViewController = [[DNListViewController alloc] initWithNibName:@"ListView" bundle:nil]; // Add view to window [listViewController.view setFrame:detailView.frame]; [detailView addSubv...

Reimplementing the Mac OS X Dock's auto hide

I'm trying to make a server monitor in Objective-C, that behaves kind of like the dock on Mac OS X. I'm hoping to have it slide from the side of the screen when the mouse is moved to a side of the screen, kind of like a dock with auto hide on. I'm not sure where to start though. I'm guessing I need to have a window with a NSBorderlessWi...

NSView high-level overview?

I am trying to create a custom view and load it into a window. In the end, I know there will be a few steps to follow, reflecting the key relationships that I am missing. I am hoping someone can explain, in a series of steps, how one creates a view object, view controller, associated .xib, and then loads it into a window (after clearin...

How can i forbid tab switching the focus into a NSView control

I have a sidebar NSOutlineView in my main window. I want the user to be able to switch the focus with the tab key through all views in the main window, but he should not be able to give the NSOutlineView the focus with a tab key. I know that with - (BOOL)canBecomeKeyView { return NO; } - (BOOL)acceptsFirstResponder { return NO; } i ...

How to draw a NSView on a NSView?

Hello! I have a question: I am passed a NSView from a class and I need to add on another NSView at a certain point. How do I do that? Thanks in advance. ...

Adding an NSProgressIndicator to the dock icon.

I'm creating an application which should show a progress bar in the dock icon. Currently I have this, but it's not working: NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)]; [progressIndicator setStyle:NSProgressIndicatorBarStyle]; [progressIndicator setIndet...

Annoying Bump Sound with Keyboard Events in NSOpenGLView subclass

I've overridden an NSOpenGLView to handle keyboard events. The event detection is working fine, but every time I press a key I hear and annoying bump sound. How can I tell my view to chill out? Here's what my keyUp: method looks like: -(void) keyUp:(NSEvent *)theEvent { NSString *characters = [theEvent charactersIgnoringModifiers...

readFromData:ofType:error: called before loading nib so I can't use my IBOutlets D:<

I have an application that uses NSDocument to open files. I have an NSView in my NIB, and I'd like to set it's size according to the image opened: - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { NSLog("FOO"); // Load image // ... // Change size [mainView setFrameSize:NSMakeRect(ima...

How to magnify an NSView?

I'm trying to magnify (zoom) an NSView like zooming in Preview.app, but I can't find anything helpful on the internet. Can anyone help me? Thanks. Oh, my NSView is in an NSScrollView. ...

How to create an NSImage from an NSView that isn't completely visible?

I have an NSView in an NSScrollView that I want to create an NSImage from. Because it's in an NSScrollView it's not always completely visible, and it can be even bigger that the screen's size. Can anyone help me? Thanks. ...