Re: Core Data and +[NSExpression expressionForFunction:...]

2009-11-29 Thread Ron Aldrich
I'm left wondering "Under what circumstances would +[NSExpression expressionForFunction:selectorName:arguments:] be useful. An example would be helpful, but I sure wasn't able to find one. Meanwhile, I switched to a simple bounds check, which works just fine. Thanks for your time. - Ron On No

Re: Defining and using constants in Objective C

2009-11-29 Thread Kenny Leung
Hi Tharindu. I would create two files: Constants.h and Constants.m. Just like all C code, you put your declarations in the .h and the definitions in the .m. They are going to be very similar, except the .m defines the values, so it only happens once. This is very important if you want to be abl

Re: How to draw text to bitmap (array) with pre 10.5 libs

2009-11-29 Thread John Horigan
On Nov 29, 2009, at 9:09 PM, Graham Cox wrote: > > On 30/11/2009, at 2:44 PM, Glenn McCord wrote: > >> What I'm expecting is the drawAtPoint method to draw nsString inside >> the bitmapRep of the NSContext at which point I can retrieve the raw >> data and do something with it. On account of th

Re: How to draw text to bitmap (array) with pre 10.5 libs

2009-11-29 Thread Graham Cox
On 30/11/2009, at 2:44 PM, Glenn McCord wrote: > What I'm expecting is the drawAtPoint method to draw nsString inside > the bitmapRep of the NSContext at which point I can retrieve the raw > data and do something with it. On account of the data all being zero, > I'm obviously doing something wro

Re: troubles with tableview

2009-11-29 Thread Graham Cox
On 29/11/2009, at 10:23 PM, Dorimedont Bancescu wrote: > but when I try to load the data from the disk in > -(id) initWithCoder:(NSCoder*) encoder I see the NSMutableArray loaded with > all data but in > -(int) numberOfRowsInTableView:(NSTableView*) tableView the array is emtpy > and I cannot s

How to draw text to bitmap (array) with pre 10.5 libs

2009-11-29 Thread Glenn McCord
Hi. I've been hunting around trying to find a way of drawing text to context so that I can then retrieve the image data as an array of bytes. I would like to support OSX 10.4, so my original (working code) won't do. Unfortunately though, I'm getting zeros for data, probably from totally misinterpre

troubles with tableview

2009-11-29 Thread Dorimedont Bancescu
Hi all, I try to create a very simple list of persons that will be displayed in a NSTableView. I have a few options like: save the list using NSArchive, load a list from the disk, adding, removing entries. The data source is a NSObject subclass which implements: -(int) numberOfRowsInTableVi

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
Thank you all, it cleared things up quite a bit. Best regards. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.ap

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Graham Cox
On 30/11/2009, at 1:35 PM, Jason Stephenson wrote: > NSDocument doesn't merely represent the document's data as in a "pure" MVC > design, rather it is a controller for the document's data. The subsection of > the Document-Based Applications Overview entitled "The Role of NSDocument" > makes th

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Jason Stephenson
Graham Cox wrote: On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: NSDocument and the document-based architecture in Cocoa is a bad example of MVC. As a statement that doesn't really stand up to scrutiny. Sure, you can abuse NSDocument and violate MVC, but as it comes it does not. A docum

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Waqar Malik
UIImage is cached but CGImage is not, and creating the byte array every time is memory thrashing you should create the bytes array only when the image changes specially if you calling this in a loop. --Waqar On Nov 29, 2009, at 6:14 PM, Chunk 1978 wrote: > also, i'm planning on calling the x a

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Chunk 1978
also, i'm planning on calling the x and y thru UITouch methods, and i'm concerned that calling this method that converts a UIImage into a CGImage repeatedly is both bad practice and extremely processor intensive. the image shouldn't change (or change very rarely). is the CGImage cached automatica

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Bill Garrison
On Nov 29, 2009, at 6:58 PM, Sandro Noël wrote: From what I read the MyDocument Class is supposed to be a model controller, not the window controller. The MyDocument Class is supposed to be able to host an array of window controllers. NSDocument has the capability to host an array of windo

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Chris Hanson
On Nov 29, 2009, at 5:47 PM, Sandro Noël wrote: I have to agree with you here, NSDocument should be just M in the MVC Pattern, but why is XCode evidently binding it as the C also in the template project. Because not every project needs to be picture perfect in its use of various design

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Waqar Malik
Then you should send count as 1, then you will get number of pixels starting at location xx, and yy. If you want to pixels worth of data then send 2, you should not be sending who 50*100. If you want the pixel data for who image then you would do xx = yy = 0 and count would be 50*100. --Waqar

Re: Keyword @defs

2009-11-29 Thread Bill Bumgarner
On Nov 29, 2009, at 4:21 PM, Oftenwrong Soong wrote: > What exactly is this @defs keyword supposed to do? It effectively turned an Objective-C class declaration into a standard C structure such that you could access the instance variables directly via a simple -> operator. Was mostly used fo

Re: I can't supply document reference to (init) with bindings, can I?

2009-11-29 Thread David Hirsch
Hi Graham- Getting the object's document model is precisely what my goal is. I realize that the currentDocument is a bad way to get this (and I more or less said that in the OP, but perhaps not clearly enough), but without some special magic, how am I to get a document reference to the o

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
On 2009-11-29, at 8:18 PM, Graham Cox wrote: > > On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: > >> NSDocument and the document-based architecture in Cocoa is a bad example of >> MVC. > > > As a statement that doesn't really stand up to scrutiny. Sure, you can abuse > NSDocument and vi

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Chunk 1978
humm... now i'm getting confused. that method returns an array of UIColor objects for each pixel in the CGImage. but how am i receiving the object atX:andY by imputing those values into the method? if i'm searching for a read-only value to output an NSLog of [UIColor colorWithRed:green:blue:alph

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Waqar Malik
Yes, that is then number of pixels, but do you really need that, as the width and height would be the same, check those values as well. --Waqar On Nov 29, 2009, at 5:13 PM, Chunk 1978 wrote: > humm... while i understand most of this method, i don't understand > what is passed as "count"? i unde

Re: Keyword @defs

2009-11-29 Thread Ken Thomases
On Nov 29, 2009, at 6:07 PM, James Pengra wrote: The class Foo has a number of variables defined in its header. In the code file Foo.m, and.preceding the @implementation block, the following structure is defined: typedef struct { @defs(Foo); } getFoo; Al

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Graham Cox
On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: > NSDocument and the document-based architecture in Cocoa is a bad example of > MVC. As a statement that doesn't really stand up to scrutiny. Sure, you can abuse NSDocument and violate MVC, but as it comes it does not. A document might own

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Chunk 1978
humm... while i understand most of this method, i don't understand what is passed as "count"? i understand that this will convert a UIImage into a CGImage, and store each pixel of the image into an array, which are indexed by "xx" and "yy" variables. but what is count? is count the total number

Re: Apple MVC and Document Based application confusion.

2009-11-29 Thread Jason Stephenson
Sandro Noël wrote: Hello. I'm reading COCOA Design Patterns from Eric M. Buck & Donald A. Yacktman. and i'm having a hard time applying the principle in my architecture. for example, if i create a new document based application in XCode, the MyDocument xib file binds the window outlet to the M

Re: I can't supply document reference to (init) with bindings, can I?

2009-11-29 Thread Graham Cox
On 30/11/2009, at 10:31 AM, David Hirsch wrote: > I'm trying to use bindings as much as possible, but I think I need to do this > with actions & outlets. I have a NSArrayController (courseController) > managing an NSMutableArray (courses) of Course objects. In order to > correctly initialize

[MEET] [Sydney] December CocoaHeads - Christmas drinks and Push notifications

2009-11-29 Thread Mark Aufflick
First Thursday of the month == one of CocoaHeads Sydney or NSCoder Sydney. For December, our last meeting of the year and the last until February, we're having a short presentation on getting iPhone APNS Push notifications working on the phone and the server (by me), followed by Christmas drinks.

Re: Keyword @defs

2009-11-29 Thread Oftenwrong Soong
James, What exactly is this @defs keyword supposed to do? -Soong - Original Message From: James Pengra To: cocoa-dev@lists.apple.com Sent: Sun, November 29, 2009 4:07:11 PM Subject: Keyword @defs Consider the following situation I found in a Cocoa program to simulate a sine wav

Keyword @defs

2009-11-29 Thread James Pengra
Consider the following situation I found in a Cocoa program to simulate a sine wave generator: The class Foo has a number of variables defined in its header. In the code file Foo.m, and.preceding the @implementation block, the following structure is defined: typedef struct

Apple MVC and Document Based application confusion.

2009-11-29 Thread Sandro Noël
Hello. I'm reading COCOA Design Patterns from Eric M. Buck & Donald A. Yacktman. and i'm having a hard time applying the principle in my architecture. for example, if i create a new document based application in XCode, the MyDocument xib file binds the window outlet to the MyDocument Class. Fr

Re: I can't supply document reference to (init) with bindings, can I?

2009-11-29 Thread Dave Carrigan
On Nov 29, 2009, at 3:31 PM, David Hirsch wrote: > So: is there some tricky way to have the "add new course" button tell the > courseController to add a new Course, but somehow call a custom init (like > init:withDocument:) and supply some reference to the current document? I > doubt it, but

I can't supply document reference to (init) with bindings, can I?

2009-11-29 Thread David Hirsch
I'm trying to use bindings as much as possible, but I think I need to do this with actions & outlets. I have a NSArrayController (courseController) managing an NSMutableArray (courses) of Course objects. In order to correctly initialize each Course, I need to have data from other arrays (

Re: Appropriate Use of NSFormatter?

2009-11-29 Thread Graham Cox
On 30/11/2009, at 7:44 AM, Jericho Hasselbush wrote: > I've been considering the best way to integrate user's choice of units in my > app (metric and standard) and have yet to figure out a clean way of doing it. > > I am considering using a custom formatter that will change it's behavior > bas

Re: Appropriate Use of NSFormatter?

2009-11-29 Thread Alastair Houghton
On 29 Nov 2009, at 20:55, Keary Suska wrote: > Probably better to use an NSValueTransformer, which gives you reverse > transformation as well. So does NSFormatter, FWIW. It's the "old school" way to do this kind of thing. That said, I wouldn't make a custom NSFormatter that uses a global varia

Re: Appropriate Use of NSFormatter?

2009-11-29 Thread Keary Suska
On Nov 29, 2009, at 1:44 PM, Jericho Hasselbush wrote: > I've been considering the best way to integrate user's choice of units in my > app (metric and standard) and have yet to figure out a clean way of doing it. > > I am considering using a custom formatter that will change it's behavior > ba

Appropriate Use of NSFormatter?

2009-11-29 Thread Jericho Hasselbush
I've been considering the best way to integrate user's choice of units in my app (metric and standard) and have yet to figure out a clean way of doing it. I am considering using a custom formatter that will change it's behavior based on a globally accessible variable holding the type of system -

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Chunk 1978
precisely! thanks for this. On Sun, Nov 29, 2009 at 1:24 PM, Waqar Malik wrote: > I think this is what you are looking for. > > < > http://stackoverflow.com/questions/448125/how-to-get-pixel-data-from-a-uiimage-cocoa-touch-or-cgimage-core-graphics > > > > On Nov 29, 2009, at 10:17 AM, Chunk 197

Re: RGBA UIColor Information At CGPoint?

2009-11-29 Thread Waqar Malik
I think this is what you are looking for. On Nov 29, 2009, at 10:17 AM, Chunk 1978 wrote: > what method, or combination of methods can i use to receive color > information of a C

RGBA UIColor Information At CGPoint?

2009-11-29 Thread Chunk 1978
what method, or combination of methods can i use to receive color information of a CGPoint. i can get basic coordinates of a view using UITouch's locationInView method, but i'd like to get an RGBA color information output. what methods or example code from apple should i research? ___

Re: Animating color fading

2009-11-29 Thread Jens Alfke
On Nov 27, 2009, at 8:03 AM, Steve Moore wrote: > I think this is really a color question, though I'm not sure. I figured I'd > just set a timer and redraw the cell (drawInteriorWithFrame: inView: ) > applying an ever decreasing alpha but this just results in the cell > eventually being drawn

Re: Defining and using constants in Objective C

2009-11-29 Thread Jens Alfke
On Nov 29, 2009, at 9:30 AM, Tharindu Madushanka wrote: > When defining constants can I keep all important constants in one file and > use it all over the application, rather defining same constant in several .m > files. This might be a basic question, but just could not figure out how to > do th

Re: Defining and using constants in Objective C

2009-11-29 Thread Nick Zitzmann
On Nov 29, 2009, at 10:30 AM, Tharindu Madushanka wrote: > When defining constants can I keep all important constants in one file and > use it all over the application, rather defining same constant in several .m > files. Of course. You don't need to define classes or functions in source files,

Defining and using constants in Objective C

2009-11-29 Thread Tharindu Madushanka
Hi When defining constants can I keep all important constants in one file and use it all over the application, rather defining same constant in several .m files. This might be a basic question, but just could not figure out how to do this. Thank you Tharindu Madushanka ___

Re: Button width should accomodate localized string

2009-11-29 Thread glenn andreas
On Nov 29, 2009, at 9:38 AM, Symadept wrote: > Hi, > > How can I scale my button or Label to be able to accomodate the localized > string? > > Any clues. > > Regards > symadept That's the whole purpose of being able to localize the nib/xib... Glenn Andreas gandr...@gand

Re: Button width should accomodate localized string

2009-11-29 Thread Jerry Krinock
On 2009 Nov 29, at 07:38, Symadept wrote: > How can I scale my button or Label to be able to accomodate the localized > string? -[NSControl sizeToFit] However, to my eye the result you get from that, in a regular rounded button, looks a little cramped. So I use my own method which invokes th

Help needed on font for localized app

2009-11-29 Thread Symadept
Hi, My client has given me a custom TTF font only for English. So my intention is to load that TTF only for English and for other languages it should fallback to the available System font. I am doing the following steps: 1. Registering fonts with my app. Copying into Resources folder and add

Button width should accomodate localized string

2009-11-29 Thread Symadept
Hi, How can I scale my button or Label to be able to accomodate the localized string? Any clues. Regards symadept ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

NSTableView able to show various controls

2009-11-29 Thread Symadept
Hi, I want to so NSTextFieldCell in idle state for the one Column in TableView. When this cell is clicked for editing I would like to show a NSComboBoxCell. How can I achieve this task. I tried with all the possibilities like - ( NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(

Re: DADiskMount usage

2009-11-29 Thread Francis Devereux
On 29 Nov 2009, at 11:12, Zephyroth Akash wrote: > Hi, > > I need some help to understand what the user-defined context is. The context is simply a value that will be passed to your callback function (mountApprovalCallback() in the code you posted). You can just pass nil (which will cause nil

Re: Polymorphic relationship and migration

2009-11-29 Thread Quincey Morris
On Nov 27, 2009, at 17:14, Yi Lin wrote: > For example, if I have a relationship called "shape" that refers to the Shape > abstract entity, with concrete classes Triangle, Square, etc. In the mapping > model, there's no sensible setting for the Mapping Name field of "shape". If > I set the Mapp

DADiskMount usage

2009-11-29 Thread Zephyroth Akash
Hi, I need some help to understand what the user-defined context is. Here's the code actually: - (void)mountPartition:(char *)diskName atPath:(NSString *)path { DASessionRef session = NULL; DADiskRefdisk = NULL; CFURLRef url = NULL;

Polymorphic relationship and migration

2009-11-29 Thread Yi Lin
Hi All, I ran into a issue where polymorphic relationship is not maintained by the automatically-generated Core Data mapping model. For example, if I have a relationship called "shape" that refers to the Shape abstract entity, with concrete classes Triangle, Square, etc. In the mapping mo

Animating color fading

2009-11-29 Thread Steve Moore
Hello. I'm not making much progress on this by myself so I thought I'd ask for a helping hand. I am writing a small app for my 5 year old. In it I've got a 10 x 10 matrix with a custom NSCell prototype. He is asked a question and is required to click on the correct NSCell(s). If he clicks