Re: Transparent image

2009-02-11 Thread Rob Keniger


On 11/02/2009, at 5:11 AM, Christian Graus wrote:

Thanks - that's pretty much what I am going to do.  I will move the  
objects

that need transparency to NSImageView today, and then once we get this
version out for demo purposes, I will start rewriting the tools I  
needed

from IKImageView.
Shame, really, I've wasted days on IKImageView.  The docs don't  
really tell
you that they don't support transparency, that I can see.  I also  
can't see
why it can draw a grid behind the image, but won't let me specify  
the bitmap
to draw behind it, surely that would be trivial for the authors of  
the class

to do.



Please file a bug and request this functionality.

--
Rob Keniger



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Binding to custom NSCell

2009-02-11 Thread Ken Tozier

Hi

I created a custom NSCell subclass, defined accessors for stringValue,  
setStringValue, objectValue ane setObjectValue. I set the data cell  
for a column like so:


[column setDataCell: customCell];

And bind the column to an array controller:

[column bind: @value toObject: controller withKeyPath:  
@arrangedObjects.name options: nil];


When I run my app, I get a crash with the following error:

An uncaught exception was raised
[NSTableColumn 0x13f880 valueForUndefinedKey:]: this class is not  
key value coding-compliant for the key value.


Which I found rather odd because the exact same binding works when the  
cell type is an NSTextFieldCell


I then explicitly defined value and setValue accessor for the  
cell, and got the exact same crash and error message. I Googled and  
found this thread http://lists.apple.com/archives/Cocoa-dev/2006/Jan/msg00646.html 
 but it just seemed to go off on a bunch of tangents without stating  
the solution.


Clearly, Apple is doing something in their predefined NSCell  
subclasses to supply values that is not immediately clear from reading  
(and reading and reading and reading...) the documentation


So in simple terms, how do I supply the info required by the bind  
method of a table column? Exact assessor names don't work. Exact  
property names don't work. What's the secret?


Thanks for any help
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda
I call

ProcessInformationCopyDictionary
(psn, kProcessDictionaryIncludeAllInformationMask);

but if the application has moved since it was launched, the result of this
call in the CFBundleExecutable and BundlePath keys is wrong. The values
contain the original location of the application.

So...
NSString *bundlePath = [dict objectForKey:@BundlePath];
if (bundlePath)
{
   bundle = [NSBundle bundleWithPath:bundlePath];
}

Does not work.

How can I get the real current location of a file from the Process Serial
Number?

I need to do this because my app is a system pref pane and when one installs
a pref pane over the top of an existing one, the existing one is
automatically moved to a tmp location by System Preferences. I need to
determine if the running helper app is a different version form the one
being installed... And need to get at the help app's bundle.

I suppose I could assume that if I can't obtain a real location for the
running helper app, that it has been moved and I should send a quit
AppleEvent to it, but this doesn't seem like the best way.

Any ideas?

Thanks,

Trygve


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: A Mac App helper NSStatusItem - how to share preferences

2009-02-11 Thread Trygve Inda
 Steve Cronin (steve_cro...@mac.com) on 2008-12-28 8:41 PM said:
 
 I have an application which will have an optional helper NSStatusItem.
 The statusItem is a stand-alone application which can be installed as
 a LoginItem.
 
 I want this status item to be able to read the preferences file from
 the application.
 
 No need to drop to CFPreferences.  Let's say your 2 bundle identifiers
 are com.cronin.mainapp and com.cronin.helper.
 
 In your helper app, just do this:
 
 NSUserDefaults* sud = [NSUserDefaults standardUserDefaults];
 [sud addSuiteNamed:@com.cronin.mainapp];
 
 Sean

In my helper app I use:

userDefaults =
[[NSUserDefaults standardUserDefaults]
persistentDomainForName:kMainAppIdent];

You just need to make sure there is no chance of the helper and the host
writing at the same time to the same file.

Trygve


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 11:43, Trygve Inda a écrit :


I call

ProcessInformationCopyDictionary
(psn, kProcessDictionaryIncludeAllInformationMask);

but if the application has moved since it was launched, the result  
of this
call in the CFBundleExecutable and BundlePath keys is wrong. The  
values

contain the original location of the application.

So...
NSString *bundlePath = [dict objectForKey:@BundlePath];
if (bundlePath)
{
  bundle = [NSBundle bundleWithPath:bundlePath];
}

Does not work.

How can I get the real current location of a file from the Process  
Serial

Number?

I need to do this because my app is a system pref pane and when one  
installs

a pref pane over the top of an existing one, the existing one is
automatically moved to a tmp location by System Preferences. I need to
determine if the running helper app is a different version form the  
one

being installed... And need to get at the help app's bundle.

I suppose I could assume that if I can't obtain a real location for  
the

running helper app, that it has been moved and I should send a quit
AppleEvent to it, but this doesn't seem like the best way.

Any ideas?

Thanks,

Trygve




I think it exists a standard Apple Event to retrieve a process  
version. (get «vers»)


But you can also add a custom get version Apple Event handler to  
your helper and use it to retrieve the version from your pref pane.






___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda

 
 I think it exists a standard Apple Event to retrieve a process
 version. (get «vers»)
 
 But you can also add a custom get version Apple Event handler to
 your helper and use it to retrieve the version from your pref pane.

This works great for future versions, but not existing ones. I'll look at
the AE vers.

Thanks,

Trygve


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Trygve Inda

 I think it exists a standard Apple Event to retrieve a process
 version. (get «vers»)
 
 But you can also add a custom get version Apple Event handler to
 your helper and use it to retrieve the version from your pref pane.


Hmmm... It seems keyAEVersion ('vers') only gets the version info for the
Apple Event Manager, not the target process.

Trygve


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 12:54, Trygve Inda a écrit :




I think it exists a standard Apple Event to retrieve a process
version. (get «vers»)

But you can also add a custom get version Apple Event handler to
your helper and use it to retrieve the version from your pref pane.



Hmmm... It seems keyAEVersion ('vers') only gets the version info  
for the

Apple Event Manager, not the target process.

Trygve



Using AppleScript, you can test what it returns.

tell app your application to get version

AFAK, it just sends a get vers event.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Possible to change value transformer for binding at runtime?

2009-02-11 Thread Keith Duncan
is there a way to change the value transformer used for a binding at  
runtime?


You could write an NSProxy subclass to stand in for a given value  
transformer - register it instead of the actual value transformer.  
Then when you need to change the transformation grab it from the  
NSValueTransformer class method, cast back to your proxy and send the  
right message to change it's target.


Keith
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 12:46, Trygve Inda a écrit :





I think it exists a standard Apple Event to retrieve a process
version. (get «vers»)

But you can also add a custom get version Apple Event handler to
your helper and use it to retrieve the version from your pref pane.


This works great for future versions, but not existing ones. I'll  
look at

the AE vers.



If the helper app does not respond to your get version request, so you  
can assume it is an older version than the one installed.



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How resize a button or label to fit its content (at runtime)?

2009-02-11 Thread Oleg Krupnov
Is there a way to programmatically resize a button or text field to
fit its contents exactly? I can do it in the Interface Builder, but I
need to do it at runtime. Thanks!
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Clint Shryock
in order for modelObject1 to talk to modelObject2, it must have
a reference to that object, similar to how myControllerObject has a
reference to both modelObject1 and modelObject2 which you use to send
messages.
+Clint

On Wed, Feb 11, 2009 at 8:42 AM, Jason Wiggins jwigg...@optusnet.com.auwrote:

 Hi all,

 Can someone please help me with this, I'm tearing my hair out!

 Say I have myControllerObject. I alloc and init modelObject1 and also
 modelObject2.
 How do I access the ivars of modelObject1 from modelObject2 and vice versa?

 modelObject1 and modelObject 2 both exist somewhere in memory, so how do I
 get a pointer to or make a connection between these two object?

 Also, how do I access the ivars of myControllerObject from either
 modelObject1 or modelObject2?

 Is it possible to find out from myObject1 or myObject2 who init and alloc
 them?

 From what I've read to far (Objective C-2.0 Programming Language and Cocoa
 Fundamentals Guide) I've been unable to find the answer to these questions.
 I can send messages from myControllerObject to myObject1 or myObject2 and
 get returned information no worries, that I do get.

 Thanks,

 Regards,
 Jason
 ___

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cts3e1%40gmail.com

 This email sent to cts...@gmail.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread I. Savant
 Say I have myControllerObject. I alloc and init modelObject1 and also
 modelObject2.

 How do I access the ivars of modelObject1 from modelObject2 and vice versa?

 modelObject1 and modelObject 2 both exist somewhere in memory, so how do I
 get a pointer to or make a connection between these two object?

  This is more of an Object Oriented Programming question in general
and you'll probably do better to look for answers in places that cover
this topic, rather than Cocoa specifically. However ...

  You need to think about pointers. Say your ModelObject is a person.
You designed it to have a firstName and a lastName property. The
iVars would be:

NSString * firstName;
NSString * lastName;

  ... you'd have accessors so that other objects can ask:
[modelObject1 lastName]... and so on. These (first/last name
ivars) are pointers to other objects (strings).

  So if you understand that, why the struggle with the idea of having
a pointer to *another* object you want to get to? If your controller
needs to access a model object, it needs a pointer to get to it. In
your case, it sounds like your controller will be managing multiple
ModelObject instances, right? So it should have a container in which
to keep them. In that case, your controller might have an NSArray ivar
called modelObjects or something a little more descriptive. Your
controller can then get at the individual model objects by asking its
modelObjects array for an object at a certain index.

  That is only one example of one scenario. The best course of action
(ie, the best application architecture) depends on a combination of
your app's purpose and the API's design pattern (in Cocoa's case, the
Model / View / Controller design pattern, which is a common design
pattern and is something YOU MUST LEARN).

  In the case of your model objects speaking to one-another, the
answer is the same: your model object needs a property (the
combination of an iVar with accessors that other objects can use to
set/get the property). The property would be a ModelObject pointer.


 Also, how do I access the ivars of myControllerObject from either
 modelObject1 or modelObject2?

  In general terms, you *shouldn't* do this. If you're using Cocoa,
you need to be following the MVC design pattern. According to MVC,
your model layer should know nothing of your controller (or view)
layer. Having a model object manipulating a controller object is
backwards. Your controller can observe your model for changes (ie,
Notifications or Key Value Observing) and react to this, but your
model objects should not be actively manipulating (sending messages to
or querying) any controllers.


 Is it possible to find out from myObject1 or myObject2 who init and alloc
 them?

  This is quite simply the wrong approach. Forget about this and learn
the Model View Controller design pattern:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html

  ... learn it NOW before you waste any more time stumbling about in
the dark nowhere near the right neighborhood. :-)


 From what I've read to far (Objective C-2.0 Programming Language and Cocoa
 Fundamentals Guide) I've been unable to find the answer to these questions.

  Read them again.


 I can send messages from myControllerObject to myObject1 or myObject2 and
 get returned information no worries, that I do get.

  Then you get the concept of pointers and sending messages to objects
*via* pointers, but you're lacking the architectural part of this (a
large, OH-MY-GOD-YOU-SHOULD-NOT-PROCEED-UNTIL-YOU-GET-THIS part).

--
I.S.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How resize a button or label to fit its content (at runtime)?

2009-02-11 Thread I. Savant
On Wed, Feb 11, 2009 at 9:40 AM, Jon C. Munson II jmun...@his.com wrote:

 One other hint, when a keyword search doesn't return something of value, try
 looking at the class of interest and follow up the chain until you find, or 
 not, what
 you seek.  Sure, it is tedious, but often can resolve things after a bit of 
 effort.

  A good point. An excellent tool for this (class hierarchy browsing)
is AppKiDo (google it). Every time someone uses it, Andy Lee gets a
pleasant tingle up his spine. He likes that.

--
I.S.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: How resize a button or label to fit its content (at runtime)?

2009-02-11 Thread Jon C. Munson II
AppKiDo is indeed a very cool tool.  Although I haven't used it overly much,
I do appreciate its usefulness.

Peace, Love, and Light,

/s/ Jon C. Munson II


 -Original Message-
 From: I. Savant [mailto:idiotsavant2...@gmail.com]
 Sent: Wednesday, February 11, 2009 10:04 AM
 To: jmun...@his.com
 Cc: Oleg Krupnov; Cocoa-Dev List
 Subject: Re: How resize a button or label to fit its content (at runtime)?
 
 On Wed, Feb 11, 2009 at 9:40 AM, Jon C. Munson II jmun...@his.com wrote:
 
  One other hint, when a keyword search doesn't return something of value,
 try
  looking at the class of interest and follow up the chain until you find,
 or not, what
  you seek.  Sure, it is tedious, but often can resolve things after a bit
 of effort.
 
   A good point. An excellent tool for this (class hierarchy browsing)
 is AppKiDo (google it). Every time someone uses it, Andy Lee gets a
 pleasant tingle up his spine. He likes that.
 
 --
 I.S.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How resize a button or label to fit its content (at runtime)?

2009-02-11 Thread Andy Lee

On Feb 11, 2009, at 10:03 AM, I. Savant wrote:

On Wed, Feb 11, 2009 at 9:40 AM, Jon C. Munson II jmun...@his.com  
wrote:


One other hint, when a keyword search doesn't return something of  
value, try
looking at the class of interest and follow up the chain until you  
find, or not, what
you seek.  Sure, it is tedious, but often can resolve things after  
a bit of effort.


 A good point. An excellent tool for this (class hierarchy browsing)
is AppKiDo (google it). Every time someone uses it, Andy Lee gets a
pleasant tingle up his spine. He likes that.


:) :) Very true!

I was just about to post the link:

http://homepage.mac.com/aglee/downloads/appkido.html

One thing it's specifically designed for is class hierarchy browsing.

--Andy

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Jason Wiggins

Hi Clint (and I.S.)

Thanks for your replies. I understand MVC and am happy with that now  
that a few thoughts have been cleared for me (thanks I.S.). OK, I now  
understand that and object knows nothing about its parent. Cool. I  
thought that was the case, but I wasn't convinced.


Now, I understand I need a pointer to the other object, but I am  
failing (in a BIG way) in understanding HOW to get it or create it.
myControllerObject has a pointer to it's children because it knows  
about it because it created it.
But if modelObject1 doesn't know modelObject2 even exists, how can I  
create a pointer to it? Where do I get this reference from?


Pseudo code...

@interface
ModelObject1 *modelObject1;
ModelObject2 *modelObject2;

@implementation
myControllerObject {

int one, two;
modelObject1 = [[ModelObject1 alloc] init]; // I now have object 1
modelObject2 = [[ModelObject2 alloc] init]; // I now have object 2

one = [modelObject1 doMethod];  // doMethod returns an int
two = [modelObject2 doMethod];  // doMethod returns an int

}
...

// The code above I understand and works OK.


@interface


@implementation
modelObjectA {
int a;

a = [modelObject2 doMethod];

}

If I do the above, I get error:'modelObject2' undeclared (first use  
in this function)
What do I do in modelObject1's code to make this work? Where do I get  
a reference for the pointer?


Thanks,

Regards,
Jason


On 12/02/2009, at 02:00 , Clint Shryock wrote:

in order for modelObject1 to talk to modelObject2, it must have a  
reference to that object, similar to how myControllerObject has a  
reference to both modelObject1 and modelObject2 which you use to  
send messages.


+Clint

On Wed, Feb 11, 2009 at 8:42 AM, Jason Wiggins jwigg...@optusnet.com.au 
 wrote:

Hi all,

Can someone please help me with this, I'm tearing my hair out!

Say I have myControllerObject. I alloc and init modelObject1 and  
also modelObject2.
How do I access the ivars of modelObject1 from modelObject2 and vice  
versa?


modelObject1 and modelObject 2 both exist somewhere in memory, so  
how do I get a pointer to or make a connection between these two  
object?


Also, how do I access the ivars of myControllerObject from either  
modelObject1 or modelObject2?


Is it possible to find out from myObject1 or myObject2 who init and  
alloc them?


From what I've read to far (Objective C-2.0 Programming Language and  
Cocoa Fundamentals Guide) I've been unable to find the answer to  
these questions.
I can send messages from myControllerObject to myObject1 or  
myObject2 and get returned information no worries, that I do get.


Thanks,

Regards,
Jason
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cts3e1%40gmail.com

This email sent to cts...@gmail.com



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread I. Savant
On Wed, Feb 11, 2009 at 10:42 AM, Jason Wiggins
jwigg...@optusnet.com.au wrote:

  I understand MVC ...

  Sorry, but I disagree. You've still got some concepts missing. :-)


 Now, I understand I need a pointer to the other object, but I am failing
 (in a BIG way) in understanding HOW to get it or create it.
 myControllerObject has a pointer to it's children because it knows about it
 because it created it.

  In MVC, it's typical for your controllers to be responsible for
creating the model objects. Consider an app that manages a library
of things. For simplicity, it's only one kind of thing. The left-hand
pane might be a source list style table listing all the objects in
the library. You might call this the LibraryController. It's
responsible for creating, deleting, reordering, and overall managing
LibraryItem model objects.

  By making this the sole responsibility of the LibraryController,
there's always only one place that a LibraryItem instance would be
created. If the LibraryController created it, the LibraryController is
free to set its properties any way it wishes, including [object2
setOtherObjectYouNeedToKnowAbout:object1];


 But if modelObject1 doesn't know modelObject2 even exists, how can I create
 a pointer to it? Where do I get this reference from?

  Never said that. It's quite common for model objects to know about
each other. It's just as common for controllers to know about
one-another. It's just not right (according to MVC) for the model
*layer* to know anything about anything in the controller or view
*layers*, even if they're designed to work together.

  Consider Core Data. It's an object graph management and persistence
framework. If we ignore the persistence part (ie, we're not
interested in Core Data's file saving capabilities, only its object
graph management capabilities), we still get a *very good* system for
managing an object model (the schema as well as the actual graph of
object instances that your app creates / manipulates). An Employee
object needs to know about a Department object (and vice-versa)
because they have a relationship. So a Department must have an
-employees property (an array or set) to which Employee instances can
be added or removed (or re-sorted, etc.). Likewise, an Employee must
have a -department property (it's a two-way relationship, after all).
When an employee instance is created, that's the ideal time to set its
-department (or, the other way, when a new department is created,
you'd add employees). Core Data handles this very well (makes it
easy), but without it, you need to enforce that logic yourself.

  Still, see my LibraryController points above ... a controller is
responsible for actually manipulating / managing the model.

--
I.S.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: Communication between objects

2009-02-11 Thread Jon C. Munson II
You need a line of code in your controller object thus:

[modelObject1 setModelObject2:modelObject2];

Then, in your object code, something like:

- (void)setModelObject2:(ModelObject2 *)anObject
{
modelObject2 = anObject;
}

You will need to include the header from ModelObject2 in your ModelObject1
code, and declare an instance variable for ModelObject2 in your ModelObject1
code.

Repeat for the other object.

Something like that anyway.

Peace, Love, and Light,

/s/ Jon C. Munson II

 -Original Message-
 From: cocoa-dev-bounces+jmunson=his@lists.apple.com [mailto:cocoa-dev-
 bounces+jmunson=his@lists.apple.com] On Behalf Of Jason Wiggins
 Sent: Wednesday, February 11, 2009 10:43 AM
 To: Clint Shryock; I. Savant
 Cc: Cocoa-Dev List
 Subject: Re: Communication between objects
 
 Hi Clint (and I.S.)
 
 Thanks for your replies. I understand MVC and am happy with that now
 that a few thoughts have been cleared for me (thanks I.S.). OK, I now
 understand that and object knows nothing about its parent. Cool. I
 thought that was the case, but I wasn't convinced.
 
 Now, I understand I need a pointer to the other object, but I am
 failing (in a BIG way) in understanding HOW to get it or create it.
 myControllerObject has a pointer to it's children because it knows
 about it because it created it.
 But if modelObject1 doesn't know modelObject2 even exists, how can I
 create a pointer to it? Where do I get this reference from?
 
 Pseudo code...
 
 @interface
 ModelObject1 *modelObject1;
 ModelObject2 *modelObject2;
 
 @implementation
 myControllerObject {
 
 int one, two;
 modelObject1 = [[ModelObject1 alloc] init]; // I now have object 1
 modelObject2 = [[ModelObject2 alloc] init]; // I now have object 2
 
 one = [modelObject1 doMethod];  // doMethod returns an int
 two = [modelObject2 doMethod];  // doMethod returns an int
 
 }
 
 
 // The code above I understand and works OK.
 
 
 @interface
 
 
 @implementation
 modelObjectA {
 int a;
 
 a = [modelObject2 doMethod];
 
 }
 
 If I do the above, I get error:'modelObject2' undeclared (first use
 in this function)
 What do I do in modelObject1's code to make this work? Where do I get
 a reference for the pointer?
 
 Thanks,
 
 Regards,
 Jason
 
 
 On 12/02/2009, at 02:00 , Clint Shryock wrote:
 
  in order for modelObject1 to talk to modelObject2, it must have a
  reference to that object, similar to how myControllerObject has a
  reference to both modelObject1 and modelObject2 which you use to
  send messages.
 
  +Clint
 
  On Wed, Feb 11, 2009 at 8:42 AM, Jason Wiggins jwigg...@optusnet.com.au
   wrote:
  Hi all,
 
  Can someone please help me with this, I'm tearing my hair out!
 
  Say I have myControllerObject. I alloc and init modelObject1 and
  also modelObject2.
  How do I access the ivars of modelObject1 from modelObject2 and vice
  versa?
 
  modelObject1 and modelObject 2 both exist somewhere in memory, so
  how do I get a pointer to or make a connection between these two
  object?
 
  Also, how do I access the ivars of myControllerObject from either
  modelObject1 or modelObject2?
 
  Is it possible to find out from myObject1 or myObject2 who init and
  alloc them?
 
  From what I've read to far (Objective C-2.0 Programming Language and
  Cocoa Fundamentals Guide) I've been unable to find the answer to
  these questions.
  I can send messages from myControllerObject to myObject1 or
  myObject2 and get returned information no worries, that I do get.
 
  Thanks,
 
  Regards,
  Jason
  ___
 
  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.apple.com
 
  Help/Unsubscribe/Update your Subscription:
  http://lists.apple.com/mailman/options/cocoa-dev/cts3e1%40gmail.com
 
  This email sent to cts...@gmail.com
 
 
 ___
 
 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.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/jmunson%40his.com
 
 This email sent to jmun...@his.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Ken Thomases

On Feb 11, 2009, at 9:42 AM, Jason Wiggins wrote:

Now, I understand I need a pointer to the other object, but I am  
failing (in a BIG way) in understanding HOW to get it or create it.
myControllerObject has a pointer to it's children because it knows  
about it because it created it.
But if modelObject1 doesn't know modelObject2 even exists, how can I  
create a pointer to it? Where do I get this reference from?


Pseudo code...

@interface
ModelObject1 *modelObject1;
ModelObject2 *modelObject2;

@implementation
myControllerObject {

int one, two;
modelObject1 = [[ModelObject1 alloc] init]; // I now have object 1
modelObject2 = [[ModelObject2 alloc] init]; // I now have object 2

one = [modelObject1 doMethod];  // doMethod returns an int
two = [modelObject2 doMethod];  // doMethod returns an int


[modelObject1 setPartner:modelObject2];

where you have implemented a -setPartner: method on ModelObject1 which  
receives a pointer to a partner object, retains it, and stores it in  
an instance variable.  Later, when the object needs to interact with  
its partner, it uses the pointer it stored in its instance variable.


Of course, partner is just a property name I made up; it's not  
special to the framework.  Use whatever property name makes sense for  
your design.


Cheers,
Ken

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Andy Lee

On Feb 11, 2009, at 10:42 AM, Jason Wiggins wrote:
But if modelObject1 doesn't know modelObject2 even exists, how can I  
create a pointer to it? Where do I get this reference from?


If you want modelObject1 to have an ivar that refers to modelObject2,  
the typical ways to make the connection are:


(1) modelObject1 has a setter method: [modelObject1  
setObject2:modelObject2]


(2) modelObject1 has an init method that takes an argument:  
modelObject1 = [[ModelObjectOne alloc] initWithObject2:modelObject2]


(3) IB outlet connection from modelObject1 to modelObject2

*Somebody* needs to know about both modelObject1 and modelObject2.   
That somebody might be a third object -- perhaps even your  
controller.  Or it might be the nib file.


If you don't want modelObject1 to have an ivar, but only use  
modelObject2 temporarily to do something, typically you pass  
modelObject2 as a method argument:


[modelObject1 doSomethingWithObject2:modelObject2];

Again, something must know about both objects in order to make this  
call.


BTW, it would be easier to discuss this if you would give the specific  
classes you're using instead of generic placeholder names like object1  
and object2.  It would be easier to give advice on how to organize  
your classes overall.


--Andy
aglee


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: A Mac App helper NSStatusItem - how to share preferences

2009-02-11 Thread Michael Ash
On Wed, Feb 11, 2009 at 5:55 AM, Trygve Inda cocoa...@xericdesign.com wrote:
 In my helper app I use:

 userDefaults =
 [[NSUserDefaults standardUserDefaults]
 persistentDomainForName:kMainAppIdent];

 You just need to make sure there is no chance of the helper and the host
 writing at the same time to the same file.

Actually there is no such need. The user defaults system is smart
about synchronizing simultaneous changes from multiple processes, and
will do the right thing if both of your processes should hit the file
at the same time.

Mike
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Jason Wiggins
OK, now I *think* I've got a bit idea. What I've been trying to do is  
get an ivar from object1 into object2 *directly* without using the  
controller as a middleman
Is it true that I have to set up properties (using Objc 2) to get and  
set the ivars *via* the controller? I just did that and got it to work.
Can i only communicate between objects via the controller who (as  
obviously named) it controls the flow of data?
The only reason I ask this is because after reading Object-Oriented  
Programming with Objective-C - The Object Model - Figure 3-2 The  
object network shows each object sending messages to each other. Is  
that picture very abstracted? Because if it is, that figure has messed  
with my brain.



On 12/02/2009, at 02:56 , I. Savant wrote:


On Wed, Feb 11, 2009 at 10:42 AM, Jason Wiggins
jwigg...@optusnet.com.au wrote:


I understand MVC ...


 Sorry, but I disagree. You've still got some concepts missing. :-)



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread David LeBer


On 11-Feb-09, at 11:14 AM, Jason Wiggins wrote:

OK, now I *think* I've got a bit idea. What I've been trying to do  
is get an ivar from object1 into object2 *directly* without using  
the controller as a middleman
Is it true that I have to set up properties (using Objc 2) to get  
and set the ivars *via* the controller? I just did that and got it  
to work.
Can i only communicate between objects via the controller who (as  
obviously named) it controls the flow of data?
The only reason I ask this is because after reading Object-Oriented  
Programming with Objective-C - The Object Model - Figure 3-2 The  
object network shows each object sending messages to each other. Is  
that picture very abstracted? Because if it is, that figure has  
messed with my brain.


I think this has been explained.

It is perfectly acceptable for model objects to message one another.

You just need to have a reference to the object you are trying to  
message. i.e.:


Company -- Employees

Your Company object would have an array of Employees. The Employee  
objects would each have a reference to their Company.


From Company: [[[self employees] objectAtIndex:n] doThatThing];
From Employee: [[self company] doThatOtherThing];



On 12/02/2009, at 02:56 , I. Savant wrote:


On Wed, Feb 11, 2009 at 10:42 AM, Jason Wiggins
jwigg...@optusnet.com.au wrote:


I understand MVC ...


Sorry, but I disagree. You've still got some concepts missing. :-)



;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Which keyboard (barcode scanner) did the event come from?

2009-02-11 Thread Gerd Knops


On Feb 10, 2009, at 5:08 PM, Kevin Gessner wrote:


On Feb 9, 2009, at 11:47 PM, Gerd Knops wrote:

Assuming I have two identical USB keyboards (actually barcode  
scanners) connected to a mac, is there any way to tell which of  
them a keyboard event came from?


[snip]

Is there some way to, say, get a unique USB device ID or something  
like that from an NSEvent or a EventRef?



I faced a similar problem a couple months ago, and didn't find any  
way to correlate an NSEvent with a keyboard. My solution was to use  
Dave Dribin's DDHidLib (http://www.dribin.org/dave/software/). I  
listen for the low-level HID event, which is device-specific, then  
wait for the next NSEvent to bubble up. It's a bit of housekeeping,  
but it has been working well in practice.



Thanks for the pointer! I suspected I'd have to do something like that.

Gerd

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIScrollView - photo viewer like usage

2009-02-11 Thread David Duncan

On Feb 10, 2009, at 9:09 PM, Daryl Thachuk wrote:

Yes it is possible to do this with UIScrollView but only for a small  
amount of images. You eventually run out of memory on the device.


The best way accomplish this task would be to use CALayers which  
will allow you to unload images when memory gets tight.



Actually you can do that with UIViews or CALayers (and conversely you  
can break CALayers in the same way). The critical point is to not  
use +imageNamed: as this will load the images cached, which generally  
is not what you want for large images.

--
David Duncan
Apple DTS Animation and Printing

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RESEND: Cocoaheads Lake Forest (92630) meeting 2/11/2009 (tonight!) at 7 pm on Modeling a Game with the Cocoa Frameworks

2009-02-11 Thread Scott Ellsworth
(It appears this did not make it through - apologies if a second copy appears.)

CocoaHeads Lake Forest will be meeting on the second Wednesday of the
month.  We will be meeting at our usual location, Orange County Public
Library (El Toro) community room, 24672 Raymond Way, Lake Forest, CA
92630

Please join us from 7pm to 9pm on Wednesday, 2/11.

Joe Sickel will be talking about modeling a game with the Cocoa frameworks.

I would like to extend my own personal thanks as well as the groups
for the guest speakers we have been having.  It is greatly
appreciated.

Bring your comments, your books, and your bugs, and we will leap right in.

As always, details can be found on the cocoaheads web site at
www.cocoaheads.org.

Thanks go to O'Reilly Media for providing us one of their books as a door prize.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Paste with no Edit Menu

2009-02-11 Thread Andy Bell
Hi All,

I am working on a project which is an Agent and just has a couple on Windows
and a menu bar icon.  The menu bar icon has a menu which is used to call up
the two windows.  Now I want to add 'Command-V' so that I can paste into the
NSTextFields in this window, as I don't have the standard Edit menu I need
to catch this command in some other way.  I did first try to add a menu item
for pasting in the menu bar menu and hooking it into the First responder
paste selector but that didn't work.  Any ideas?

Thanks in advance
Andy
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
I've just found out that some code that seemed to be working fine  
doesn't do so under all circumstances.


I have a to-many relationship (called 'elements') in a managed object  
('parent').
In one spot in my code, there is a need to obtain and present all of  
the elements of the parent managed object, which I already have in my  
hand.


The parent MO is defined with an 'elements' property (nominally an  
NSSet).  So for simply reading the set and converting it to an array,  
I had imagined the following would be OK:


NSArray *elements = [parent.elements allObjects];

Now, this turns out to be bad, as on occasion (and I think, when there  
are no elements), I get the error:
 *** -[NSCFArray allObjects]: unrecognized selector sent to instance  
whatever


It's interesting to see that the receiver here turns out to be an  
array!  I'm aware that the to-many relationship is likely to be  
represented by a faulting proxy object, but this was unexpected.


I'm assuming this is exposing a poor assumption on my part regarding  
how Core Data works with to-many relationships under all conditions.
What should I be doing here instead?  I could presumably enumerate  
through the collection (no matter what flavour it currently exists in,  
this should work in all circumstances included the 'no elements' case).


The docs certainly contain a lot of info about accessing to-many  
relationships (where particular care is needed to change the set of  
objects in a to-many relationship correctly), but I don't recollect  
anything telling me that I couldn't treat the to-many relationship as  
a set when simply looking up which objects are there.


Cheers

-- lwe

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant
On Wed, Feb 11, 2009 at 2:48 PM, Luke Evans l...@eversosoft.com wrote:

 The parent MO is defined with an 'elements' property (nominally an NSSet).

  How? What does this declaration look like in your classes? I assume
you have at least one custom subclass of NSManagedObject specified
(for your Element entity), based on the code example you gave, but
it's important to let us know *how* this is declared.

  So for simply reading the set and converting it to an array, I had imagined
 the following would be OK:

 NSArray *elements = [parent.elements allObjects];

 Now, this turns out to be bad, as on occasion (and I think, when there are
 no elements), I get the error:
  *** -[NSCFArray allObjects]: unrecognized selector sent to instance
 whatever

  I'd be just as surprised as you - I've never run into this problem
personally and would've expected it to produce a set, not an array.
Then again, I'm still begrudgingly sticking to Obj-C v1 on all but my
newest project, so it may have something (or a lot, or everything) to
do with Obj-C 2's dot syntax or synthesized properties, and not Core
Data.

--
I.S.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Running out of memory when adding CGImageRef-to-NSImage frames to QTMovie in NSOperation subclass

2009-02-11 Thread Michael Hanna
A follow-up for posterity.

I use [NSImage -addRepresentation:] instead of -TIFFRepresentation and
made the object life cycle local. The result in Instruments was that
the object allocation graph(all objects still living), drew like how
the stock market has been recently(up and down, indicating objects
being released as expected) rather than how the stock market used to
be a two years ago(steadily increasing). Thanks Ken.

Side note, in Instruments it seems generally more useful to use Leaks
instead of just ObjectAllocations alone.

Michael

On Sat, Feb 7, 2009 at 8:35 PM, Ken Ferry kenfe...@gmail.com wrote:
 Hi Michael,
 The information to diagnose your problem is not in this message.
  Instruments can show you backtraces of where individual objects were
 allocated, and where they were retained and released.
 Two things with this line, though.
 anImage = [[NSImage alloc] initWithData:[bitmapRep
 TIFFRepresentation]];
 (1) Did you release this image?  You didn't in the code below.  If you _did_
 put the release in setImageAsMPEG4, I suggest you not do that.  The point of
 the Cocoa memory management conventions is that they should be _locally_
 verifiable.  You should not have to look between methods to see if something
 leaked.
 (2) This is extremely inefficient, and is making redundant image buffers.
  TIFFRepresentation is a method that sees a lot of abuse.  If you aren't
 using it to write a TIFF to the disk or to the network, there's probably a
 better way.
 In this case,
 anImage = [[NSImage alloc] initWithSize:[bitmapRep size]];
 [anImage addRepresentation:bitmapRep];
 Further in the vein of (1),
CGImageRef scaledImage = [self scaledImageForURL:m_fileURL];

NSBitmapImageRep *bitmapRep = [[[NSBitmapImageRep alloc]
 initWithCGImage:scaledImage] autorelease];

CFRelease(scaledImage);

 This looks funky, because scaledImageForURL does not begin with copy, alloc,
 retain, or new, and yet you are releasing the thing you get back from it.
  Again, this code is not locally verifiable, because it doesn't follow the
 memory management guidelines (or it's verifiable and incorrect).
 -Ken
 On Sat, Feb 7, 2009 at 4:36 PM, Michael Hanna taomaili...@gmail.com wrote:

 I have an NSOperation that opens a CGImageRef from a digital
 camera(large file). It creates a full-size TIFFRepresentation in RAM,
 then scales it down to a smaller CGContextRef. I create an NSImage out
 of this CGContextRef. This same NSOperation then adds it to a QTMovie
 with the -addImage:forDuration:withAttributes: method.

 Once the image is added, I send off an NSNotification and the
 thread/NSOperation dequeues(I'm assuming).

 Once the frame-adding operation is complete, the movie (originally
 created with a tempfile on the main thread) that is generated is
 subsequently added to another NSOperationQueue which just writes it to
 a file.

 However, I find that I run out of RAM very quickly during the
 image-creation phase. When analysing it in Instruments, objects don't
 appear to be getting deallocated(not sure which objects). After about
 120 images, my 4-gig macbook pro runs out RAM ... mmap error stating
 that it couldn't allocate RAM.

 I thought encapsulating the image-creation and movie-creation together
 in a separate thread would guarantee me that once that operation got
 dequeued at least the NSImage objects associated with that autorelease
 pool would be sent a -release message and be freed.

 It appears the NSImage is being properly disposed-of because when I try:

NSLog(@[anImage retainCount] %d, [anImage retainCount]);
[self setImageAsMPEG4:anImage];
NSLog(@[anImage retainCount] %d, [anImage retainCount]);

 the second call to [anImage retainCount] causes a crash:

 objc[4573]: FREED(id): message retainCount sent to freed object=0x24114470

 so the NSImage must be gone? Why does my RAM fill-up then? I keep the
 full movie in memory because I need it to save to disk later, but it
 shouldn't hog all the system resources after 120 1/2 second frames,
 should it?

 So here is the main() method to the NSOperation subclass that takes a
 CGImageRef, converts it to an NSImage, the adds it as a frame to a
 QTMovie:

 -(void)main
 {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

[QTMovie enterQTKitOnThreadDisablingThreadSafetyProtection];
//[self.movieExport.movie attachToCurrentThread];

NSAssert(m_fileURL != nil, @file url is nil!);

NSImage *anImage = nil;

if (![self isCancelled])
{

CGImageRef scaledImage = [self scaledImageForURL:m_fileURL];

NSBitmapImageRep *bitmapRep = [[[NSBitmapImageRep alloc]
 initWithCGImage:scaledImage] autorelease];

CFRelease(scaledImage);

anImage = [[NSImage alloc] initWithData:[bitmapRep
 TIFFRepresentation]];
}

NSLog(@[anImage retainCount] %d, [anImage retainCount]);
[self setImageAsMPEG4:anImage];
//NSLog(@[anImage retainCount] %d, [anImage retainCount]);


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans


On 11-Feb-09, at 12:16 PM, I. Savant wrote:


 How? What does this declaration look like in your classes? I assume
you have at least one custom subclass of NSManagedObject specified
(for your Element entity), based on the code example you gave, but
it's important to let us know *how* this is declared.


Indeed it is defined in a subclass of NSManagedObject as:

@property(readonly, retain) NSSet *elements;

It is read only as writing is done via KVC patterned write accessors  
(i.e. addElementsObject, removeElementsObject).


The implementation does nothing more than:

@dynamic elements;

I'm now defending against the wrong type of receiver representing the  
relationship by first sending a -count message and only if this is non- 
zero sending -allObjects.
This seems to be working, though it's an unsatisfactory band-aid  
applied without true knowledge of how the circumstance is arising.



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSPopupButton in NSTableView header?

2009-02-11 Thread Randall Meadows
Is it possible to put a custom view, in this case an NSPopupButton, in  
a specific column header of an NSTableView?


I have a table with 3 columns, one of which displays a status for one  
of several user-selectable things that correspond to the rest of the  
data in that row.  I currently have the popup button that selects  
which thing's status is displayed elsewhere in the window, and it's  
a little confusing, apparently.  I thought if I could put that popup  
button directly in the header of that column instead, it'd be crystal  
clear.


Is it a matter of subclassing NSTableHeaderView, overriding - 
drawRect:, calling super's -drawRect: first, and then placing an  
NSPopupButton at the appropriate location (as determined by - 
headerRectOfColumn: for my special column?


That seems like a hack, but it's all I could come up with so far.   
There doesn't seem to be a way to set a specific cell in the header  
view.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Transparent Image

2009-02-11 Thread Christian Graus
 Please file a bug and request this functionality.
OK - that would not have occurred to me at all.  That works in the Mac world
? Awesome !! I've found plenty of Microsoft bugs, and I was even an MVP at
the time, they always ignored me, or told me they were features ( and I
found some MAJOR bugs in WPF ).  I assume if I go to the Apple Dev
Connection and log in, I'll be able to find a place to log bugs ?

Christian
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSPopupButton in NSTableView header?

2009-02-11 Thread Randall Meadows
And OF COURSE I find the answer not 10 seconds after pressing  
Send...NSTableColumn -setHeaderCell:.


Silly me, I was looking in NSTableHeaderView.  What was I thinking?! ;)


On Feb 11, 2009, at 1:40 PM, Randall Meadows wrote:

Is it possible to put a custom view, in this case an NSPopupButton,  
in a specific column header of an NSTableView?


I have a table with 3 columns, one of which displays a status for  
one of several user-selectable things that correspond to the rest  
of the data in that row.  I currently have the popup button that  
selects which thing's status is displayed elsewhere in the window,  
and it's a little confusing, apparently.  I thought if I could put  
that popup button directly in the header of that column instead,  
it'd be crystal clear.


Is it a matter of subclassing NSTableHeaderView, overriding - 
drawRect:, calling super's -drawRect: first, and then placing an  
NSPopupButton at the appropriate location (as determined by - 
headerRectOfColumn: for my special column?


That seems like a hack, but it's all I could come up with so far.   
There doesn't seem to be a way to set a specific cell in the header  
view.



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Saving a PDF Selection or converting it to an NSRange and back

2009-02-11 Thread John Calhoun

On Feb 11, 2009, at 12:44 PM, Keith Blount wrote:
The subject line says it all, really, I need to save a PDFSelection  
between sessions in my program, but there seems no way of doing  
this. A similar question came up on these last year but there was no  
solution:


To save a selection sapnning multiple pages you could convert a single  
selection into an array of single-line selections (-[PDFSelection  
selectionsByLine]).  Each selection returned by this method is going  
to be on a single page (and a single contiguous range and line).  The  
bounds then of these selections can be saved and then the selections  
recreated from those bounds.


I haven't tried the above but it should work in principle.

PDFSelection should probably expose some method of archiving in the  
future


Of course, if there is a better way of implementing PDF highlighting  
that I'm missing, please feel free to tell me point me in the  
direction of what I have overlooked. I have looked at the docs, the  
samples and searched the net before posting, though.


No better, but different: you could take the bounds returned from the  
above discussion and instead create Highlight annotations.  These you  
can add to the PDF and save out.  Might save you some work since when  
re-opening the PDF you don't need to re-create the highlights since  
they're now embedded in the PDF.


John Calhoun—___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: One Shot Windows: WARNING

2009-02-11 Thread Seth Willits

On Feb 10, 2009, at 9:12 PM, Michael Ash wrote:


The behavior of non-one shot windows is obviously not clear.


Forgive me for saying this, but this sounds a lot like the common
newbie complaints about Cocoa memory management.


It's more than memory management.

For example, why does a non-one-shot window even redraw after it's  
already been closed?





In short, you have a memory management problem. As is often the nature
of memory management problems, it only manifested under certain
circumstances. But this doesn't mean that there needs to be a special
warning about those circumstances, it only means that you need to not
write this kind of bug.


Except if you had spent two hours trying to figure out what was going  
on, you'd be happy to have read a thread warning that a tiny  
inconspicuous checkbox does more than the documentation leads on to. ;-)



--
Seth Willits



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans

 The documentation (Core Data Programming Guide -- Managed Object
Accessor Methods -- Custom To-Many Relationship Accessor Methods)
spells out all the stipulations for custom to-many accessors and the
code example is:

@property NSSet *employees;

 ... without the readonly flag. I would not expect this to hand back
an array versus a set, but I would also not specify a to-many
relationship as a read-only property.



Yes, and it seems that it's OK to set an _entire_ set for a to-many  
relationship using the simple pattern:

parent.elements = some NSSet
according to p.62 of the Core Data Programming Guide.

However, if one wants to discourage this (and I do), then it seems  
like the right thing is to set the property as read-only (after all  
the docs say that the
property is only a wrapper to suppress compiler warnings, around the  
dynamic KVC handling in NSManagedObject itself).


The dynamically generated accessor methods (things like - 
addElementsObject and -removeElementsObject) are described on p.44 of  
the Guide

(which in turn references documentation for mutableSetValueForKey:).

Anyway, like you, I can't see how having a read-only flag on the  
wrapping property in my NSManagedObject subclass is going to affect
how a to-many relationship is internally represented within  
NSManagedObject.  Moreover, I reset the declaration of the property to  
the unquestionably
canonical @property(retain) NSSet *elements and the problem still  
manifests.  The retain appears to be required for use with GC as the  
default is assign

which will cause warnings.

-- lwe

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant

On Feb 11, 2009, at 5:09 PM, Luke Evans wrote:

Anyway, like you, I can't see how having a read-only flag on the  
wrapping property in my NSManagedObject subclass is going to affect
how a to-many relationship is internally represented within  
NSManagedObject.  Moreover, I reset the declaration of the property  
to the unquestionably
canonical @property(retain) NSSet *elements and the problem still  
manifests.  The retain appears to be required for use with GC as  
the default is assign

which will cause warnings.


  Hmmm ... I do not have an answer for this. If nobody else can offer  
any insight, I'd file a bug. In fact, I'd file it anyway because this  
random substitution should not happen.


--
I.S.


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans
 Hmmm ... I do not have an answer for this. If nobody else can offer  
any insight, I'd file a bug. In fact, I'd file it anyway because  
this random substitution should not happen.


Yeah, I guess someone with deep knowledge of the states that a Core  
Data to-many relationship can be in throughout its life-cycle might be  
able to comment as to whether there's _any_ point in the  
implementation of NSManagedObject that has these relationships  
temporarily fielded by a proxy that responds as if it is an array (or  
actually being one!).


Clearly, you wouldn't even notice the switcheroo if you were driving  
the relationship via a more generic collection-like interface (e.g.  
like using -count, using fast enumeration or other things that apply  
equally well to a range of concrete collection objects - or at least  
arrays and sets).


I had a wonderment about whether some managedObjectContext locking I  
was doing around that access could be to blame, but this seems not to  
be the case through experimentation (i.e. removed the locking - still  
manifests).



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Transparent Image

2009-02-11 Thread Mike Abdullah
Don't get your hopes up too much, plenty of issues remain unsolved for  
looong periods of time. You want http://bugreport.apple.com


On 11 Feb 2009, at 20:41, Christian Graus wrote:


Please file a bug and request this functionality.
OK - that would not have occurred to me at all.  That works in the  
Mac world
? Awesome !! I've found plenty of Microsoft bugs, and I was even an  
MVP at
the time, they always ignored me, or told me they were features  
( and I

found some MAJOR bugs in WPF ).  I assume if I go to the Apple Dev
Connection and log in, I'll be able to find a place to log bugs ?

Christian
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.net


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Transparent Image

2009-02-11 Thread Christian Graus
Thank you.  The number is
*6578276.*https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/85/wo/n3gbesxSHOpLghGqW9p2I0/8.34

On Thu, Feb 12, 2009 at 9:57 AM, Kyle Sluder kyle.slu...@gmail.com wrote:

 http://bugreport.apple.com

 Then make sure to post the bug number here.

 --Kyle Sluder

 --
 --Kyle Sluder

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Transparent Image

2009-02-11 Thread Christian Graus
Yeah, I'm sure this is not going to come in time to solve the issue for my
project, but still, it's nice to think that it may get addressed at some
point.

On Thu, Feb 12, 2009 at 10:17 AM, Mike Abdullah
cocoa...@mikeabdullah.netwrote:

 Don't get your hopes up too much, plenty of issues remain unsolved for
 looong periods of time. You want http://bugreport.apple.com


 On 11 Feb 2009, at 20:41, Christian Graus wrote:

  Please file a bug and request this functionality.

 OK - that would not have occurred to me at all.  That works in the Mac
 world
 ? Awesome !! I've found plenty of Microsoft bugs, and I was even an MVP at
 the time, they always ignored me, or told me they were features ( and I
 found some MAJOR bugs in WPF ).  I assume if I go to the Apple Dev
 Connection and log in, I'll be able to find a place to log bugs ?

 Christian
 ___

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

 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

 This email sent to cocoa...@mikeabdullah.net



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread Graham Cox


On 12 Feb 2009, at 1:42 am, Jason Wiggins wrote:

How do I access the ivars of modelObject1 from modelObject2 and vice  
versa?



Others have had plenty of useful advice to give on the general  
question, but in your original, this stood out for me.


The answer here is: YOU DON'T. ivar stands for instance variable and  
it should be private to the object that defines them. No other object  
should ever access an object's ivars. This is the principle of  
encapsulation. What you may have meant is how do I access another  
object's *properties*. That's different. An object's properties are  
not equivalent to its ivars. Often properties are implemented using  
ivars, but they are not the same thing - how a property is implemented  
is an internal detail of the object that has that property.


It's important to understand this difference, which is why I'm harping  
on about it - terminology matters.


example:

An object has a property 'name' that returns a string. It matters not  
to another object how 'name' is generated, it could be:


- (NSString*) name
{
 return mName;  // return the ivar that holds the name
}

or equally validly:

- (NSString*) name
{
return [NSString stringWithFormat:@My name is: %@,  
[[MyNameHelperClass stringElement] capitalizedString]];

}


In other words, the property is 'name' but it has nothing necessarily  
to do with ivars.


To help enforce this, it's usually a good idea to set all ivars of an  
object to be private using @private in your class definition. This  
forces you to
ensure there are accessors for every one that you need to expose as a  
property. Even subclasses are then forced to use the property  
accessors and not the ivars (though that is occasionally inconvenient  
and not what you want, but those cases are the exception not the rule).


Sorry for the somewhat tangential reply - it's not answering your main  
question, but remember, terminology matters. Incorrect use of  
terminology (as in conflating 'ivar' with 'property') typically  
reveals incorrect or sloppy thinking about concepts.


--Graham


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant

On Feb 11, 2009, at 5:38 PM, Luke Evans wrote:

Clearly, you wouldn't even notice the switcheroo if you were driving  
the relationship via a more generic collection-like interface (e.g.  
like using -count, using fast enumeration or other things that apply  
equally well to a range of concrete collection objects - or at least  
arrays and sets).


  Well, I'd say that, rather than the odd work-around you're using  
now, you should use KVC.


[[self valueForKeyPath:@parent.elements] allObjects]

  ... this should do the same thing with the expected result. If it  
does not, there is another problem with your code.


--
I.S.




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Communication between objects

2009-02-11 Thread I. Savant

On Feb 11, 2009, at 6:26 PM, Graham Cox wrote:

It's important to understand this difference, which is why I'm  
harping on about it - terminology matters.


  I usually do harp on such things, but today I didn't have the  
heart. I'm busy, stressed, and hoping to avoid a flame-war from  
sensitive folk. ;-)


  That said, however, I agree 100%. If you enter a room full of  
professionals who know the lingo and use said lingo incorrectly, you  
can expect confusion and probably bad advice (if someone takes you too  
literally).


  Property != instance variable. However, I think the OP understands  
the mechanics, but just got the terminology wrong.


--
I.S.




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread Luke Evans

[[self valueForKeyPath:@parent.elements] allObjects]

 ... this should do the same thing with the expected result. If it  
does not, there is another problem with your code.


... and it's cold comfort to find that the behaviour is exactly the  
same.  So, at least there isn't 'another' problem :-)





___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data: right way to gather all elements of a to-many relationship?

2009-02-11 Thread I. Savant

On Feb 11, 2009, at 7:37 PM, Luke Evans wrote:

... and it's cold comfort to find that the behaviour is exactly the  
same.  So, at least there isn't 'another' problem :-)



  Well, actually, I realize now that my statement was ambiguous. I  
meant that asking via -valueForKey: and providing the keypath should  
do the same thing *you originally intended* and return a set *as  
expected*.


  If using this code (with all your work-arounds removed) produces  
the same result, you've got a problem in your code and it's best you  
come clean with a complete code listing of the relevant parts.


  To be clear: I have a project of my own that regularly uses the  
same approach (finding the siblings by a key path @parent.children)  
via [self valueForKeyPath:@...] and it works as expected every time.


  Do I remember correctly that you're using GC? Perhaps you have a  
dangling pointer somewhere?


--
I.S.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Application Architecture or approach

2009-02-11 Thread Louis Demers

Hi,

I currently have an application that talks to a single device over TCP/ 
IP. My user interface has lots of parameters and status variables. I  
use bindings all over the place. The device is represented a custom  
NSObject instantiated in my MainMenu.xib. The various GUI elements are  
using bindings to the instantiated custom Object from the ManMenu.xib.


Now, I need to rewrite the app so that it can talk to multiple  
devices. I want to use bindings and write as little code as possible  
8-)  I'm considering an NSDocument based Applications and using panels/ 
palettes to display status and controls (100's) Each device will be  
represented by a different document.


My question, is :

when I select a different device, by making its window the frontmost,  
how do I get the panels/palettes to display the values related to the  
frontmost window/document and therefore, newly selected device. I  
would hate to have to setup 100 of observers ... or manually refresh  
100's sliders/textfields/...


Hopefully, what I'm trying to do was explained clearly enough so that  
the collective wisdom of the list can point me toward the optimal  
approach.



thx in advance.


Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Kyle Sluder
On Wed, Feb 11, 2009 at 8:07 PM, Louis Demers louisdem...@mac.com wrote:
 Now, I need to rewrite the app so that it can talk to multiple devices. I
 want to use bindings and write as little code as possible 8-)  I'm
 considering an NSDocument based Applications and using panels/palettes to
 display status and controls (100's) Each device will be represented by a
 different document.

If the concept is to control lots of devices at a time, then I would
hesitate to use the NSDocument architecture.  Instead, I'd use a
plugin architecture, where each device's code and interface is stored
in a separate bundle inside your bundle's PlugIns folder.  You can
then enumerate these for choosing to display certain interfaces.

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Louis Demers


On 11-Feb-09, at 20:20 , Kyle Sluder wrote:

On Wed, Feb 11, 2009 at 8:07 PM, Louis Demers louisdem...@mac.com  
wrote:
Now, I need to rewrite the app so that it can talk to multiple  
devices. I

want to use bindings and write as little code as possible 8-)  I'm
considering an NSDocument based Applications and using panels/ 
palettes to
display status and controls (100's) Each device will be represented  
by a

different document.


If the concept is to control lots of devices at a time, then I would
hesitate to use the NSDocument architecture.  Instead, I'd use a
plugin architecture, where each device's code and interface is stored
in a separate bundle inside your bundle's PlugIns folder.  You can
then enumerate these for choosing to display certain interfaces.


I Had not thought about plugins because all the devices are identical  
in capabilities. The devices are complex cameras. I wanted to have  
each cameras have it document window to display the specific video  
feed, but a single palette to control the brightness/zoom of the  
frontmost window/camera. This is an over simplification because in  
reality, each camera has lots of controls and status. If each camera/ 
device has its own exclusive gui element, the screen will be cluttered  
beyond acceptable.  I was modeling my solution around something like  
Photoshop or Illustrator where multiple documents use the same set of  
palettes.



Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


How to force a message to a overriding method from within an init method

2009-02-11 Thread João Varela

Hi all

I am porting most of my C++ code into Objective C and at the moment I  
have this problem:


In C++ to force a constructor to call a overriding method of a  
subclass I used pure virtual functions defined in an abstract (super)  
class.


An example:

class Foo
{
Foo();
virtual read( x, y ) = 0; // pure virtual
};

class Bar : public Foo
{
Bar();

virtual Read( x, y );   // implemented in the subclass
};

// Foo constructor
Foo::Foo()
{
Read( x, y ); // -- this calls Bar::Read and not Foo::Read
  // because the latter is pure virtual
}

I know that the closest thing to a pure virtual function in Objective  
C is a formal protocol. My question is: can you implement such a  
behavior in objective C with a formal protocol?


Related to this, what method gets called inside the init method of the  
superclass: a) the superclass method? or b) the overriding method if  
there is one?


Although this is not strict Cocoa code, I think this is the best place  
to ask this kind of question. Sorry for the mild OT-ness of my  
question.


TIA

JV



___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Kyle Sluder
Nothing about this requires you to use the NSDocument architecture.
You would implement the palettes the same way as you would for a
document-based app.  I'm just wondering if it is appropriate for what
you're trying to do.

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to force a message to a overriding method from within an init method

2009-02-11 Thread Shawn Erickson
On Wed, Feb 11, 2009 at 5:31 PM, João Varela j.var...@clix.pt wrote:
 Hi all

 I am porting most of my C++ code into Objective C and at the moment I have
 this problem:

 In C++ to force a constructor to call a overriding method of a subclass I
 used pure virtual functions defined in an abstract (super) class.
...
 I know that the closest thing to a pure virtual function in Objective C is a
 formal protocol.

Not really, no need to involve a protocol.

Conceptually, using C++ terminology, you can think of all methods in
Objective-C as virtual. The pure aspect (aka abstract) in
Objective-C simply comes about by the abstract base class simply
providing an empty implementation of the abstract method with
documentation in the interface stating that sub-classes must provide
an implementation.

 My question is: can you implement such a behavior in objective C ...?

Quick example written in mail (not compiled or tested... expect typos)

@inteface Foo : NSObject {
...
}
/** Document this as being abstract */
- (void) readX:(int*)x y:(int*)y;
@end

@implementation Foo
- (id) init {
if ((self = [super init]) != nil) {
int x, y;
[self read:x y:y];
...
}
return self;
}
- (void) readX:(int*)x y:(int*)y {
// the following is optional, use if you want to flag
subclasses that don't override this method
[self doesNotRecognizeSelector:_cmd];
}
@end

@interface Bar : Foo {
...
}
...
@end

@implementation Bar
- (id) init {
if ((self = [super init]) != nil) {
...
}
return self;
}
- (void) readX:(int*)x y:(int*)y {
... real implementation ...
}
@end

 Related to this, what method gets called inside the init method of the
 superclass: a) the superclass method? or b) the overriding method if there
 is one?

The later (B).

-Shawn
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to force a message to a overriding method from within an init method

2009-02-11 Thread Graham Cox


On 12 Feb 2009, at 12:31 pm, João Varela wrote:


Hi all

I am porting most of my C++ code into Objective C and at the moment  
I have this problem:


In C++ to force a constructor to call a overriding method of a  
subclass I used pure virtual functions defined in an abstract  
(super) class.


An example:

class Foo
{
Foo();
virtual read( x, y ) = 0; // pure virtual
};

class Bar : public Foo
{
Bar();

virtual Read( x, y );   // implemented in the subclass
};

// Foo constructor
Foo::Foo()
{
Read( x, y ); // -- this calls Bar::Read and not Foo::Read
  // because the latter is pure virtual
}

I know that the closest thing to a pure virtual function in  
Objective C is a formal protocol. My question is: can you implement  
such a behavior in objective C with a formal protocol?


Related to this, what method gets called inside the init method of  
the superclass: a) the superclass method? or b) the overriding  
method if there is one?


Although this is not strict Cocoa code, I think this is the best  
place to ask this kind of question. Sorry for the mild OT-ness of  
my question.


TIA

JV



Objective-C doesn't have constructors like C++. Instead there is a  
convention that after allocating the object you call its designated  
initializer (typically a method called 'init'). There is nothing  
special about the init method in terms of how it is run - it's called  
like any other method and never automatically like C++ constructors  
are. There is a convention that init must call super's designated  
initializer and return self, but otherwise it can do anything that any  
other method can do, including calling another method of self or super.


If self implements the method, and overrides a method of super, it  
will be called. You don't need to force it to call the method, since  
you have to explicitly call it using self, e.g. [self ReadWithX: y:];   
'self' is always explicit and never implicit like 'this' is in C++.  
Even if the method call is implemented by super, it will call the  
method of the actual class being inited.


Formal protocols are useful for defining what an object must  
implement, and so in some ways are similar to defining a class using  
pure virtual methods in C++, but they only force the object that  
adopts the protocol to implement the method. They do not force it to  
be called (and neither is that the case in C++).


The code example you cite above will translate directly to Objective-C  
without a formal protocol being strictly necessary, but if you wanted  
to do it that way, you could do:



@protocol Read
@optional
- (void) ReadWithX:(int) x y:(int) y;

@end

@class foo : NSObject Read

// foo is required to implement the mandatory methods defined by  
protocol Read and inherits the methods of NSObject


@end


@class bar : foo

@end


@implementation foo

- (id) init
{
self = [super init];
if( self )
[self readWithX:1 y:0];

return self;
}

@end



@implementation bar

- (void)readWithX:(int) x y:(int) y
{
// this is called when an instance of bar is initialised

}


@end


Note that the read method here is @optional, meaning that it's not  
strictly required by the protocol. This is an Objective-C 2.0 feature,  
and allows foo not to have to implement it. The default is @required  
which is more like a pure virtual function, in that it has to be  
implemented, but in that case foo would have to have an implementation  
of it as well, even if it were just an empty stub. There is no exact  
equivalent of a pure virtual, which allows foo to treat it as  
@optional, but a subclass as @required.


In the above example, if an instance of foo were created, you would  
get a runtime error when it tried to call readWithX:y: on itself,  
because the method doesn't exist. The same problem would occur in C++  
trying to invoke a pure virtual method that didn't exist.


--Graham




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to force a message to a overriding method from within an init method

2009-02-11 Thread Erik Buck
Calling a subclass's overridden implementation of a superclass member  
function from within the super class constructor is very very  
dangerous in C++.  I don't believe if is even supported by the ANSI/ 
ISO standard, and to the extent it works at all, it is probably  
compiler and linker dependent.  I could be wrong of course.  This may  
be one of the more obscure border cases in the world's most complex  
language.



In Objective-C, the subclass's override of the base class method will  
be be called polymorphicly because there is no such thing as a  
constructor in Objective-C.  Methods like +alloc and -init are just  
regular methods.


#import Foundation/Foundation.h

@interface Base : NSObject
{
}

- (void)printName;

@end


@implementation Base

- (id)init
{
   self = [super init];

   [self printName];

   return self;
}

- (void)printName
{
   printf(I am the base class implementation.\n);
}

@end


@interface Subclass : Base
{
}

@end


@implementation Subclass

- (void)printName
{
   printf(I am the subclass implementation.\n);
}


@end


int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

   Subclass   *sample = [[Subclass alloc] init];

   [sample release];


[pool drain];
return 0;
}


Output will be
[Session started at 2009-02-11 21:27:00 -0500.]
I am the subclass implementation.

The Debugger has exited with status 0.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Graham Cox


On 12 Feb 2009, at 12:27 pm, Louis Demers wrote:

I Had not thought about plugins because all the devices are  
identical in capabilities. The devices are complex cameras. I wanted  
to have each cameras have it document window to display the specific  
video feed, but a single palette to control the brightness/zoom of  
the frontmost window/camera. This is an over simplification because  
in reality, each camera has lots of controls and status. If each  
camera/device has its own exclusive gui element, the screen will be  
cluttered beyond acceptable.  I was modeling my solution around  
something like Photoshop or Illustrator where multiple documents use  
the same set of palettes.



What you're saying is that you have many cameras, but want to control  
one at a time. You are using the active window (or document) as a  
selection mechanism to choose which camera to control.


Seems to me that if you want one camera per window, you'd want the  
controls for that camera in that window, though I see what you're  
saying about having too many controls. Maybe it's the selection  
mechanism that needs more thought? You could have a single window with  
a list of cameras and you select one to control. Then it becomes more  
like a master-detail interface which would be probably more manageable.


If you do want to stick to one window per camera and have the controls  
apply to the from window, you can use notifications to listen for  
window activate/deactivate notifications and track down the related  
camera via the window's controller, which would be a class you  
developed.


--Graham


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextView and keyDown: in the responder chain

2009-02-11 Thread Tom

Hi everyone,

From what I've read about [NSResponder keyDown], if the responder  
doesn't handle the event it should pass the event to [self  
nextResponder] or NSBeep() if it doesn't have a next responder.


However, I've found that when an NSTextView receives a keyDown event  
that doesn't handle, it doesn't bother to send the event down the  
responder chain and just calls NSBeep(). This is a problem because I  
have a special responder at the end of the chain that receives all  
unhandled keyDown events. Everything works fine except when the  
keyDown event happens in a NSTextView (such as a window's field editor).


Is this a bug in NSTextView or am I missing something?


Kind regards,

Tom
Vigital

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextView and keyDown: in the responder chain

2009-02-11 Thread Graham Cox


On 12 Feb 2009, at 1:59 pm, Tom wrote:


Is this a bug in NSTextView or am I missing something?



Have you actually set the next responder of the field editor/text  
view? I think you have to actually do that explcitly (- 
setNextResponder:)


--Graham


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextView and keyDown: in the responder chain

2009-02-11 Thread Tom


On 12/02/2009, at 1:06 PM, Graham Cox wrote:



On 12 Feb 2009, at 1:59 pm, Tom wrote:


Is this a bug in NSTextView or am I missing something?



Have you actually set the next responder of the field editor/text  
view? I think you have to actually do that explcitly (- 
setNextResponder:)


--Graham




Yes. I've overriden keyDown on one of the NSTextView objects and  
checked that the responder chain is correct. In the override, if I  
bypass the text view with:


 [[self nextResponder] keyDown:event]

then the event is sent down the whole chain, but if I call:

[super keyDown:event]

it beeps and the event doesn't go anywhere.


Kind regards,

Tom





___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Louis Demers


On 11-Feb-09, at 21:16 , Kyle Sluder wrote:


Nothing about this requires you to use the NSDocument architecture.
You would implement the palettes the same way as you would for a
document-based app.


and fundamentally, that is the part I do not know how and asked in a  
clumsy way 8-(



 I'm just wondering if it is appropriate for what
you're trying to do.


indeed, I'm not bent on using a document based app, I just tought it  
mit offer the mechanism or support to help rederriect my palettes'  
bindings to the proper object.



Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Louis Demers


On 11-Feb-09, at 21:30 , Graham Cox wrote:



On 12 Feb 2009, at 12:27 pm, Louis Demers wrote:

I Had not thought about plugins because all the devices are  
identical in capabilities. The devices are complex cameras. I  
wanted to have each cameras have it document window to display the  
specific video feed, but a single palette to control the brightness/ 
zoom of the frontmost window/camera. This is an over simplification  
because in reality, each camera has lots of controls and status. If  
each camera/device has its own exclusive gui element, the screen  
will be cluttered beyond acceptable.  I was modeling my solution  
around something like Photoshop or Illustrator where multiple  
documents use the same set of palettes.



What you're saying is that you have many cameras, but want to  
control one at a time. You are using the active window (or document)  
as a selection mechanism to choose which camera to control.


Seems to me that if you want one camera per window, you'd want the  
controls for that camera in that window, though I see what you're  
saying about having too many controls. Maybe it's the selection  
mechanism that needs more thought? You could have a single window  
with a list of cameras and you select one to control.


I considered that and I'm still interested in that solution.

Then it becomes more like a master-detail interface which would be  
probably more manageable.


If you do want to stick to one window per camera and have the  
controls apply to the from window, you can use notifications to  
listen for window activate/deactivate notifications and track down  
the related camera via the window's controller, which would be a  
class you developed.


I do not care about sticking with that paradigm of one window per  
camera, but I'm conformable with that approach. But how to I get all  
the sliders and gui elements of my palettes to now bind to the object/ 
camera that is selected.


In my current app, in the bindings inspector of the gui element, I  
select my instantiated object in the bind to popup and enters the  
model key path to the key of my object I want to control/display. That  
works because the instantiated object in unique and in my MainMenu.xib.


But in the above scenarios, how do I configure my binding ? the key is  
the same all over, but the bound object will be swapped by whatever  
selection process I end up using. Or do I have hit a limit of the  
binding mechanism. I doubt it, more likely a limit of my own  
understanding of bindings 8-)







--Graham




Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Graham Cox


On 12 Feb 2009, at 3:04 pm, Louis Demers wrote:

I do not care about sticking with that paradigm of one window per  
camera, but I'm conformable with that approach. But how to I get all  
the sliders and gui elements of my palettes to now bind to the  
object/camera that is selected.


In my current app, in the bindings inspector of the gui element, I  
select my instantiated object in the bind to popup and enters the  
model key path to the key of my object I want to control/display.  
That works because the instantiated object in unique and in my  
MainMenu.xib.


But in the above scenarios, how do I configure my binding ? the key  
is the same all over, but the bound object will be swapped by  
whatever selection process I end up using. Or do I have hit a limit  
of the binding mechanism. I doubt it, more likely a limit of my own  
understanding of bindings 8-)



OK, I understand your question. I'm not in a good position to answer  
it definitively as I haven't used bindings myself - I still tend to do  
things using KVO directly since my current project predates bindings.


However, in general, I think what you need to is to have a single  
controller object that you bind your controls to, and swap the  
connection to the data model object that represents the selected  
camera. Then when the camera is switched you are changing just that  
one object reference, not all the individual bindings. I believe that  
generic controllers such as NSArrayController will handle that pretty  
much for you - you just bind to 'selection.whatever' (bondage experts  
please correct any misinformation here). That could also permit you to  
have a multiple selection of cameras and control several  
simultaneously if that makes sense for you.


--Graham




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Louis Demers


On 11-Feb-09, at 23:11 , Graham Cox wrote:



On 12 Feb 2009, at 3:04 pm, Louis Demers wrote:

I do not care about sticking with that paradigm of one window per  
camera, but I'm conformable with that approach. But how to I get  
all the sliders and gui elements of my palettes to now bind to the  
object/camera that is selected.


In my current app, in the bindings inspector of the gui element, I  
select my instantiated object in the bind to popup and enters the  
model key path to the key of my object I want to control/display.  
That works because the instantiated object in unique and in my  
MainMenu.xib.


But in the above scenarios, how do I configure my binding ? the key  
is the same all over, but the bound object will be swapped by  
whatever selection process I end up using. Or do I have hit a limit  
of the binding mechanism. I doubt it, more likely a limit of my own  
understanding of bindings 8-)



OK, I understand your question. I'm not in a good position to answer  
it definitively as I haven't used bindings myself - I still tend to  
do things using KVO directly since my current project predates  
bindings.


However, in general, I think what you need to is to have a single  
controller object that you bind your controls to, and swap the  
connection to the data model object that represents the selected  
camera. Then when the camera is switched you are changing just that  
one object reference, not all the individual bindings. I believe  
that generic controllers such as NSArrayController will handle that  
pretty much for you - you just bind to 'selection.whatever' (bondage  
experts please correct any misinformation here).


So the controller manages to reconnect the bindings to the selected  
objects. ! That would make sense. All that's left if to figure out the  
implementation details and coerce IB to do what I want. I'll try  
building a small test app.


That could also permit you to have a multiple selection of cameras  
and control several simultaneously if that makes sense for you.


that would definitively be a plus. The app is designed for calibrating  
and measuring performance of our cameras. Sending the same settings to  
multiple cameras would be an interesting capability during quality  
control.



Thanks for the cue, I'll keep investigating.



Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Transparent Image

2009-02-11 Thread Michael Ash
On Wed, Feb 11, 2009 at 3:41 PM, Christian Graus
christian.gr...@gmail.com wrote:
 Please file a bug and request this functionality.
 OK - that would not have occurred to me at all.  That works in the Mac world
 ? Awesome !! I've found plenty of Microsoft bugs, and I was even an MVP at
 the time, they always ignored me, or told me they were features ( and I
 found some MAJOR bugs in WPF ).  I assume if I go to the Apple Dev
 Connection and log in, I'll be able to find a place to log bugs ?

Hah, Apple do something about filed bugs, right. Looking at the list
of bugs I've filed, the most common state is Open. The next most
common state is Duplicate. And don't think that Duplicate means
your bug gets merged into the original and now you get told about
what's happening with the original bug. No, Duplicate is a black
hole of information. Once your bug is marked Duplicate, you lose,
game over, no more information will be arriving, ever.

Filing bugs can be worthwhile. Perhaps 5% of the time it actually gets
results. But be prepared for very little reward.

Mike
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Michael Ash
On Wed, Feb 11, 2009 at 11:29 PM, Louis Demers louisdem...@mac.com wrote:
 So the controller manages to reconnect the bindings to the selected objects.
 ! That would make sense. All that's left if to figure out the implementation
 details and coerce IB to do what I want. I'll try building a small test app.

Remember that you can bind to a key *path*, not just to a key. And
that a change to any element along the path will update the binding.

With that in mind, I would do this by putting an NSObjectController in
the nib for each palette. Your window controller for the palette
should then observe NSWindowDidBecomeMainNotification and update the
NSObjectController's content pointer to point to the document
corresponding to whatever window is currently the main window. Change
that one pointer, all your bindings re-point, everything is rosy.

Mike
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Application Architecture or approach

2009-02-11 Thread Louis Demers


On 11-Feb-09, at 23:39 , Michael Ash wrote:


Your window controller for the palette
should then observe NSWindowDidBecomeMainNotification and update the
NSObjectController's content pointer to point to the document
corresponding to whatever window is currently the main window. Change
that one pointer, all your bindings re-point, everything is rosy.


Ok, that sounds promising, but, when one of the element on the path  
changes like
the document, will all the gui element of the palette be triggered to  
refresh

the displayed value to newly selected document value ?


Louis Demers eng.
www.obzerv.com


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Paste with no Edit Menu

2009-02-11 Thread Development Staff
You want to subclass NSWindow and override -sendEvent:, which will let  
you get at the keyboard events before the rest of the standard event  
handling stuff gets at it. You will use your subclass of NSWindow for  
your windows.


Alternately you could subclass NSApp and override -sendEvent: there. I  
did something similar by subclassing NSWindow, but you may find that  
you need to hijack the event earlier in the process (e.g. at NSApp).  
Try both ways.


See http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html 
 for details, specifically the section on Event Dispatch.


On Feb 11, 2009, at 2:28 PM, Andy Bell wrote:


Hi All,

I am working on a project which is an Agent and just has a couple on  
Windows
and a menu bar icon.  The menu bar icon has a menu which is used to  
call up
the two windows.  Now I want to add 'Command-V' so that I can paste  
into the
NSTextFields in this window, as I don't have the standard Edit menu  
I need
to catch this command in some other way.  I did first try to add a  
menu item
for pasting in the menu bar menu and hooking it into the First  
responder

paste selector but that didn't work.  Any ideas?

Thanks in advance
Andy
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dev_staff%40medhavisoftware.com

This email sent to dev_st...@medhavisoftware.com



Jeffrey Dutky
Senior Software Engineer
Medhavi Software Inc.
jeff...@medhavisoftware.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com