Re: memory allocation different in simulator and on the iPhone

2009-07-28 Thread Sven
UIImage* image = [UIImage imageNamed:fileName];

Loading an image with imageNamed causes the image to be cached in memory as
per the documentation.

I suggest using one of the alternatives to load your images and see how that
affects memory usage

./Sven

2009/7/24 Dragos Ionel 

> You are right, I was over releasing and maybe that was crashing the app.
> But still, even without [image release] the memory used by the app on
> iPhone
> is slowly increasing (like 3K for each image display). Maybe that is
> supposed to happen , maybe something is cached somewhere.
>
> But the good thing is it did not crash anymore after 200-300 images
> displayed.
>
> Thanks a lot,
> Dragos
>
>
> On Fri, Jul 24, 2009 at 3:14 AM, Jonathan del Strother <
> maill...@steelskies.com> wrote:
>
> > UIImage* image = [UIImage imageNamed:fileName];
> > UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
> > [image release];
> >
> > You're overreleasing the image there.  You sure the phone is dying
> > because it's out of memory, rather than because of that?
> >
> > On Fri, Jul 24, 2009 at 3:07 AM, Dragos Ionel
> > wrote:
> > > Hi,
> > > I am working on a animal encyclopedia on iPhone. One of the pages
> > displays
> > > one photo of an animal. When the user swipes the screen the image is
> > > replaced with another one.
> > >
> > > This works fine and when tested in the simulator with the Instrument
> for
> > > Object Allocation, all looks cool.
> > >
> > > When I tested on the real iPhone with Instrument, the memory used
> > increases
> > > slowly but constantly so that eventually the application dies.
> > >
> > > Here is the method that is doing the image changing (direction means if
> > the
> > > new image should come from left or from right). The class is a
> > > UIViewController
> > >
> > >
> > > -(void) displayAnimal: (int) animaIndex fromDirection:(int)direction{
> > >
> > >  crtIndex = animaIndex;
> > >
> > >  NSString* animalName = [[animalList objectAtIndex:animaIndex]
> > objectForKey:
> > > @"name"];
> > >
> > > NSString* fileName   = [[animalList objectAtIndex:animaIndex]
> > objectForKey:
> > > @"file"];
> > >
> > >  self.title = animalName;
> > >
> > >  //remove all the subviews
> > >
> > > for (UIView *view in self.view.subviews) {
> > >
> > > [view removeFromSuperview];
> > >
> > > }
> > >
> > >  UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0,
> 0,
> > 320,
> > > 480)];
> > >
> > > backgroundView.backgroundColor = [UIColor blackColor];
> > >
> > > [self.view addSubview:backgroundView];
> > >
> > > [backgroundView release];
> > >
> > >  UIImage* image = [UIImage imageNamed:fileName];
> > >
> > > UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
> > >
> > > [image release];
> > >
> > >  CGRect imageFrame = imageView.frame;
> > >
> > > imageFrame.origin = CGPointMake(320*direction,0);
> > >
> > > imageView.frame = imageFrame;
> > >
> > >  [self.view addSubview:imageView];
> > >
> > >
> > >  [UIView beginAnimations: nil context: @"identifier"];
> > >
> > > [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
> > >
> > > [UIView setAnimationDuration:0.5];
> > >
> > >  imageFrame.origin = CGPointMake(0,0);
> > >
> > > imageView.frame = imageFrame;
> > >
> > >  [UIView commitAnimations];
> > >
> > > [imageView release];
> > >
> > > }
> > >
> > > Can you see anything that is not right? Why is the memory allocation
> > showing
> > > different in simulator and on the iPhone?
> > >
> > > Thanks a lot,
> > > Dragos
> > > ___
> > >
> > > 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/maillist%40steelskies.com
> > >
> > > This email sent to maill...@steelskies.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/svenito%40gmail.com
>
> This email sent to sven...@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


NSCollectionView, Draggable View & Selection

2009-07-28 Thread Arthur Carli
Hi all,
I've been playing with the NSCollectionView control for some time now, and
I'm stuck with this problem :
So I've a collection view, with a prototype view. I wanted the prototype
view to be dragable, so I've subclassed the NSView prototype and implemented
mouseDown: and mouseDragged:.
All works fine.
The only problem is that the NSCollectionViewItems can't be selected
anymore, unless I add a [super mouseDown:event] in my mouseDown:
implementation... but in this case, the dragging won't work :-/.

To sum up :

With this one, DRAGGING : OK, SELECTION : NOT OK

> -(void)mouseDown:(NSEvent *)event
> {
> [event retain];
> [mouseDownEvent release];
> mouseDownEvent =event;
>
> if([event clickCount]>1)
> {
> NSNotificationCenter * nc =[NSNotificationCenter defaultCenter];
> [nc postNotificationName:@"ViewParticipantDoubleClick"
> object:self];
> }
> }
>

And this one, DRAGGING : NOT OK, SELECTION : OK

> -(void)mouseDown:(NSEvent *)event
> {
> [event retain];
> [mouseDownEvent release];
> mouseDownEvent =event;
>

>
   [super mouseDown:event];


>
if([event clickCount]>1)
> {
> NSNotificationCenter * nc =[NSNotificationCenter defaultCenter];
> [nc postNotificationName:@"ViewParticipantDoubleClick"
> object:self];
> }
> }


I believe it has something to do with the first responder, but I can't
figure clearly were the problem is.

Any idea what the problem might be ?

Thanks in advance

Arthur C.
___

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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Simon Hickmott
I don't really agree, as others have suggested, that this is a  
hammering a Mac-shaped peg into a Windows-shaped hole problem we're  
dealing with here. There are many successful Mac applications which  
use a tabbed view to consolidate multiple documents: TextMate comes  
immediately to mind — you wouldn't want multiple separate windows on  
screen when developing a Rails app, let me tell you. The solution  
there is to use an NSDrawer to manage a directory tree, with a tabbed  
view for navigating through opened documents. Mail and XCode's  
Organizer use a split view, similarly, without the baffling-to-some- 
users,-it-seems Drawer. The way I see it, there's no need to resort to  
any third party jiggery-pokery to achieve your solution when the Cocoa  
tools are already there, all of which comply with Apple's HIG.



On 27 Jul 2009, at 04:46, David Blanton wrote:

I am the only Mac programmer where I work;  the rest being  
windows.  I am constantly challenged to make Mac programs look like  
windows to some extent.


___

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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Rippit the Ogg Frog
The prevalence of MDI interfaces on Windows is one of the primary 
reasons I stick with the Mac, both as a user and as a developer.


That is, it's not just that I prefer to use the Mac-standard user 
interface myself, but I also don't want to have to subject my users to 
user interfaces that I wouldn't willingly use myself.


I've been a software engineer for twenty-one years, the majority of 
those spent coding for the Mac.  And I can tell you - and you can quote 
me - that just about the best way for a Mac product to achieve poor 
reviews in the trade press is to make it look and act just like a 
Windows program.


Look up the Macintosh User Interface guidelines at 
http://developer.apple.com/ and send the link to your coworkers. 
Emphasize the importance of a native look and feel.


--
Rippit the Ogg Frog
rip...@oggfrog.com
http://www.oggfrog.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


NSTextView - NSAttributedString paragraph style attributes

2009-07-28 Thread listsapple


Adding an NSParagraphStyle to an NSMutableAttributedString then  
stuffing the string into an NSTextView crashes my app. Anyone know if  
NSParagraphStyles are supported in NSTextView?


Bernie



___

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


where can I download xcode 3.2

2009-07-28 Thread YongLi
I have installed the snow leopardbut i can't find the download link of xcode
3.2

-- 
Name: Yong Li
E-mail: liyon...@gmail.com
Address: Room 3-523, FIT Building, Tsinghua University, Beijing, China.
100084.
___

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


Checks required for multiple asynchronous NSURLConnections?

2009-07-28 Thread Debajit Adhikary
I have multiple asynchronous HTTP requests being made at the same time. All
these use the same NSURLConnection delegate functions. (The receivedData
object is different for each connection though—this is done using a
dictionary with the key as the connection itself. In the delegate, I parse
the receivedDate object, and do additional operations on those parsed
strings)

Everything seems to work fine for me so far, but I'm not sure if I need to
do anything specific to ensure correct “multithreaded” behavior.

   - Is it possible that more than two connections will use the delegate at
   the same time? (I would think so)
   - If yes, how is it resolved? (Does Cocoa do this automatically?)
   - Do I need to have additional checks in place to ensure that each
   request is handled “correctly”?
___

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: where can I download xcode 3.2

2009-07-28 Thread Kyle Sluder

On Jul 27, 2009, at 10:38 AM, YongLi  wrote:

I have installed the snow leopardbut i can't find the download link  
of xcode

3.2


1. This is cocoa-dev. This list exists for the discussion of Cocoa,  
not for downloading seeds or other non-Cocoa topics.
2. Snow Leopard and the developer tools are distributed under NDA and  
you therefore can't talk about them publicly. NDA forums can be found  
at http://devforums.apple.com.
3. All the downloads are in the same place: the Mac dev center at http://developer.apple.com 
.


--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: Checks required for multiple asynchronous NSURLConnections?

2009-07-28 Thread Jean-Daniel Dupas


Le 28 juil. 09 à 09:07, Debajit Adhikary a écrit :

I have multiple asynchronous HTTP requests being made at the same  
time. All
these use the same NSURLConnection delegate functions. (The  
receivedData

object is different for each connection though—this is done using a
dictionary with the key as the connection itself. In the delegate, I  
parse

the receivedDate object, and do additional operations on those parsed
strings)

Everything seems to work fine for me so far, but I'm not sure if I  
need to

do anything specific to ensure correct “multithreaded” behavior.

  - Is it possible that more than two connections will use the  
delegate at

  the same time? (I would think so)
  - If yes, how is it resolved? (Does Cocoa do this automatically?)
  - Do I need to have additional checks in place to ensure that each
  request is handled “correctly”?


Asynchronous does not mean multithreaded.

Now a simple exercice.
Open the NSURLConnection reference. search for thread.

First answer:

Note that these delegate methods will be called on the thread that  
started the asynchronous load operation for the associated  
NSURLConnection object.



___

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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Graham Cox
But a tabbed interface is quite different from MDI, even if to some  
extent it's solving a similar problem. Maybe a tabbed interface can be  
considered a "Mac solution" to the MDI problem, but I would suggest it  
only works sometimes. Xcode is a good example of something that would  
probably be done as an MDI interface on Windows. It's more limited, in  
that you can't place each panel anywhere you like, or rearrange them,  
but that's a Good Thing - it allows you some freedom to set up the UI  
as you need it but not so much that you don't know roughly where to  
find what you want - it's stable.


On Safari, the tabbed interface is good - I use it a lot - but you can  
drag a tab out and make it a separate window if you want. MDI doesn't  
allow that.


MDI is a solution to a problem of Windows' own making, where window ==  
process. As we are not stuck with that false equality, we have no need  
to make an MDI interface on the platform to solve the problem that a  
single process has multiple windows. There are plenty of examples on  
the Mac of consolidating things into a single window, all of them  
superior to MDI.


The people that the OP works for (and with) appear to have forgotten  
that by definition, the app they are building for the Mac is going to  
be used by Mac users, not Windows users, nor themselves, so why they  
would insist on forcing a UI parity between the two products is beyond  
my comprehension.


--Graham



On 27/07/2009, at 8:22 PM, Simon Hickmott wrote:

I don't really agree, as others have suggested, that this is a  
hammering a Mac-shaped peg into a Windows-shaped hole problem we're  
dealing with here. There are many successful Mac applications which  
use a tabbed view to consolidate multiple documents: TextMate comes  
immediately to mind — you wouldn't want multiple separate windows on  
screen when developing a Rails app, let me tell you. The solution  
there is to use an NSDrawer to manage a directory tree, with a  
tabbed view for navigating through opened documents. Mail and  
XCode's Organizer use a split view, similarly, without the baffling- 
to-some-users,-it-seems Drawer. The way I see it, there's no need to  
resort to any third party jiggery-pokery to achieve your solution  
when the Cocoa tools are already there, all of which comply with  
Apple's HIG.



On 27 Jul 2009, at 04:46, David Blanton wrote:

I am the only Mac programmer where I work;  the rest being  
windows.  I am constantly challenged to make Mac programs look  
like windows to some extent.




___

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: Checks required for multiple asynchronous NSURLConnections?

2009-07-28 Thread Kyle Sluder
On Jul 28, 2009, at 12:07 AM, Debajit Adhikary   
wrote:


  - Is it possible that more than two connections will use the  
delegate at

  the same time? (I would think so)


Asynchronous does not always mean your callbacks are invoked on  
another thread -- or that threads are even involved at all. The system  
can synchronously dispatch the HTTP connection, ad itself as an input  
source to the current runloop, and return to your code, firing at the  
appropriate time.


Since the documentation states that callbacks are called on the same  
thread as the asynchronous call is made, two can't execute at once (as  
long as all your connections are made on the same thread).



  - If yes, how is it resolved? (Does Cocoa do this automatically?)


Re-read the run loops documentation and then the NSURLConnection  
documentation again.


--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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Andy Lee
A tabbed view is not MDI, at least not the MDI I recall from many  
years ago.  Also, David didn't only ask about addressing the same  
issues as MDI (roughly speaking: single window, multiple documents),  
he asked about *looking* like Windows.  He did ask about tabs, but if  
that's *all* he was asking, I agree, the answer should have been  
obvious, although I missed the *really* obvious example you pointed  
out -- Xcode.


I still think it's unclear what the real needs are in this  
organization, or the perceived ones, for that matter.  Why are Windows  
programmers telling the Mac guy what to do?  How is their challenge  
helping anybody, least of all themselves?


--Andy

On Jul 27, 2009, at 6:22 AM, Simon Hickmott wrote:

I don't really agree, as others have suggested, that this is a  
hammering a Mac-shaped peg into a Windows-shaped hole problem we're  
dealing with here. There are many successful Mac applications which  
use a tabbed view to consolidate multiple documents: TextMate comes  
immediately to mind — you wouldn't want multiple separate windows on  
screen when developing a Rails app, let me tell you. The solution  
there is to use an NSDrawer to manage a directory tree, with a  
tabbed view for navigating through opened documents. Mail and  
XCode's Organizer use a split view, similarly, without the baffling- 
to-some-users,-it-seems Drawer. The way I see it, there's no need to  
resort to any third party jiggery-pokery to achieve your solution  
when the Cocoa tools are already there, all of which comply with  
Apple's HIG.



On 27 Jul 2009, at 04:46, David Blanton wrote:

I am the only Mac programmer where I work;  the rest being  
windows.  I am constantly challenged to make Mac programs look  
like windows to some extent.


___

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/aglee%40mac.com

This email sent to ag...@mac.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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Andy Lee


On Jul 28, 2009, at 3:29 AM, Graham Cox wrote:
MDI is a solution to a problem of Windows' own making, where window  
== process. As we are not stuck with that false equality, we have no  
need to make an MDI interface on the platform to solve the problem  
that a single process has multiple windows.


I never realized that was the reason for MDI.  I always thought it was  
a deliberate UI design to group all the artifacts of an application  
into one window, to lighten the cognitive load compared to an  
environment with arbitrarily overlapping windows from any number of  
applications.  I assumed this is also why Windows users like to  
maximize their windows full-screen.


This is why I suggested Command-Option-H.  It's like giving the  
frontmost application a full-screen MDI window.


--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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Kyle Sluder

On Jul 28, 2009, at 12:29 AM, Graham Cox  wrote:
MDI is a solution to a problem of Windows' own making, where window  
== process.


Please don't spread misinformation about Windows, it makes us look  
bad. Windows' concept of a window is very different from our concept  
thereof. Nothing restricts Windows apps to one window or enforces a  
window = process equality.


MDI is a design choice. One that conflicted with MS's goals for a more  
document-centric UI in Chicago/Win95 and won out.


--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: NSString and regular expressions

2009-07-28 Thread Alastair Houghton

On 28 Jul 2009, at 02:02, Rob Keniger wrote:


On 28/07/2009, at 10:38 AM, Dave DeLong wrote:


RegexKit.  Without a doubt.

http://regexkit.sourceforge.net

I use it in about 75% of my projects.


RegexKit is very nice and extremely comprehensive, but it has quite  
a large footprint and is probably overkill for many uses.


Unfortunately, RegexKit Lite (the stripped-down version) uses the  
built-in ICU library which uses a syntax quite different to the PCRE  
that most people are used to.


Since the goal in both ICU and PCRE is to be broadly compatible with  
Perl regular expression syntax, I think it's an exaggeration to say  
that the syntax is "quite different".  There are things in PCRE that  
aren't supported in ICU, and vice-versa.  And neither of them support  
everything that is implemented in Perl (partly because you'd have to  
actually *implement* Perl to do it).


Kind regards,

Alastair.

--
http://alastairs-place.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: NSTextView - NSAttributedString paragraph style attributes

2009-07-28 Thread Alastair Houghton

On 27 Jul 2009, at 17:32, listsapple wrote:

Adding an NSParagraphStyle to an NSMutableAttributedString then  
stuffing the string into an NSTextView crashes my app. Anyone know  
if NSParagraphStyles are supported in NSTextView?


They most certainly are.

(FWIW, it isn't really a case of them "being supported in NSTextView",  
since it's the layout manager and typesetter that will care about the  
paragraph styles, and you could use them without NSTextView/NSText if  
you wanted.)


If I had to guess, you're probably over-releasing your  
NSParagraphStyle or some such, but since you haven't shown us any code  
we obviously can't see exactly what the error is.


Kind regards,

Alastair.

--
http://alastairs-place.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: NSString and regular expressions

2009-07-28 Thread jonat...@mugginsoft.com


On 28 Jul 2009, at 10:26, Alastair Houghton wrote:


On 28 Jul 2009, at 02:02, Rob Keniger wrote:


On 28/07/2009, at 10:38 AM, Dave DeLong wrote:


RegexKit.  Without a doubt.

http://regexkit.sourceforge.net

I use it in about 75% of my projects.


RegexKit is very nice and extremely comprehensive, but it has quite  
a large footprint and is probably overkill for many uses.


Unfortunately, RegexKit Lite (the stripped-down version) uses the  
built-in ICU library which uses a syntax quite different to the  
PCRE that most people are used to.


Since the goal in both ICU and PCRE is to be broadly compatible with  
Perl regular expression syntax, I think it's an exaggeration to say  
that the syntax is "quite different".  There are things in PCRE that  
aren't supported in ICU, and vice-versa.  And neither of them  
support everything that is implemented in Perl (partly because you'd  
have to actually *implement* Perl to do it).



NSPredicate anyone?
The MATCHES operator uses ICU's Regular Expressions package.
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pUsing.html#/ 
/apple_ref/doc/uid/TP40001794-SW9

Kind regards,

Alastair.

--
http://alastairs-place.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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Developer
http://www.mugginsoft.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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Alastair Houghton

On 28 Jul 2009, at 09:09, Kyle Sluder wrote:

On Jul 28, 2009, at 12:29 AM, Graham Cox   
wrote:
MDI is a solution to a problem of Windows' own making, where window  
== process.


Please don't spread misinformation about Windows, it makes us look  
bad. Windows' concept of a window is very different from our concept  
thereof. Nothing restricts Windows apps to one window or enforces a  
window = process equality.


Quite.  I was going to point that out also; there certainly used to be  
apps on Windows used top-level windows in a Mac-like way (indeed,  
Visual Basic used to do this before it became part of Visual Studio,  
as did Delphi and its cousin C++ Builder, and arguably most web  
browsers---including Internet Explorer---still do).


Windows' concept of a window is certainly more fine-grained than on OS  
X; they're more like NSViews than NSWindows in many respects, and  
indeed many controls *are* windows on Windows (though some, as an  
"optimisation", were built to draw into their parent window in a  
manner somewhat analogous to the relationship between NSControl and  
NSCell... obviously this means that the parent window needs special  
support for this arrangement, which can be irritating as it's usually  
just a normal window or a group box or something as opposed to an  
NSControl analogue).


MDI is a design choice. One that conflicted with MS's goals for a  
more document-centric UI in Chicago/Win95 and won out.


Indeed.

Anyway, debate over MDI versus document-per-window is not really  
needed here and is in danger of drifting off topic.  We all know the  
pros and cons.


The important thing to take away from this, I think, is that as a  
general rule your application will look and feel bad if it doesn't  
match the UI style that is expected on a particular platform.  Windows  
apps that try to do a document-per-window approach will probably  
attract criticism from Windows users, just as Mac apps that try to do  
MDI will annoy many Mac users.


Kind regards,

Alastair.

--
http://alastairs-place.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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Jean-Daniel Dupas


Le 28 juil. 09 à 11:53, Alastair Houghton a écrit :


On 28 Jul 2009, at 09:09, Kyle Sluder wrote:

On Jul 28, 2009, at 12:29 AM, Graham Cox   
wrote:
MDI is a solution to a problem of Windows' own making, where  
window == process.


Please don't spread misinformation about Windows, it makes us look  
bad. Windows' concept of a window is very different from our  
concept thereof. Nothing restricts Windows apps to one window or  
enforces a window = process equality.


Quite.  I was going to point that out also; there certainly used to  
be apps on Windows used top-level windows in a Mac-like way (indeed,  
Visual Basic used to do this before it became part of Visual Studio,  
as did Delphi and its cousin C++ Builder, and arguably most web  
browsers---including Internet Explorer---still do).


Windows' concept of a window is certainly more fine-grained than on  
OS X; they're more like NSViews than NSWindows in many respects, and  
indeed many controls *are* windows on Windows (though some, as an  
"optimisation", were built to draw into their parent window in a  
manner somewhat analogous to the relationship between NSControl and  
NSCell... obviously this means that the parent window needs special  
support for this arrangement, which can be irritating as it's  
usually just a normal window or a group box or something as opposed  
to an NSControl analogue).


MDI is a design choice. One that conflicted with MS's goals for a  
more document-centric UI in Chicago/Win95 and won out.


Indeed.

Anyway, debate over MDI versus document-per-window is not really  
needed here and is in danger of drifting off topic.  We all know the  
pros and cons.


The important thing to take away from this, I think, is that as a  
general rule your application will look and feel bad if it doesn't  
match the UI style that is expected on a particular platform.   
Windows apps that try to do a document-per-window approach will  
probably attract criticism from Windows users […]



Really ? From MSDN page about MDI ;-)

Note  MDI is an application-oriented model. Many new and intermediate  
users find it difficult to learn to use MDI applications. Therefore,  
many applications are switching to a document-oriented model.  
Therefore, you may want to consider other models for your user  
interface. However, you can use MDI for applications which do not  
easily fit into an existing model until a more suitable model is  
introduced.


___

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


Building iPhone application as backward compatible

2009-07-28 Thread Mahaboob
I developed an iPhone application using iPhone OS 3.0 and build it against
iPhone OS 2.2. The application uses MessageUI.Framework It is tested in
simulator 3.0. Then from simulator,I changed the Hardware version to 2.2 and
is working fine. My iPhone is having the OS version 2.2. Now I need to test
the application in iPhone without upgrading the OS.
How can I do it ? 
When I'm debugging the application by selecting the Active SDK to  iPhone
Device 2.2, it yields a lots of errors.

Thanks in advance
Mahaboob


___

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: Cocoa Document-Based App v. Windows MDI App

2009-07-28 Thread Graham Cox


On 28/07/2009, at 6:09 PM, Kyle Sluder wrote:

Please don't spread misinformation about Windows, it makes us look  
bad. Windows' concept of a window is very different from our concept  
thereof. Nothing restricts Windows apps to one window or enforces a  
window = process equality.



Well, OK, I apologise if it was. I'm not and never have been to any  
serious extent a Windows programmer - but I did do a week's training  
(at someone else's insistence and expense) on "Advanced Systems  
Programming for Windows" in about 1998, and this was one of the first  
things we were told in the introductory session. It's probably the one  
thing I can recall from it, so if it's wrong, that's a week I'll never  
get back...


 --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: NSTableView cell editing begin / end notifications?

2009-07-28 Thread Alexander Bokovikov

Hi, All,

As soon as I have no replies, I will try to reduce my problem scope...

As far as I can see now, there are no suitable messages/notifications  
in standard Cocoa classes, which could serve, as notifiers of the cell  
editor session start/stop. I've found a code snipped, showing, how to  
create my own cell editor subclass:
-(id) windowWillReturnFieldEditor:(NSWindow *)sender toObject: 
(id)anObject {

if ([anObject isKindOfClass:[NSTextField class]]) {
return [[[myCustomFieldEditor alloc] init] autorelease];
}
return nil;
}
I've assigned my AppController, as the main window delegate, then  
created my own cell editor, as a derivative from NSTextView, and am  
trying to create it, as it is shown above.
There is a problem - "if" operator, shown above, is never true. So, my  
cell editor is never created and the result of this method is always  
nil.

Am I missing something?
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


NSPopUpButtonCell needs Extra Oomph to -display

2009-07-28 Thread Jerry Krinock
One of the columns in my NSTableView has its cell set to an  
NSPopUpButtonCell.  This is all built very conventionally, in  
Interface Builder.  I have bound to Content, Content Values and  
Selected Object, and it all functions correctly.


Except, and this started a couple weeks ago during development and I  
can't explain why, when the view is initially displayed, the cell in  
the selected row is "whited out".  It draws immediately if I click on  
this row, or if I do anything to cause redrawing, such as activating a  
different application whose windows don't cover the cell.  Also, when  
I click on the cell in one of the rows, it immediately "whites out"  
the value being displayed in the other rows above and below it.  They  
remain whited out after I have dismissed the popup.


I kludge-fixed the first problem by subclassing the table view and  
sending extra -display messages to it, strategically delayed after - 
viewDidMoveToWindow.  Really stinks.


I kludge-fixed the second problem by subclassing the cell and sending  
a -display message to the table view whenever the popup is "hit" or  
dismissed.


So now, the cells are still whited out initially but they reappear  
after a fraction of a second.


I'd also noticed that sometimes I need to click the popup cell twice  
before I get my menu.  The first time, the text in the clicked popup  
and the text above and/or below it in one or more nearby rows gets  
whited out.  Usually, the menu appears after 1 second but sometimes it  
does not.  I've not been able to reproduce this today.


I have implemented quite a bit of code to dynamically generate the  
popup menu for each row, but I don't believe I'm doing anything on  
other threads, certainly not in displaying the menu.  It's a  
conventional design, bindings set in Interface Builder.


Until I implemented my kludges, the table view was a plain old  
NSTableView, the cell was a plain old NSPopUpButtonCell, and the table  
column still is a plain old NSTableColumn.


Any ideas where I should push on this?

Jerry Krinock


STINKIN' CODE

@implementation SSYDisplayAlotTableView

- (void)viewDidMoveToWindow {
[super viewDidMoveToWindow] ;

// This redraws after the view is redisplayed quickly,
// such as after switching tabs
[self performSelector:@selector(display)
   withObject:nil
   afterDelay:0.1] ;

// This redraws after the view is displayed slowly,
// such as when the window initially opens
[self performSelector:@selector(display)
   withObject:nil
   afterDelay:1.0] ;

// It seems that this second -display needs to occur
// after the first display invoked by the system.
// Of course, an even longer delay may be needed for slow Macs :(
}

@end


@implementation SSYDisplayAlotPopUpButtonCell

- (void)dismissPopUp {
[super dismissPopUp] ;
[[self controlView] display] ;
}


- (NSUInteger)hitTestForEvent:(NSEvent *)event
   inRect:(NSRect)cellFrame
   ofView:(NSView *)controlView {
NSUInteger result = [super hitTestForEvent:event
inRect:cellFrame
ofView:controlView] ;
[controlView display] ;
return result ;
}

@end


___

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 - NSAttributedString paragraph style attributes

2009-07-28 Thread listsapple


Alastair Houghton wrote:


On 27 Jul 2009, at 17:32, listsapple wrote:

Adding an NSParagraphStyle to an NSMutableAttributedString then  
stuffing the string into an NSTextView crashes my app. Anyone know  
if NSParagraphStyles are supported in NSTextView?


They most certainly are.

(FWIW, it isn't really a case of them "being supported in  
NSTextView", since it's the layout manager and typesetter that will  
care about the paragraph styles, and you could use them without  
NSTextView/NSText if you wanted.)


If I had to guess, you're probably over-releasing your  
NSParagraphStyle or some such, but since you haven't shown us any  
code we obviously can't see exactly what the error is.




The crash occurs in a Carbon/Cocoa hybrid. I've since confirmed that  
it doesn't crash in a Cocoa-only app. Thanks for the double  
confirmation.


Bernie


___

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


Dynamic UI with scroll view

2009-07-28 Thread Erik Buck
NSLog(@"%@", [scrollView documentView]); //outputs (null)

What does NSLog(@"%@", scrollView ); tell you ?

// the following is a memory leak if you are not using garbage collection
[scrollView setDocumentView:[[NSView alloc]  initWithFrame:NSMakeRect(0, 0, 
500, 500)]];

Try 
[scrollView setDocumentView:[[[NSView alloc]  initWithFrame:NSMakeRect(0, 0, 
500, 500)] autorelease]];

If scrollView is not nil, the above code will do what you want except that an 
instance of plain NSView doesn't draw anything so the scroll view will look 
empty with scroll bars appropriate for a 500 by 500 document 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: Dynamic UI with scroll view

2009-07-28 Thread Fritz Anderson

On 27 Jul 2009, at 7:23 PM, Chase Meadors wrote:


NSLog(@"%@", [scrollView documentView]); //outputs (null)

[scrollView setDocumentView:[[NSView alloc]  
initWithFrame:NSMakeRect(0, 0, 500, 500)]];


NSLog(@"%@", [scrollView documentView]); //outputs (null) again


Have you verified that scrollView isn't nil?

— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second 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


Panning a View

2009-07-28 Thread David Blanton
I am putting my proprietary image content in a view in a document  
application.


I want to pan around the view with scrollers or a hand.

How do I adjust the view so the scrollers get updated allowing me to  
pan around?  (I'll deal with the hand later.)


db

___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child

Sorry, I misled you.

There is a controller object and File's owner. File's owner's class is  
set to the window controller subclass. The window outlets for both of  
the win controller and file's owner point to the window itself.


Which brings up another question: do I need the "object" (blue cube)  
at all in the nib if the file's owner is of the same class and  
presumably represents the same object. Are they redundant?


On Jul 27, 2009, at 10:57 PM, Graham Cox wrote:



On 28/07/2009, at 12:39 PM, Daniel Child wrote:

I have a master controller loading a window controller subclass,  
but for some reason, I cannot get a pointer to the window loaded in  
the XIB file. I've looked at every connection, and I've also tested  
the order by of method calls.


In the window controller's init:
[self window] yields nothing.

Likewise in awakeFromNib and windowDidLoad.

It's totally mysterious because I have practically identical setups  
in two other programs, the only difference being that they used nib  
files and this is xib. But from what I understand, that shouldn't  
matter.


For what it's worth, in the XIB file, the window outlet goes to  
File's Owner (the window controller subclass). The window contains  
a table, and (unsurprisingly) [myTable window] also yields nothing.


If this is literally true, isn't this the problem? The window outlet  
of the controller should go to... ta-d!... the WINDOW. That is,  
the actual window, not its controller, or a view within it, but the  
NSWindow object.


--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: NSWindow reference remains null after window did load

2009-07-28 Thread Dave Carrigan


On Jul 28, 2009, at 8:31 AM, Daniel Child wrote:

Which brings up another question: do I need the "object" (blue cube)  
at all in the nib if the file's owner is of the same class and  
presumably represents the same object. Are they redundant?


They are completely different things.

The blue cube object will cause a brand new object to be instantiated  
when the nib is loaded.


The file's owner is a pseudo-object - it represents an object external  
to the nib that has already been instantiated before the nib gets  
loaded.


This almost certainly explains why you seem to have two different  
objects of the same class.


--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA



PGP.sig
Description: This is a digitally signed message part
___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child
That would have been a good guess, but that's not it. Visible at  
launch is checked (ON).


On Jul 28, 2009, at 3:13 AM, cocoa-dev-requ...@lists.apple.com wrote:


This came up in another chat I had today.  In that case, the window
was not set to be visible at launch, so the system deferred actually
loading it until it was ready to be shown.  Perhaps that's happening
to you?


___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Graham Cox


On 29/07/2009, at 1:31 AM, Daniel Child wrote:

Which brings up another question: do I need the "object" (blue cube)  
at all in the nib if the file's owner is of the same class and  
presumably represents the same object. Are they redundant?


Not only are they redundant, this is almost certainly your bug.

Objects in a nib are real objects. Therefore you have two of them,  
both of the same class. Normally File's Owner is the window controller  
and this is the object you should be referring to in your code. The  
other object is getting in the way and likely causing problems.


You generally use a blue cube for any other object, such as a separate  
subcontroller that your main controller might want to use, but they  
definitely won't be the same object - they can't be, as each item in a  
nib is a distinct, real object.


--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: NSWindow reference remains null after window did load

2009-07-28 Thread Graham Cox


On 29/07/2009, at 1:39 AM, Daniel Child wrote:


Visible at launch is checked (ON)



Which is almost never what you want. Windows should generally be  
loaded on demand by the app under the direction of their window  
controller. A window visible at launch won't necessarily even have a  
controller.


--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: Panning a View

2009-07-28 Thread David Blanton

Is this the correct approach:

In the MyDocument.xib  add a scroll view to the window.

At some place in the app instance a view and set this view as the  
document view of the scroll view.


Draw into this view.

Scrollers will update etc.

Grok?

db


On Jul 28, 2009, at 9:10 AM, David Blanton wrote:

I am putting my proprietary image content in a view in a document  
application.


I want to pan around the view with scrollers or a hand.

How do I adjust the view so the scrollers get updated allowing me to  
pan around?  (I'll deal with the hand later.)


db

___

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/airedale%40tularosa.net

This email sent to aired...@tularosa.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: Panning a View

2009-07-28 Thread Graham Cox


On 29/07/2009, at 1:56 AM, David Blanton wrote:


Is this the correct approach:

In the MyDocument.xib  add a scroll view to the window.

At some place in the app instance a view and set this view as the  
document view of the scroll view.


Draw into this view.

Scrollers will update etc.



Add the view to the nib, Use Layout -> Embed Objects In -> Scroll View.

Make the size (frame) of the view bigger than the scrollview and the  
view will scroll.


--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: NSTableView cell editing begin / end notifications?

2009-07-28 Thread Alexander Bokovikov

Hi, All,

I'm sorry for flood, it's all is pretty new for me, therefore I do too  
many mistakes...


Here is, what I'm trying to do:

- (id) windowWillReturnFieldEditor:(NSWindow *)sender toObject: 
(id)anObject {

MyTitleEditor *ed;

if ([anObject isKindOfClass:[NSTextField class]]) {
ed = [[[MyTitleEditor alloc] init] autorelease];
[ed setDelegate:self];
return ed;
   }
   return nil;  
}

As far as debugger shows it, this procedure is called for every  
control in my main window. I don't understand it why, but it is called  
twice for every control, if I understand it correctly.


OK, the IF operator is true for some objects like text field (a  
label), but not only for the NSTableView cell editor. So, first of all  
I need to distinguish somehow, when this procedure is called for the  
table cell editor. How to do it? What is the "TextField" object at the  
moment, when this method is called for the table cell editor?


Another question is that my approach with the NSTextView subclassing  
seems to be not working. What I wrote, is this:


in .h file:

..
@interface MyTitleEditor : NSTextView {

}

- (BOOL)acceptsFirstResponder;
- (BOOL)becomeFirstResponder;
- (BOOL)resignFirstResponder;

@end

in .m file:
.

- (BOOL)acceptsFirstResponder {
return [super acceptsFirstResponder];
}

- (BOOL)becomeFirstResponder {
if(([self delegate] != nil) &&
	   ([[self delegate]  
respondsToSelector:@selector(cellEditorWasActivated:)]))

[[self delegate] cellEditorWasActivated:self];
return [super becomeFirstResponder];
}

- (BOOL)resignFirstResponder {
if(([self delegate] != nil) &&
	   ([[self delegate]  
respondsToSelector:@selector(cellEditorWasDeactivated:)]))

[[self delegate] cellEditorWasActivated:self];
return [super resignFirstResponder];
}

None of these methods is called when I click in the NSTableView cell.  
Editor appears, but I suppose, it's somehow not my customized editor,  
but just generic cell text editor.


Where is my mistake?

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


Making NSTextView not wrap lines

2009-07-28 Thread Peter Mulholland
Hello cocoa-dev,

Basically, i'm trying to do a little debug console. I'm using the NSTextView in 
NSScrollView from Interface Builder.

I've got a Print member in my window's controller class which basically does:

[TextView setString:[[TextView string] stringByAppendingString:newString]];

What I want is for the horizontal size of the NSTextView part to expand to the 
length of the string. I'm guessing NSTextView already knows about \n and how to 
make a suitable rectangular area out of a string.

I've set the Text View portion to be horizontally and vertically resizeable. 
I've also made sure it's only autosizing vertically, so that the Scroll View 
will show a horizontal scroll bar.

By default, it doesnt work. I add text with Print, and it always wraps. If I 
size my window (which resizes the ScrollView) wide enough, the text goes onto 
one line. When i size it smaller, the horizontal scroll bar appears as expected.

I have tried calling sizeToFit after the setString, but it doesn't do anything.

This is probably a really simple job, but i'm out of ideas! I'm just starting 
with Cocoa, really.

-- 
Best regards,
 Peter  mailto:darkmat...@blueyonder.co.uk

___

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: Making NSTextView not wrap lines

2009-07-28 Thread Graham Cox


On 29/07/2009, at 2:11 AM, Peter Mulholland wrote:


Hello cocoa-dev,

Basically, i'm trying to do a little debug console. I'm using the  
NSTextView in NSScrollView from Interface Builder.


I've got a Print member in my window's controller class which  
basically does:


[TextView setString:[[TextView string]  
stringByAppendingString:newString]];


What I want is for the horizontal size of the NSTextView part to  
expand to the length of the string. I'm guessing NSTextView already  
knows about \n and how to make a suitable rectangular area out of a  
string.


I've set the Text View portion to be horizontally and vertically  
resizeable. I've also made sure it's only autosizing vertically, so  
that the Scroll View will show a horizontal scroll bar.


By default, it doesnt work. I add text with Print, and it always  
wraps. If I size my window (which resizes the ScrollView) wide  
enough, the text goes onto one line. When i size it smaller, the  
horizontal scroll bar appears as expected.


I have tried calling sizeToFit after the setString, but it doesn't  
do anything.


This is probably a really simple job, but i'm out of ideas! I'm just  
starting with Cocoa, really.



The text view only displays the text that's laid out by other objects.  
In this case, the one you need to modify is the text container.


To get the text container, use [textView textContainer].

Then, set its size to something huge in width, say 1 (- 
setContainerSize:). Call -setHeightTracksTextView:YES and - 
setWidthTracksTextView:NO, and I think that should do it.


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


Anyone Using ZeroC's Internet Communications Engine (ICE)?

2009-07-28 Thread Brad Gibbs
Is anyone here using ZeroC's Internet Communications Engine?  I found  
it in Apple's Developer Downloads section.  Looks like a worthy  
replacement for DO and they've recently added support for iPhone OS.   
Just wondering whether it's worth looking into further for an app I'm  
working on that requires a fair amount of messaging among Macs and  
iPhones over a LAN.  I've been using BLIP.  I don't have any  
complaints with BLIP -- I actually like it quite a bit.  But, if Ice  
is faster, easier to implement, more secure, or has richer features...


Thanks.

Brad
___

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


clicking between tokens

2009-07-28 Thread Andy Lee
This takes a few seconds to recreate in IB.  I create a standard NSTokenField 
in IB with two adjacent rounded tokens in it.  Running the UI, I find it's much 
too hard to click between the tokens.  I should be able to click halfway 
between them, but this selects the token on the right.  To place the text 
cursor between them, I have to click well to the left of where I would 
naturally click, and the window of clickability seems to be only one pixel 
wide.  Instead of clicking anywhere in the white space between the tokens, I 
have to carefully position the mouse one pixel to the right of the left-hand 
token's right edge.

I submitted rdar://problem/7098227 about this.  In the meantime, does anybody 
have a suggestion to improve this usability detail?

I notice the address field in Mail doesn't have this problem, but using 
F-Script Anywhere I also notice it uses something called AddressTextField, 
which isn't an NSTokenField.

--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: Building iPhone application as backward compatible

2009-07-28 Thread Clark Cox
On Tue, Jul 28, 2009 at 3:24 AM, Mahaboob wrote:
> I developed an iPhone application using iPhone OS 3.0 and build it against
> iPhone OS 2.2. The application uses MessageUI.Framework It is tested in
> simulator 3.0. Then from simulator,I changed the Hardware version to 2.2 and
> is working fine. My iPhone is having the OS version 2.2. Now I need to test
> the application in iPhone without upgrading the OS.
> How can I do it ?
> When I'm debugging the application by selecting the Active SDK to  iPhone
> Device 2.2, it yields a lots of errors.

iPhone questions should be asked at


However, in general, when building to support multiple versions of the
OS (whether for the Mac or for the iPhone), you *always* build against
the SDK that contains the APIs that you need (i.e. you don't set the
Active SDK to the earlier SDK when building). You then need to make
sure that your deployment target is set to the earliest OS version
that you want to support. Additionally, any frameworks that don't
exist in the earlier version must be weak-linked as well.


-- 
Clark S. Cox III
clarkc...@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: Panning a View

2009-07-28 Thread David Blanton
That was the right approach ... one twist, I set the view frame when  
drawRect is called to the size of my image.

Works great.

Thanks!

On Jul 28, 2009, at 10:01 AM, Graham Cox wrote:



On 29/07/2009, at 1:56 AM, David Blanton wrote:


Is this the correct approach:

In the MyDocument.xib  add a scroll view to the window.

At some place in the app instance a view and set this view as the  
document view of the scroll view.


Draw into this view.

Scrollers will update etc.



Add the view to the nib, Use Layout -> Embed Objects In -> Scroll  
View.


Make the size (frame) of the view bigger than the scrollview and the  
view will scroll.


--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: nil there not here

2009-07-28 Thread David Duncan

On Jul 27, 2009, at 2:44 PM, David Blanton wrote:

	context = CGBitmapContextCreate (bitmap.m_array, bitmap.m_pixelsx,  
bitmap.m_pixelsy, 8, bitmap.m_pixelsx * 4, colorSpace, 	 
kCGImageAlphaNoneSkipFirst|kCGBitmapByteOrder32Host);	

CGImageRelease(_myDocumentView->_cgImageRef);
_myDocumentView->_cgImageRef =  CGBitmapContextCreateImage (context);
CGImageRetain(_myDocumentView->_cgImageRef); 
CGContextRelease(context);
CGColorSpaceRelease(colorSpace);



This is also over-retaining the CGImage. However you may want to  
consider creating a CGImage directly instead of going through a bitmap  
context, as this gives you more flexibility in what types of image  
data you can represent, as well as avoiding a trip through the kernel  
to mark the memory for the bitmap context as copy-on-write.

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


Re: Panning a View

2009-07-28 Thread Kyle Sluder
On Tue, Jul 28, 2009 at 10:23 AM, David Blanton wrote:
> That was the right approach ... one twist, I set the view frame when
> drawRect is called to the size of my image.

No, you must not do this.

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


App Delegate in Document App

2009-07-28 Thread David Blanton
In MyDocument.xib I added an object and set its class to AppDelegate,  
a subclass of NSObject, in my project.  I connected the Application  
delegate outlet to this object.


I implemented

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender  
{ return NO; }


in AppDelegate but it is never called.



Is this the correct manner to set the application delegate?

db
___

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: Panning a View

2009-07-28 Thread David Blanton

Ok, why not?  It 'appears' to work properly.

 I only do it so the untitled file window that appears at startup  
(which I cannot get rid of, see my next post) looks goofy with scroll  
bar thumbs and no content.



On Jul 28, 2009, at 11:47 AM, Kyle Sluder wrote:

On Tue, Jul 28, 2009 at 10:23 AM, David  
Blanton wrote:

That was the right approach ... one twist, I set the view frame when
drawRect is called to the size of my image.


No, you must not do this.

--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: Panning a View

2009-07-28 Thread Kyle Sluder
On Tue, Jul 28, 2009 at 10:52 AM, David Blanton wrote:
> Ok, why not?  It 'appears' to work properly.

http://www.cocoabuilder.com/archive/message/cocoa/2008/1/29/197499

>  I only do it so the untitled file window that appears at startup (which I
> cannot get rid of, see my next post) looks goofy with scroll bar thumbs and
> no content.

So why would you think to do it in -drawRect:?  Do it in
-awakeFromNib, or -[NSWindowController windowDidLoad], or -[NSDocument
windowControllerDidLoadNib:].  These are the places to do post-nib
loading setup.

--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: App Delegate in Document App

2009-07-28 Thread Fritz Anderson

On 28 Jul 2009, at 12:46 PM, David Blanton wrote:

In MyDocument.xib I added an object and set its class to  
AppDelegate, a subclass of NSObject, in my project.  I connected the  
Application delegate outlet to this object.

...

Is this the correct manner to set the application delegate?


No. Application delegates are one-per-application, not one-per- 
document (and not existing till you instantiate a document).


Instantiate your delegate class in MainMenu.nib. Connect it to the  
delegate outlet of the NSApplication.


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second 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


Re: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child
I decided the nib was maybe corrupt from my having dragged things from  
another project onto it. So I started with a fresh xib, got rid of the  
redundant object (as pointed out by Graham Cox and yourself) and  
voila: I have references to the tableview and the window. But it's  
still not working.


The only datasource method to get called is numberOfRowsInTableView.  
The others do not get called. I rechecked syntax (even tried copying  
method sig from another project that works), rechecked connections for  
the outlets (File's Owner to the table, and table delegate and data  
source to File's Owner, which is the window controller). Still,


- (id) tableView: (NSTableView *) tableView
objectValueForTableColumn: (NSTableColumn *) tableColumn
  row: (int) row

and

-(void) tableView: (NSTableView*) tableView
 setObjectValue: (id) value
 forTableColumn: (NSTableColumn*) tableColumn
row: (int) index

never get called. I also tried [myTable reloadData] when resizing the  
table (resizing works) but that did nothing. References to the  
individual columns appear to be valid based on log statements (I  
cached the column references for convenience), but it's irrelevant  
because a log at the start of each of the above datasource methods is  
never printed. As a result, nothing is loaded in the table, and I  
cannot select individual cells.


What would cause this?

On Jul 28, 2009, at 11:39 AM, Dave Carrigan wrote:



On Jul 28, 2009, at 8:31 AM, Daniel Child wrote:

Which brings up another question: do I need the "object" (blue  
cube) at all in the nib if the file's owner is of the same class  
and presumably represents the same object. Are they redundant?


They are completely different things.

The blue cube object will cause a brand new object to be  
instantiated when the nib is loaded.


The file's owner is a pseudo-object - it represents an object  
external to the nib that has already been instantiated before the  
nib gets loaded.


This almost certainly explains why you seem to have two different  
objects of the same class.


--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA



___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child

Thanks for confirming this.

On Jul 28, 2009, at 11:43 AM, Graham Cox wrote:


Not only are they redundant, this is almost certainly your bug.

Objects in a nib are real objects. Therefore you have two of them,  
both of the same class. Normally File's Owner is the window  
controller and this is the object you should be referring to in your  
code. The other object is getting in the way and likely causing  
problems.


You generally use a blue cube for any other object, such as a  
separate subcontroller that your main controller might want to use,  
but they definitely won't be the same object - they can't be, as  
each item in a nib is a distinct, real object.


___

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: Panning a View

2009-07-28 Thread I. Savant

On Jul 28, 2009, at 1:56 PM, Kyle Sluder wrote:


No, you must not do this.


...

So why would you think to do it in -drawRect:?  Do it in
-awakeFromNib, or -[NSWindowController windowDidLoad], or -[NSDocument
windowControllerDidLoadNib:].  These are the places to do post-nib
loading setup.


  It might be more helpful to explain why this isn't a good idea ...

  Several things to consider:

1 - The -drawRect: method is supposed to be kept as lightweight as  
possible because it could be called many times.


2 - What happens if something else causes your view's frame to be set  
(which may cause the system to call -drawRect:, which may call your  
frame setter, which calls -drawRect:...)?

)

  ... those are off the top of my head but aren't necessarily "must  
nots", just "probably shouldn'ts". Leopard introduced -(void) 
viewWillDraw for last-minute adjustments. If handled correctly,  
performance may not be an issue at all and cycles can be avoided.


  It's better, though, to implement a -sizeToFit method and call it  
once when the view is created (or it's given its contents to display).  
That's just better design.


  If I'm missing something that's an absolute "must not", Kyle, I  
welcome the insight.


--
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: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child
Actually, once I have init'd the window controller and set up the  
model data, I call showWindow on the controller. Unchecking visible at  
launch doesn't seem to make any difference.


On Jul 28, 2009, at 11:47 AM, Graham Cox wrote:


Visible at launch is checked (ON)



Which is almost never what you want. Windows should generally be  
loaded on demand by the app under the direction of their window  
controller. A window visible at launch won't necessarily even have a  
controller.


___

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: Panning a View

2009-07-28 Thread Erik Buck
That was the right approach ... one twist, I set the view frame when  
drawRect is called to the size of my image.

Don't do that.  Do read the documentation.  The only thing you should do in 
-drawRect: is draw.  In particular, changing the frame inside drawRect: will 
invalidate all or part of the calculations performed by the framework in 
-display and other view drawing methods that are called before and after 
-drawRect:.


___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Andy Lee

On Jul 28, 2009, at 2:04 PM, Daniel Child wrote:

The only datasource method to get called is numberOfRowsInTableView.


What number is it returning?

--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: Panning a View

2009-07-28 Thread David Blanton

I am changing now ... thanks!

On Jul 28, 2009, at 12:10 PM, Erik Buck wrote:


That was the right approach ... one twist, I set the view frame when
drawRect is called to the size of my image.

Don't do that.  Do read the documentation.  The only thing you  
should do in -drawRect: is draw.  In particular, changing the frame  
inside drawRect: will invalidate all or part of the calculations  
performed by the framework in -display and other view drawing  
methods that are called before and after -drawRect:.



___

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/airedale%40tularosa.net

This email sent to aired...@tularosa.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: App Delegate in Document App

2009-07-28 Thread David Blanton

Done. Works. Thx.

On Jul 28, 2009, at 12:03 PM, Fritz Anderson wrote:


On 28 Jul 2009, at 12:46 PM, David Blanton wrote:

In MyDocument.xib I added an object and set its class to  
AppDelegate, a subclass of NSObject, in my project.  I connected  
the Application delegate outlet to this object.

...

Is this the correct manner to set the application delegate?


No. Application delegates are one-per-application, not one-per- 
document (and not existing till you instantiate a document).


Instantiate your delegate class in MainMenu.nib. Connect it to the  
delegate outlet of the NSApplication.


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second 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


Re: NSWindow reference remains null after window did load

2009-07-28 Thread Quincey Morris

On Jul 28, 2009, at 11:04, Daniel Child wrote:

The only datasource method to get called is numberOfRowsInTableView.  
The others do not get called. I rechecked syntax (even tried copying  
method sig from another project that works), rechecked connections  
for the outlets (File's Owner to the table, and table delegate and  
data source to File's Owner, which is the window controller). Still,


- (id) tableView: (NSTableView *) tableView
objectValueForTableColumn: (NSTableColumn *) tableColumn
 row: (int) row

and

-(void) tableView: (NSTableView*) tableView
 setObjectValue: (id) value
 forTableColumn: (NSTableColumn*) tableColumn
   row: (int) index

never get called. I also tried [myTable reloadData] when resizing  
the table (resizing works) but that did nothing. References to the  
individual columns appear to be valid based on log statements (I  
cached the column references for convenience), but it's irrelevant  
because a log at the start of each of the above datasource methods  
is never printed. As a result, nothing is loaded in the table, and I  
cannot select individual cells.


What would cause this?


Incidentally, the correct prototypes for these methods have as their  
last parameter ...


row: (NSInteger) index

The difference would only be important if your app was being built as  
64-bit. If so, with your prototypes, NSTableView might reject the data  
source method signatures. Did you check for messages in the run log?  
(Either check the debugger's run log window in Xcode, or use the  
Console utility to check the system log.)


It's worth emphasizing that in Cocoa frameworks-related code, 'int' or  
'unsigned' ought to be a huge red flag to the wary programmer, with a  
possible transition to all-64-bit-all-the-time looming on the horizon.


And that the documentation is still sometimes wrong about the  
prototypes for delegate method signatures (and often wrong for  
didEnd... method signatures).



___

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: App Delegate in Document App

2009-07-28 Thread Paul Franz
You should do it in the MainMenu.xib file.

Paul Franz

On Tue, Jul 28, 2009 at 1:46 PM, David Blanton wrote:

> In MyDocument.xib I added an object and set its class to AppDelegate, a
> subclass of NSObject, in my project.  I connected the Application delegate
> outlet to this object.
>
> I implemented
>
> - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return
> NO; }
>
> in AppDelegate but it is never called.
>
>
>
> Is this the correct manner to set the application delegate?
>
> db
> ___
>
> 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/paulfranz%40email.com
>
> This email sent to paulfr...@email.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: iTunes DB Change Notifications?

2009-07-28 Thread Scott Ribe
> Isn't this an extremely expensive operation?

I strongly suspect that Apple's intent was to support infrequent operations,
such as non-iTunes software synching to non-iPod devices.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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: NSTableView cell editing begin / end notifications - solved (?)

2009-07-28 Thread Alexander Bokovikov

Hi, All,

To whom is may be interesting:

As I wrote initially, my problem is that the table is updated on a  
timer, so cell editor was cancelled automatically, as the timer fires.  
First I started to seek for a solution to learn about cell editor  
appearing / hiding events. And that was very hard way. Occasionally,  
walking through NSView methods I've found currentEditor method,  
resolving all my problem. Really, what I need to know, is whether cell  
editor is active or not. And the method, pointed above just shows it.


Nevertheless I'd be just happy to learn about how to detect cell  
editor appearing / hiding. Though this question comes into a  
theoretical plane now.


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


How do I insure that my NSDocument subclass is not initialized before I open a document?

2009-07-28 Thread Korei Klein
I have a subclass of NSDocument which is initialized whenever I open a 
new document and when my application is first started.
How do I change the application such that my subclass is not initialized 
when I start the application?

___

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


Something is wrong

2009-07-28 Thread Agha Khan

Hi:
UIButton* pSomeBtn   = [UIButton buttonWithType:UIButtonTypeInfoDark];
CGRect SomeBtnFrame  = pSomeBtn.frame;

I am new to Objective-C
But I took granted and used -> for pointers.
Why this is working?
It should be
CGRect SomeBtnFrame  = pSomeBtn->frame;

But many places it did not complain. No error or warnings.
pSomeOtherButton->horizontalLoc = CGPointMake((bVerticalDisplay ==  
NO) ? 410 : 250, 50.0);


Am I missing something?
Best regards
-Agha



___

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: Something is wrong

2009-07-28 Thread Kyle Sluder
On Tue, Jul 28, 2009 at 12:44 PM, Agha Khan wrote:
> UIButton* pSomeBtn   = [UIButton buttonWithType:UIButtonTypeInfoDark];
> CGRect SomeBtnFrame  = pSomeBtn.frame;
> Why this is working?

This is known as "dot syntax".  Read the Objective-C 2.0 Language
Reference: 
http://developer.apple.com/iphone/library/documentation/cocoa/conceptual/objectivec/Articles/ocObjectsClasses.html

--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 do I insure that my NSDocument subclass is not initialized before I open a document?

2009-07-28 Thread Kyle Sluder
On Tue, Jul 28, 2009 at 12:41 PM, Korei Klein wrote:
> I have a subclass of NSDocument which is initialized whenever I open a new
> document and when my application is first started.
> How do I change the application such that my subclass is not initialized
> when I start the application?

This is a FAQ.  Return NO from your app delegate's
-applicationShouldOpenUntitledFile: method.

Also, it is expected that the application will create an untitled file
when opened or its dock icon is clicked when it has no other documents
open.  There are sometimes good reasons for changing this behavior,
but please ensure that you have one before doing this.

--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 do I insure that my NSDocument subclass is not initialized before I open a document?

2009-07-28 Thread Chase Meadors

In MainMenu.xib, add an app delegate object and override:

- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {

return NO;

}

On Jul 28, 2009, at 2:41 PM, Korei Klein wrote:

I have a subclass of NSDocument which is initialized whenever I open  
a new document and when my application is first started.
How do I change the application such that my subclass is not  
initialized when I start the application?

___

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/c.ed.mead%40gmail.com

This email sent to c.ed.m...@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: NSWindow reference remains null after window did load

2009-07-28 Thread Daniel Child

The correct number, a value obtained from the model.

On Jul 28, 2009, at 3:02 PM, cocoa-dev-requ...@lists.apple.com wrote:


The only datasource method to get called is numberOfRowsInTableView.


What number is it returning?

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


NSRulerView

2009-07-28 Thread David Blanton

Any insight on why this does not change the ruler measurement units:

[[[NSRulerView alloc] initWithScrollView:_scrollView  
orientation:NSHorizontalRuler] setMeasurementUnits:@"Centimeters"];		

TIA!

db
___

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: Something is wrong

2009-07-28 Thread WT

On Jul 28, 2009, at 9:44 PM, Agha Khan wrote:


Hi:
UIButton* pSomeBtn   = [UIButton buttonWithType:UIButtonTypeInfoDark];
CGRect SomeBtnFrame  = pSomeBtn.frame;

I am new to Objective-C
But I took granted and used -> for pointers.
Why this is working?
It should be
CGRect SomeBtnFrame  = pSomeBtn->frame;

But many places it did not complain. No error or warnings.
pSomeOtherButton->horizontalLoc = CGPointMake((bVerticalDisplay ==  
NO) ? 410 : 250, 50.0);


Am I missing something?
Best regards
-Agha


Kyle has already answered the specifics of your question, so I won't  
address that. I just want to suggest that, in the future, you post  
your questions with more descriptive subject titles. "Something is  
wrong" is not very helpful.


Keep in mind that this list has a lot of traffic and not everyone is  
interested in every subject. We all want to help one another here but,  
if I'm short on time, messages with non-descriptive subjects are the  
first I skip. I suspect other people in the list behave in the same way.


If you want to increase your chances of being helped, you should spend  
the effort to craft a better message, starting with better subject  
lines.

___

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


cocoa sheet allowing interaction with attached window?

2009-07-28 Thread John Mikros

Hello all,

I'm seeing an odd behavior where I have a sheet attached to a window,  
but I'm able to interact with the main window underneath, as long as  
that interaction involves a right-click.  Left clicks are properly  
blocked (other than to resize the window, etc)


Thus, I'm able to bring up a right-click menu in the main window.   
We're not expecting this to be possible while the sheet is active, and  
is giving us problems.


Is there any way for my sheet to be truly modal wrt the attached  
window, instead of this kind-of, sort-of modal as long as you don't  
right-click behavior?


BTW, interaction with other, unrelated windows needs to be allowed, so  
switching to a dialog box is not an option.


Any help is appreciated,
-john
___

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


Spacing buttons in UIToolbar

2009-07-28 Thread DKJ
I'm using the setToolbarItems:animated: of a UITableViewController to  
place buttons on the toolbar. If I was using IB, I could space the  
buttons evenly simply by inserting some flexible-space ones between  
them. Is there an easy way to do this in code? Or do I need to  
calculate widths for some blank buttons and insert them into the  
toolbar items array?


dkj
___

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


Override Font Tool and Colors Tool

2009-07-28 Thread David Blanton

My application deals with embroidery.

To be Mac I want to use the tool bar with the fonts and colors tools.

Because fonts and colors  mean something different in this environment  
is it de rigueur to override these with my specific panels?


I don't want the UI Fuzz after me!

db

___

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: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Jerry Krinock
Last December I asked a question here regarding how I should copy  
attributes from an existing managed object to a new managed object,  
when it is necessary to create this new object in a different managed  
object context.  I noted that getting an "attributes dictionary" from  
the existing managed object using [self  
dictionaryWithValuesForKeys:attributes], and then iterating over this  
dictionary to setValue:forKey: in the new managed object did not seem  
to be satisfactory since that method returns a dictionary containing  
an NSNull value for keys that were nil, instead of omitting them.  I  
posted the code I was using instead [1].


But then, on 2008 Dec 22, at 00:18, Ben Trumbull wrote:

We tried omitting pairs with nil values, and stuff broke.  Like  
views didn't get updated because iterating over the values during  
setting with (nil = missing) meant nil values didn't get reset.   
Like with undo or bindings.  Your setter here has that issue.  You  
may prefer that behavior, but we found it even more problematic than  
forcing clients to check for NSNull.


Yesterday I finally got around to trying what I believe to be Ben's  
way, which is to set attributes that are nil in the existing object to  
[NSNull null] in the copy.  But Core Data doesn't seem to like that --  
for example, I have an attribute named 'comments' of type string, and  
when copying an object which has nil comments, attempting to setValue: 
[NSNull null] forKey:@"comments", I get this...


Unacceptable type of value for attribute: property = "comments";  
desired type = NSString; given type = NSNull; value = 


Apparently I've misunderstood Ben.  What was he trying to tell me?

Sincerely,

Jerry Krinock


[1]

- (NSMutableDictionary*)attributesDictionary {
NSEntityDescription* entity = [self entity] ;
NSDictionary* attributes = [entity attributesByName] ;

NSMutableDictionary* attributesDic = [[NSMutableDictionary alloc]  
init] ;

for (id attributeName in attributes) {
id value = [self valueForKey:attributeName] ;
if (value) {

[attributesDic setValue:value
  forKey:attributeName] ;
}
}

return [attributesDic autorelease] ;
}

- (void)setAttributes:(NSDictionary*)attributes {
for (id attributeName in attributes) {
[self setValue:[attributes valueForKey:attributeName]
forKey:attributeName] ;
}
}

___

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: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Ben Trumbull


On Jul 28, 2009, at 3:59 PM, Jerry Krinock wrote:

Last December I asked a question here regarding how I should copy  
attributes from an existing managed object to a new managed object,  
when it is necessary to create this new object in a different  
managed object context.  I noted that getting an "attributes  
dictionary" from the existing managed object using [self  
dictionaryWithValuesForKeys:attributes], and then iterating over  
this dictionary to setValue:forKey: in the new managed object did  
not seem to be satisfactory since that method returns a dictionary  
containing an NSNull value for keys that were nil, instead of  
omitting them.  I posted the code I was using instead [1].


But then, on 2008 Dec 22, at 00:18, Ben Trumbull wrote:

We tried omitting pairs with nil values, and stuff broke.  Like  
views didn't get updated because iterating over the values during  
setting with (nil = missing) meant nil values didn't get reset.   
Like with undo or bindings.  Your setter here has that issue.  You  
may prefer that behavior, but we found it even more problematic  
than forcing clients to check for NSNull.


Yesterday I finally got around to trying what I believe to be Ben's  
way, which is to set attributes that are nil in the existing object  
to [NSNull null] in the copy.  But Core Data doesn't seem to like  
that -- for example, I have an attribute named 'comments' of type  
string, and when copying an object which has nil comments,  
attempting to setValue:[NSNull null] forKey:@"comments", I get this...


Unacceptable type of value for attribute: property = "comments";  
desired type = NSString; given type = NSNull; value = 


Apparently I've misunderstood Ben.  What was he trying to tell me?



If the value from the dictionary is NSNull, you need to use nil  
instead.  Accessor methods don't accept NSNull in place of NSString.   
The swapping has to happen in your copy/snapshot code.  The NSNull  
issue is unfortunate, but your alternative is not copying nil values  
at all since they won't be in the dictionary.  For creating new  
objects, that's not a problem.  But for restoring previous state over  
an existing object, that's undesirable.


There are other more complicated approaches, but ultimately handling  
NSNull in your restore code is the least bad approach.


- Ben

___

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: Spacing buttons in UIToolbar

2009-07-28 Thread WT

On Jul 29, 2009, at 12:48 AM, DKJ wrote:

I'm using the setToolbarItems:animated: of a UITableViewController  
to place buttons on the toolbar. If I was using IB, I could space  
the buttons evenly simply by inserting some flexible-space ones  
between them. Is there an easy way to do this in code? Or do I need  
to calculate widths for some blank buttons and insert them into the  
toolbar items array?


dkj


As almost always, the answer lies in the documentation. Take a look at  
the UIBarButtonItem method


- (id) initWithBarButtonSystemItem: (UIBarButtonSystemItem) systemItem
target: (id)
  targetaction: (SEL) action

and use the appropriate choice from the enumeration  
UIBarButtonSystemItem.

___

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


Fun (or not) with NSArrayControllers and CoreData.

2009-07-28 Thread Daniel DeCovnick
My entities and relationships are set up as follows Folder<<-- 
children--parent-->Folder and Folder<--folder--jobs-->>Job. My nib has  
a tree controller for the Folders. This part works fine.


If I create an Array Controller for the Jobs (JobsArrayController),  
and set the Content Set to FolderTreeController.selection.jobs, I can  
bind table columns to JobsArrayController.arrangedObjects.name>. What I'd really like is to have the table view not just contain  
the job info from the jobs in the selected folder, but also all the  
jobs in all of the selected folder's children, and their children,  
etc. (iTunes has this behavior when selecting folders of playlists),  
but when add: is sent to JobsArrayController, the other side of the  
folder relationship should be the FolderTreeController.selection.


I figure the code for getting all the jobs from the entire folder tree  
would be something like this (typed in Mail):


//on Folder
-(NSSet *)allDescendentsJobs
{
NSSet *ret = [NSSet set];
NSSet *currentChildren = [self children];
if (currentChildren != nil)
{
for (id i in currentChildren)
{
ret = [ret setByAddingObjectsFromSet:[i 
allDescendentsJobs]];
}
}
ret = [ret setByAddingObjectsFromSet:[i jobs];
return ret;
}

But I can't bind JobsArrayController's content set to this because  
"entity Folder does not support Key Value Coding for property  
'allDescendentsJobs'" because, as I understand it, it's read-only*. At  
this point I'm stuck. What do I do to get past this?


Help would be greatly appreciated.

-Daniel

*astute readers will note that I since I typed the above code in Mail,  
I didn't actually try it out. This is true, but I know the problem  
exists because I tried to go the opposite way a few hours ago,  
attempting to implement -(NSString *)folderAndAncestorsNamesString on  
Job. Couldn't bind to that, and the console spit out the error above,  
but Job instead of Folder, etc. 
___


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


NSOpenPanel Exception/Bug

2009-07-28 Thread Seth Willits



I have an exception being thrown when an open panel is open. I can't  
reproduce it yet, but I really don't see what the problem is either. I  
think I'm just triggering a bug in NSOpenPanel. Here's the exception:



*** -[NSCFArray objectAtIndex:]: index (-1( or possibly larger))  
beyond bounds (2)


_NSArrayRaiseBoundException (in Foundation) + 127
-[NSCFArray objectAtIndex:] (in Foundation) + 72
-[NSNavBrowserDelegate browser:willDisplayCell:atRow:column:] (in  
AppKit) + 94
-[NSBrowser _sendDelegateWillDisplayCell:atRow:column:] (in AppKit) +  
134

-[NSBrowser _loadCell:atRow:col:inMatrix:] (in AppKit) + 561
-[NSMatrix drawRect:] (in AppKit) + 1587
...





The open panel should only allow text files to be selected. To do  
that, I'm using panel:shouldShowFilename: 



- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
	NSDictionary * attributes = [[NSFileManager defaultManager]  
fileAttributesAtPath:filename traverseLink:YES];

if (!attributes) return NO;

NSString * fileType = [attributes objectForKey:NSFileType];
	NSString * hfsType = NSFileTypeForHFSTypeCode((OSType)[[attributes  
objectForKey:NSFileHFSTypeCode] unsignedLongValue]);
	NSString * utiType = [[NSWorkspace sharedWorkspace]  
typeOfFile:filename error:nil];

NSString * extension = [filename pathExtension];

if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename]) {
return NO;
}

if ([fileType isEqual:NSFileTypeDirectory]) {
return YES;
}

if ([hfsType isEqual:NSFileTypeForHFSTypeCode('TEXT')]) {
return YES;
}

	if ([[NSWorkspace sharedWorkspace] type:utiType conformsToType: 
(NSString *)kUTTypePlainText]) {

return YES;
}

	if ([[NSArray arrayWithObjects:@"txt", @"text", , nil]  
containsObject:[extension lowercaseString]]) {

return YES;
}

	NSString * usrBinFileType = [[NSFileManager defaultManager]  
fileTypeForFileAtPath:filename];
	if ([[usrBinFileType lowercaseString] containsString:@"text" options: 
0]) {

return YES;
}

return NO;
}



It works its way down to the last if statement which launches /usr/bin/ 
file to figure out the type of the file. It's all straight forward  
simple code, which simply returns YES or NO, but it's causing an  
exception apparently, and I don't see how I could do anything different.


Any thoughts?


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


Use of cells with custom controls

2009-07-28 Thread Chase Meadors
I'm making my own class that will input a variety of data in different  
formats, and NSTableView really seems clunky and unsuited for my  
purposes. I'm trying to make a custom control, but I don't quite  
understand what I need to do to use cells in it.


In drawRect, I can just draw the cells I want in the appropriate  
places with -drawWithFrame:inView:.


However, I'm not sure how I should implement the mouse event methods  
to get the correct behavior in the cells. Do I test the point of the  
event, see if it's in a cell, and call some method on that cell to  
make it active? Is there an easier way?


Any help appreciated.
___

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: Fun (or not) with NSArrayControllers and CoreData.

2009-07-28 Thread Quincey Morris

On Jul 28, 2009, at 16:44, Daniel DeCovnick wrote:


-(NSSet *)allDescendentsJobs
{
...
}

But I can't bind JobsArrayController's content set to this because  
"entity Folder does not support Key Value Coding for property  
'allDescendentsJobs'" because, as I understand it, it's read-only*.  
At this point I'm stuck. What do I do to get past this?


'allDescendentsJobs' (not how 'descendants' is spelled, btw) is not a  
property of entity Folder, so of course you can't point a  
NSArrayController in *entity* mode at it.


However, 'allDescendentsJobs' *is* a property of your custom  
NSManagedObject subclass that corresponds to the entity, so you can  
point a NSArrayController at it in *class* mode. That means you'll  
have to compute an array instead of a set.


You have another problem, though. Your NSManagedObject subclass  is  
not (by the code you've sketched) KVO compliant for the  
'allDescendentsJobs' property, so if you're expecting the table view  
to update when the jobs change at some level, it won't.



___

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: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Jerry Krinock


On 2009 Jul 28, at 16:07, Ben Trumbull wrote:


Accessor methods don't accept NSNull in place of NSString.


Yes.

I think I understand this now -- I was having trouble with your terms  
"copy/snapshot" and "restore".


Accessor methods don't accept NSNull...the swapping has to happen in  
your copy/snapshot code.


Thinking about this further, I realize that my purpose is simply  
copying a managed object from one managed object context to a  
different managed object context, and this is effectively a copy-and- 
paste.  So, I looked at how copy and paste is done in  
DepartmentAndEmployees.  In -[MyDocument copy:], they produce a  
dictionary using -[NSKeyValueCoding dictionaryWithValuesForKeys], in  
which "Entries for which -valueForKey: returns nil have NSNull as  
their value in the returned dictionary."  In -[MyDocument paste:],  
they set values in the new object using -[NSKeyValueCoding  
setValuesForKeysWithDictionary:], in which "Dictionary entries whose  
values are NSNull result in -setValue:nil forKey:key messages being  
sent to the receiver."


So, I believe what you mean by "swapping".  These two NSKeyValueCoding  
methods do it for you, if you're using a dictionary to transfer the  
attributes.


The NSNull issue is unfortunate, but your alternative is not copying  
nil values at all since they won't be in the dictionary.


Actually, in my implementation I happen to have a reference to the  
existing object, so I just copy attributes in a loop -- there is no  
dictionary.  A nil value is "getted" and "setted" the same as a non- 
nil value.



For creating new objects, that's not a problem.


Good!

But now it appears that you're discussing a different problem, one  
that I'm not familiar with (but maybe should be)


But for restoring previous state over an existing object, that's  
undesirable.  There are other more complicated approaches, but  
ultimately handling NSNull in your restore code is the least bad  
approach.


In what practical situation would one want to be "restoring previous  
state over an existing object"?


Thanks, Ben.
___

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: NSWindow reference remains null after window did load

2009-07-28 Thread Andy Lee
Just to be sure -- your method is numberOfRowsInTableView:, not 
numberOfRowsInTableView, right?  You mentioned you'd tried copying working 
method declarations, so I suspect that's not the problem, but I figured I'd 
double-check just in case *you* were calling it somewhere you'd forgotten about 
and it wasn't the table view that was calling it.

There was a similar mystery within the past few months, with very similar 
"impossible" symptoms.  I believe the solution was a missing call to 
reloadData.  But this doesn't sound like your problem, because if 
numberOfRowsInTableView: returns 17, then the value-getter method should have 
gotten called 17 times for each column.

--Andy


On Tuesday, July 28, 2009, at 04:12PM, "Daniel Child"  wrote:
>The correct number, a value obtained from the model.
>
>On Jul 28, 2009, at 3:02 PM, cocoa-dev-requ...@lists.apple.com wrote:
>
>>> The only datasource method to get called is numberOfRowsInTableView.
>>
>> What number is it returning?
>>
>> --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: Use of cells with custom controls

2009-07-28 Thread I. Savant

On Jul 28, 2009, at 8:10 PM, Chase Meadors wrote:

I'm making my own class that will input a variety of data in  
different formats, and NSTableView really seems clunky and unsuited  
for my purposes.


  In what way? What are you trying to do?


I'm trying to make a custom control, but I don't quite understand  
what I need to do to use cells in it.

...
However, I'm not sure how I should implement the mouse event methods  
to get the correct behavior in the cells. Do I test the point of the  
event, see if it's in a cell, and call some method on that cell to  
make it active? Is there an easier way?


  Read the documentation:

http://devworld.apple.com/documentation/Cocoa/Conceptual/ControlCell/ControlCell.html

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


NSSplitView autosave troubles

2009-07-28 Thread Benjámin Salánki

Dear list,

please help me, because this is driving me crazy.

I have a simple window set up in IB which contains only an autosized  
NSSplitView as its content.


I add an autosave name for the splitview in IB. Go to Xcode, build and  
run, everything's fine. Quit the app, relaunch, and my window is  
empty, the split view is gone.


Actually it is not gone, but collapsed. At least that is what I  
believe I could decipher from the autosave entry in the prefs.plist.


Now I did not find anything like this on Google and I can reproduce  
this in any project of mine on two different machines. I can't believe  
I am the only one with this, so there's only one explenation left: I  
am doing something wrong.


Please advise.

Thanks in advance,
Ben Salanki
___

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: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Ben Trumbull


On Jul 28, 2009, at 5:36 PM, Jerry Krinock wrote:


But for restoring previous state over an existing object, that's  
undesirable.  There are other more complicated approaches, but  
ultimately handling NSNull in your restore code is the least bad  
approach.


In what practical situation would one want to be "restoring previous  
state over an existing object"?


Well, in your copy & paste code, what happens if the object already  
exists in the destination MOC ?  Or, say, a paste operation occurs,  
some edits happen to the new object, and then the user pastes again ?   
For some applications, pasting should always create a new object, but  
for others, the value on the pasteboard includes an objectID.  If the  
paste refers to a specific object, then that will be applied over  
existing edits.  If the pasteboard does not represent nils (e.g. those  
keys are absent) then edited values won't be set to nil on the second  
paste operation.


ditto for undo/redo and similar tasks.

- Ben



___

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: NSRulerView

2009-07-28 Thread Graham Cox


On 29/07/2009, at 7:58 AM, David Blanton wrote:


Any insight on why this does not change the ruler measurement units:

[[[NSRulerView alloc] initWithScrollView:_scrollView  
orientation:NSHorizontalRuler] setMeasurementUnits:@"Centimeters"];		

TIA!



Yes, because NSRulerView knows nothing of these "Centimeters" of which  
you speak.


You have to register the units you want to use with NSRulerView prior  
to use, using:


+ (void)registerUnitWithName:(NSString *)unitName abbreviation: 
(NSString *)abbreviationunitToPointsConversionFactor: 
(CGFloat)conversionFactor stepUpCycle:(NSArray *)stepUpCycle  
stepDownCycle:(NSArray*)stepDownCycle


This sets up an internal table associated with the name "Centimeters"*  
(or whatever) that tells the ruler how to lay out its marks.


You know, you could do worse than to spend a few hours actually  
reading the documentation - most of the questions you are rapidly  
firing at the list are answered therein.


--Graham

*P.S. it's "Centimetres"
___

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: NSSplitView autosave troubles

2009-07-28 Thread Graham Cox


On 29/07/2009, at 10:50 AM, Benjámin Salánki wrote:


please help me, because this is driving me crazy.

I have a simple window set up in IB which contains only an autosized  
NSSplitView as its content.


I add an autosave name for the splitview in IB. Go to Xcode, build  
and run, everything's fine. Quit the app, relaunch, and my window is  
empty, the split view is gone.


Actually it is not gone, but collapsed. At least that is what I  
believe I could decipher from the autosave entry in the prefs.plist.


Now I did not find anything like this on Google and I can reproduce  
this in any project of mine on two different machines. I can't  
believe I am the only one with this, so there's only one explenation  
left: I am doing something wrong.



Have you tried putting views into the split panes? I don't know for  
sure, but I think the split view relies on the frames of the views it  
holds to establish some of its dimensions, so the problem might simply  
be that your splitter is empty.


--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: NSSplitView autosave troubles

2009-07-28 Thread Benjámin Salánki

Yes I have tried that, to no avail.

Sent from my iPhone

On 2009.07.29., at 3:46, Graham Cox  wrote:



On 29/07/2009, at 10:50 AM, Benjámin Salánki wrote:


please help me, because this is driving me crazy.

I have a simple window set up in IB which contains only an  
autosized NSSplitView as its content.


I add an autosave name for the splitview in IB. Go to Xcode, build  
and run, everything's fine. Quit the app, relaunch, and my window  
is empty, the split view is gone.


Actually it is not gone, but collapsed. At least that is what I  
believe I could decipher from the autosave entry in the prefs.plist.


Now I did not find anything like this on Google and I can reproduce  
this in any project of mine on two different machines. I can't  
believe I am the only one with this, so there's only one  
explenation left: I am doing something wrong.



Have you tried putting views into the split panes? I don't know for  
sure, but I think the split view relies on the frames of the views  
it holds to establish some of its dimensions, so the problem might  
simply be that your splitter is empty.


--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: Override Font Tool and Colors Tool

2009-07-28 Thread Graham Cox


On 29/07/2009, at 8:51 AM, David Blanton wrote:


My application deals with embroidery.

To be Mac I want to use the tool bar with the fonts and colors tools.

Because fonts and colors  mean something different in this  
environment is it de rigueur to override these with my specific  
panels?


I don't want the UI Fuzz after me!



For colours, it's possible to add a custom picker (see NSColorPicker)  
to the standard colour panel. I would expect that would be a better  
approach than replacing the color panel altogether, and then you get  
the best of both worlds - the standard interface but tailored to your  
app. The user may be comfortable with the standard picker, and  
besides, I can't see how "colour" can really have a different meaning  
in your app than all the others. Colour is colour.


For fonts, harder to say. Bear in mind though that your app has to co- 
exist with others and the user will have already learned to use the  
standard panels with other apps. You could be making your app harder  
to use/learn by not using the standard panels.


There is no UI Fuzz, only success or failure in the marketplace.

--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: NSRulerView

2009-07-28 Thread Andy Lee

On Jul 28, 2009, at 9:42 PM, Graham Cox wrote:
You know, you could do worse than to spend a few hours actually  
reading the documentation


Or in this case just a few seconds to look at the doc for  
setMeasurementUnits:.


If a method doesn't do what you thought it would do, it makes a lot of  
sense to look at its documentation.  Folks on this list appreciate  
when people have demonstrated some attempt to help themselves before  
posting.


--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: NSRulerView

2009-07-28 Thread Dave Keck
Hmm, us Americans spell it 'centimeter,' and according to the
mentioned docs, NSRulerView does too. The docs also say it supports
four different units by default (in, cm, pt, pc). Not sure what
'default' means in this case, but I'd assume it means calling
+registerUnitWithName:... is redundant for these four units. I've
never used NSRulerView, but the docs seem to imply that your code
should work. (Although it's certainly a strange style to avoid setting
the new instance of NSRulerView to a variable before
-setMeasurementUnits: on it, even if that's the only message you send
to it; but I'm guessing that was just for brevity.)
___

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: NSRulerView

2009-07-28 Thread Graham Cox


On 29/07/2009, at 12:09 PM, Dave Keck wrote:


Hmm, us Americans spell it 'centimeter,' and according to the
mentioned docs, NSRulerView does too. The docs also say it supports
four different units by default (in, cm, pt, pc). Not sure what
'default' means in this case, but I'd assume it means calling
+registerUnitWithName:... is redundant for these four units. I've
never used NSRulerView, but the docs seem to imply that your code
should work. (Although it's certainly a strange style to avoid setting
the new instance of NSRulerView to a variable before
-setMeasurementUnits: on it, even if that's the only message you send
to it; but I'm guessing that was just for brevity.)




Centimeters - well, typical of Americans to take language invented  
elsewhere and 'embrace, extend and extinguish' ;-)


But yes, it does say that this is registered by default...

So maybe the problem is that the NSRulerView is being alloc/inited,  
instead of simply requested from the scroll view, which will create  
them for you if you use -setHasHorizontal/VerticalRuler: and get the  
ruler using -horizontal/verticalRulerView.


I've never directly allocated and inited a ruler view - presumably  
you'd only do this if you were using a ruler separately from a scroll  
view.


--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: Override Font Tool and Colors Tool

2009-07-28 Thread David Blanton
Color to us is thread brands and how to match a design done with one  
brand to other brands ... so our picker is a choice of threads with as  
close as possible matching to the original


Fonts have to be digitized so they can be sewn ergo or font panel only  
includes our collection of digitized fonts.


I just wanted to get at these in a more standard UI manner.



On Jul 28, 2009, at 7:56 PM, Graham Cox wrote:



On 29/07/2009, at 8:51 AM, David Blanton wrote:


My application deals with embroidery.

To be Mac I want to use the tool bar with the fonts and colors tools.

Because fonts and colors  mean something different in this  
environment is it de rigueur to override these with my specific  
panels?


I don't want the UI Fuzz after me!



For colours, it's possible to add a custom picker (see  
NSColorPicker) to the standard colour panel. I would expect that  
would be a better approach than replacing the color panel  
altogether, and then you get the best of both worlds - the standard  
interface but tailored to your app. The user may be comfortable with  
the standard picker, and besides, I can't see how "colour" can  
really have a different meaning in your app than all the others.  
Colour is colour.


For fonts, harder to say. Bear in mind though that your app has to  
co-exist with others and the user will have already learned to use  
the standard panels with other apps. You could be making your app  
harder to use/learn by not using the standard panels.


There is no UI Fuzz, only success or failure in the marketplace.

--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: Override Font Tool and Colors Tool

2009-07-28 Thread Graham Cox


On 29/07/2009, at 12:29 PM, David Blanton wrote:

Color to us is thread brands and how to match a design done with one  
brand to other brands ... so our picker is a choice of threads with  
as close as possible matching to the original



So NSColorPicker is the way to go. This is exactly what Pantone did to  
provide their colours in Mac OS X. The end result is still an NSColor,  
so your custom picker can work with all standard views and controllers  
that already know how to interact with the color panel.


--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: NSRulerView

2009-07-28 Thread David Blanton

Yeah, it is not clear ... I'll dig some more  thanks anyway!


On Jul 28, 2009, at 8:26 PM, Graham Cox wrote:



On 29/07/2009, at 12:09 PM, Dave Keck wrote:


Hmm, us Americans spell it 'centimeter,' and according to the
mentioned docs, NSRulerView does too. The docs also say it supports
four different units by default (in, cm, pt, pc). Not sure what
'default' means in this case, but I'd assume it means calling
+registerUnitWithName:... is redundant for these four units. I've
never used NSRulerView, but the docs seem to imply that your code
should work. (Although it's certainly a strange style to avoid  
setting

the new instance of NSRulerView to a variable before
-setMeasurementUnits: on it, even if that's the only message you send
to it; but I'm guessing that was just for brevity.)




Centimeters - well, typical of Americans to take language invented  
elsewhere and 'embrace, extend and extinguish' ;-)


But yes, it does say that this is registered by default...

So maybe the problem is that the NSRulerView is being alloc/inited,  
instead of simply requested from the scroll view, which will create  
them for you if you use -setHasHorizontal/VerticalRuler: and get the  
ruler using -horizontal/verticalRulerView.


I've never directly allocated and inited a ruler view - presumably  
you'd only do this if you were using a ruler separately from a  
scroll view.


--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: Override Font Tool and Colors Tool

2009-07-28 Thread Graham Cox


On 29/07/2009, at 12:29 PM, David Blanton wrote:

Color to us is thread brands and how to match a design done with one  
brand to other brands ... so our picker is a choice of threads with  
as close as possible matching to the original



Also, you could create a custom colorspace class that embodied the  
thread brand/name, etc so that you can work with colours in the  
"thread colorspace". This is becoming a pretty advanced topic though  
and I've never attempted this - but I think that's definitely a  
possibility.


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


About Posting

2009-07-28 Thread David Blanton
I do not post until I read the docs, code a sample and observe the  
results.


If the results do not match the docs I ask the question as it is more  
productive that spelunking Apple documentation for what at times are  
semantical obscurities.


In 1985 I taught myself 6800K assembler so I could program a Mac on a  
Mac ... at that time the only way to do so.


I have a degree in math from Berkeley.

I know how to study, learn, experiment and implement.

Screwing around as a mental exercise when there are resources  
available is total nonsense.


So, please, knock off the judgmental and be helpful for the platform  
that is only 9% of the market.


db

___

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


something I can't understand

2009-07-28 Thread Agha Khan

Hi:
I have a struct
@interface PngButton : UIButton
{
@public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end



PngButton* pPngButton   = [PngButton buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.

Best regards
Agha Khan
___

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: About Posting, PS

2009-07-28 Thread David Blanton
I worked for Apple from 1983 (employee number 408) until 1996 in  
sales, marketing and systems engineering.


I 'been there' and still support the platform in the face of constant  
criticism and belittlement from co-workers.


db


On Jul 28, 2009, at 8:45 PM, David Blanton wrote:

I do not post until I read the docs, code a sample and observe the  
results.


If the results do not match the docs I ask the question as it is  
more productive that spelunking Apple documentation for what at  
times are semantical obscurities.


In 1985 I taught myself 6800K assembler so I could program a Mac on  
a Mac ... at that time the only way to do so.


I have a degree in math from Berkeley.

I know how to study, learn, experiment and implement.

Screwing around as a mental exercise when there are resources  
available is total nonsense.


So, please, knock off the judgmental and be helpful for the platform  
that is only 9% of the market.


db

___

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/airedale%40tularosa.net

This email sent to aired...@tularosa.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: something I can't understand

2009-07-28 Thread Kiel Gillard

On 29/07/2009, at 12:52 PM, Agha Khan wrote:


Hi:
I have a struct
@interface PngButton : UIButton
{
@public
bool OffPos;
CGPoint horizontalLoc;
CGPoint verticalLoc;
}
@property (assign) bool OffPos;
@property (assign) CGPoint horizontalLoc;
@property (assign) CGPoint verticalLoc;
@end


No, you have an Objective-C class.

PngButton* pPngButton	= [PngButton  
buttonWithType:UIButtonTypeInfoDark];
[pPngButton setFrame:CGRectMake(screenRect.size.width - 70.0, 50.0,  
36, 36)]; // No problem


pPngButton.verticalLoc   = CGPointMake((bVerticalDisplay == YES) ?  
250 : 410, 50.0);


I get an error
error: lvalue required as left operand of assignment

Why it is not working? I shouldn't get this error.
Any help will be very much appreciated.


Do you get any warnings?

Try this and see what happens:
pPngButton.verticalLoc = CGPointMake((bVerticalDisplay == YES ?  
250.0 : 410.0), 50.0);


Kiel

___

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: NSRulerView

2009-07-28 Thread Andy Lee

On Jul 28, 2009, at 10:07 PM, Andy Lee wrote:

On Jul 28, 2009, at 9:42 PM, Graham Cox wrote:
You know, you could do worse than to spend a few hours actually  
reading the documentation


Or in this case just a few seconds to look at the doc for  
setMeasurementUnits:.


If a method doesn't do what you thought it would do, it makes a lot  
of sense to look at its documentation.


As has been pointed out, the documentation does say "Centimeters" if  
you follow the link in the doc for setMeasurementUnits:.  I stand  
chastised for not reading far enough in the docs myself.


Folks on this list appreciate when people have demonstrated some  
attempt to help themselves before posting.


Nevertheless, I stand by this statement.  It applies to every person  
and every post.  Don't assume you've reached some level of cred that  
excuses you from providing context for your questions.


--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: About Posting

2009-07-28 Thread Kyle Sluder
On Jul 28, 2009, at 7:45 PM, David Blanton   
wrote:


I do not post until I read the docs, code a sample and observe the  
results.


Constructive criticism: it's helpful to mention this in your post  
because it can reduce the problem space, highlight potentially  
overlooked issues, or maybe dispel the errant assumptions of those who  
hang out here a lot.


--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: About Posting

2009-07-28 Thread David Blanton

Thank you Kyle et al whose advice has helped me move the ball forward !

I do love code!

db


On Jul 28, 2009, at 9:38 PM, Kyle Sluder wrote:

On Jul 28, 2009, at 7:45 PM, David Blanton   
wrote:


I do not post until I read the docs, code a sample and observe the  
results.


Constructive criticism: it's helpful to mention this in your post  
because it can reduce the problem space, highlight potentially  
overlooked issues, or maybe dispel the errant assumptions of those  
who hang out here a lot.


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


  1   2   >