cocoa

How to click a checkbox in nstableview and update an object using KVC?

Hi all. I am trying to learn cocoa and have a few problems with KVC and bindings. I have a nstableview with three columns; "checkbox", "text", "icon". The values of each column is binded to an arraycontroller using KVC. When program is launched the rows and columns are correctly filled into the tableview according to the values in the ...

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? ...

What's the KVC path for summing UIView subview properties?

I'm trying to calculate the total height of subviews in a UIScrollView: [self.subviews valueForKeyPath:@"[email protected]"]; But that throws the following: 'NSUnknownKeyException', reason: '[<NSConcreteValue 0x4b10170> valueForUndefinedKey:]: this class is not key value coding-compliant for the key size.' I've tried placing ...

Which programming tools techniques have empowered you most?

I'm curious which programming tools have empowered you as the programmer the most. By empower I essentially mean tools have made complex tasks simpler (both conceptually and implementation wise). I am talking about Objective C and Cocoa primarily, although I suppose this question is rather language independent. For instance, before I di...

Boolean as a property in Cocoa

I'm sure that this has been asked MANY times before, but it's still giving me trouble. I define my class's Boolean property like this: @property(readwrite,assign) BOOL namesVisible; And it doesn't give compiler errors, but it NSLogs as (null). Obviously I'm doing something wrong here, but I'm at a loss to what it is. ...

Show background color by NSDatePicker or customized date picker?

I need show different background color for pre-selected dates. (Pic: http://www.flickr.com/photos/hr-chen/5002785937/) Can it be done by NSDatePicker?. ...

Can I monitor other windows' event like resizing, hiding etc from NSNotificationCenter?

Hi guys, I'd like to monitor all windows (include other applications' windows) changes like resizing, hiding, un-hiding etc. I found that if I use [NotificationCenter defaultCenter] , I just receive the event from my own application's window. But how about NSWorkspace's notification center? ...

iPod/iPhone USB Product IDs

Is there a list somewhere of all iProduct USB prodcut ids? I use the IOKit to get notifications for attached/detached USB devices and would like to identify the device. Currently i get the device name and search for "iPod" and "iPhone" but i guess that's not really safe since it could also be an accessory (or could it?). Regards, Erik ...

Wrapping my head around NSTreeController/NSOutlineView

Hey guys, In my application, like many Mac applications, I have a source list. At the moment this is an NSOutlineView bound to an NSTreeController. I can add items to it pretty easily, and have even been able to duplicate the "source list" appearance, with grey all-caps headers and all. There's something that evades me, though, and it's...

Converting (u)int64_t to NSNumbers

So essentially my question is this, I am creating an NSMutableDictionary using uint64_t objects as the key. Is there any better way to create them than doing this? uint64_t bob=7; NSNumber *bobsNumber; #if __LP64__ || TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 bobsNumber=[NSNumber numberWithUnsig...

How would I reverse this equation?

I’m using this equation to convert steps to estimated calories lost. I now need to do the opposite and convert total calories to estimated steps. This is the equation I’m using for steps to calories: +(CGFloat) totalCalories:(NSUInteger)TotalStepsTaken weight:(CGFloat)PersonsWeight{ CGFloat TotalMinutesElapsed = (float)TotalStepsT...

CALayer or CATextLayer with a nsoperationqueue

I have CALayer with an image, to render/calculate the ref of this image needs a lot of time. When I am using an NSOperationQueue to do that and set the layer content in this block the image will not show immediately, it will show after around 2-3 second. I try to set the layer for setNeedsDisplay and so one, but this option seems not be...

Importance of Direction of Control-Drag Operation while Setting Actions in Interface Builder

I have a question regarding the importance of choosing the correct starting and ending points of a control-drag operation while setting actions using Interface Builder (3.2.3). This issue came up while working through an example in an introductory text. In the example project there is a very simple graphical window with a three NSTextF...

NSWindow not Activating

I create a window in a helper tool that runs in the background (it's not an app bundle with a .nib and Info.plist, but a plain executable). When -makeKeyAndOrderFront: is called, the window is displayed but it does not "pop" out like an active window. Can this be fixed? Regards, Erik ...

Why is my table view not displaying my data?

I have a document based application which has two classes, myDocument and Person. The interface consists of a table view for displaying the data and two buttons for adding and removing a peson from the table. The myDocument class is the data source and the delegate. I have the necessary delegate methods implemented but when I click the b...

forKeyPath troubles with Quartz Composer and MacRuby

Hi All, I am having some issues with setting values using MacRuby and Cocoa. I have the inserted the QCView and the QCPatchController into the XIB and loaded the composition into the QCPatchController. Everything is running but I cannot access the published inputs on the QCView. attr_accessor :myQCView #this is bound to the QCControlle...

Problem in copying data of one NSDictionary to another

Hello i am having problem in copying data from one NSDictionary to another i used the [dicForFoodproduct_fromWeb initWithDictionary:dictforfoodproduct]; Here it terminates and says "unrecognized selecter sent to the instance..." I am getting 5 key values in dictForFoodProduct but am unable to copy that key values into dicForFoodProduc...

How to approximate processing time?

It's common to see messages like "Installation will take 10 min aprox." , etc in desktop applications. So, I wonder how can I calculate an approximate of how much time a certain process will take. Off course I won't install anything but I want to update some internal data and depending on the user usage this might take some time. Is thi...

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 ...

How to tell when Cocoa MainMenu controls have been loaded

How can I tell when all of the MainMenu nib controls (primarily the main window) have been loaded? I want to display a sheet on top of the main window at launch, but when I put call beginSheet inside of awakeFromNib, I get an error because no windows have been displayed yet: : kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1 How ...