Re: Generating random numbers

2009-08-06 Thread Mac First
Not strictly Cocoa, but a trick I recently incorporated to remove the mod-bias is (email code): float frand = (random() * 1.0) / (RAND_MAX * 1.0); // gives 0.0-0.9... int myRand = frand * 15; // to get a number from 0-14, inclusive. On Aug 6, 2009, at 9:12 AM, Jeremy Pereira wrote: T

Re: mouse entered/exited in nscollectionviewitem's view

2009-07-26 Thread Mac First
On Jul 25, 2009, at 9:42 AM, Benjámin Salánki wrote: hm, a quick answer to my own question: inserting [self performSelector:@selector(updateTrackingAreas) withObject:nil afterDelay:0.01]; into scrollWheel: seems to fix my problem. I missed the rest of the thread, so may be out of school

Re: TableView displaying a zillion empty rows

2009-07-08 Thread Mac First
On Jul 8, 2009, at 12:31 AM, Andy Lee wrote: if ([[aTableColumn identifier] isEqualTo: @"firstName_"] == YES) returnValue = [player firstName_]; else if ([[aTableColumn identifier] isEqualTo: @"lastName_"]) returnVa

Re: Solved: Not receiving notifications on NSArrayController selection changes

2009-07-06 Thread Mac First
On Jul 5, 2009, at 10:18 PM, Ken Tozier wrote: Never mind. I figured it out. Just catching up after a few days away from the list, and I see several messages of the general form: thanks, I figured it out or ok, I found the problem or similar. As these messages get indexed by Google a

Re: NSString stringWithFormat: and strings

2009-07-04 Thread Mac First
On Jul 3, 2009, at 8:27 PM, Andy Lee wrote: On Jul 3, 2009, at 11:20 PM, KK wrote: Hello, I have a NSString (from a property list file) that has the %@ formats in it... So.. I do something like this: NSString *stringFromPlistFile; NSString *newString = [NSString stringWithFormat:stringFrom

probablem with NSView redisplay.

2009-07-02 Thread Mac First
I have an NSWindowController driving a window, with a view, with subviews. One of the subviews is an NSView *imageParentView. This view's only purpose is to provide a frame, a "bounding box" inside which its subview will be held. It's one and only subview is NSImageView *imageView. The

Re: warning:assignment from distinct Objective-C type

2009-07-02 Thread Mac First
On Jul 1, 2009, at 9:34 AM, Ken Thomases wrote: On Jul 1, 2009, at 11:26 AM, David Blanton wrote: in .h file NSMutableArray *m_sources; [...] m_sources = [volumes stringsByAppendingPaths:[defaultManager directoryContentsAtPath:volumes]]; -stringsByAppendingPaths: returns a

File-picker dialog?

2009-06-18 Thread Mac First
Sorry to be so out of touch -- it's been a while... Is NavServices still the preferred way to put up, say, a file-picker dialog? That is, is The Cocoa Way to do this: OSStatus NavCreateChooseFileDialog ( const NavDialogCreationOptions *inOptions, NavTypeListHandle inTypeList, NavEventUPP i

Re: to NIB or not to NIB

2009-06-16 Thread Mac First
On Jun 15, 2009, at 3:56 AM, Chunk 1978 wrote: what are your thoughts? are developers who don't use IB masochists, or is it a wise choice? IB is a power tool, and a fairly decent one. It has matured quite a bit over the years and can make short work of a lot of otherwise long & tedious

Re: Coming up with ideas

2009-06-13 Thread Mac First
On Jun 12, 2009, at 7:30 PM, Development wrote: Hey, how do you guys come up with ideas for new programs? I'm going nuts trying to figure out what type of application I should make. Make something that *YOU* would want. What problem do YOU have that can be solved with a program? Write tha

Re: Displaying an offset image. (SOLVED)

2009-06-11 Thread Mac First
Sheesh! I'm sorry -- I guess I just need to learn to read. --- "Translates the receiver’s coordinate system so that its origin moves to a new location. [I stopped reading here and got confused. The Discussion section explains all.] - (void)translateOriginToPoint:(NSPoint)newOr

Re: Displaying an offset image. (Partial fix)

2009-06-11 Thread Mac First
oint(CGPointZero)]; does *NOT* put things back to their starting position! I'm getting close -- about what else do I need to know? Thanks! On Jun 11, 2009, at 5:32 PM, Mac First wrote: I have a 500x500 image. It's really a 5x5 array of 100x100 image tiles. I have a 100x100 NSView,

Displaying an offset image.

2009-06-11 Thread Mac First
I have a 500x500 image. It's really a 5x5 array of 100x100 image tiles. I have a 100x100 NSView, imageParentView. I have a 500x500 NSImageView ("image well" in IB), "imageView" that is a subview of imageParentView and which holds my image. I'd like to display the 3rd tile in the 2nd row, so

Re: Weird race condition affecting bindings.

2009-06-11 Thread Mac First
On Jun 11, 2009, at 10:20 AM, Quincey Morris wrote: On Jun 11, 2009, at 07:43, Mac First wrote: I can change things around to do them in a different order and get the error to come out for key 'KEY' instead of 'IMAGE', but it's basically the same problem. I

Weird race condition affecting bindings.

2009-06-11 Thread Mac First
I have what looks like an odd race condition surrounding my bindings. I have an NSCollectionView that is a list of images. I believe all of the bindings to be hooked up correctly (and code-reviewed by 2 other engineers familiar with NSCollectionViews.) Some code snippets: --- @i