CoreData -- addPersistentStoreWithType crashing

2008-12-10 Thread Ben Lachman

Hi all:

I've been making some changes to one of my apps which include a change  
to the data model.  Now whenever I start up the app it crashes  
(EXEC_BAD_ACCESS) in  
addPersistentStoreWithType:configuration:URL:options:error:.  I've  
factored out all the passed arguments and it's still crashing.  I  
figure it must have to do with the change in the model, but I can't  
see why that would make it crash and not report an error or trow an  
exception, particularly if the URL points to a nonexistent file )e.g.  
it will create a new store file). Any thoughts?


Thanks,
-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: [EMAIL PROTECTED]
twitter: @benlachman
mobile: 740.590.0009

___

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 [EMAIL PROTECTED]


Re: how to manage two nib files

2008-12-10 Thread Ken Thomases

On Dec 8, 2008, at 8:40 AM, XiaoGang Li wrote:

Thanks. I have read these references, but I still have no idea about  
my
issue, Maybe I did not understand them completely now, but I am  
worried that
maybe I have not give a clear expression in my first email. Maybe I  
need

give a more detailed description:

  this application is a utility for my printer, which be  
launched

by the utility button on the Printer Setup Center. when user click the
utility button, the Mac OS X will launch the linked application. and  
the
application should first register an apple event, the Mac OS X then  
will
send the apple event which used to tell my utility the printer model  
name

and related information about the device. So, before the appliction be
launched, it should get the apple  event and check the printer name,  
then it
will load the nib file dependently. If the printer is a USB printer,  
it will
load a normal window to interact with user, if it is a Network, it  
will

launch another application to do other things.

   So, I have no idea to design this application. I think this
question maybe can not be implemented by cocoa application template,  
but I

know that it seems no need to use NSDocument class. Thanks.


You don't need to use the Document-based application template.

An application typically has a main nib.  This is configured using the  
Main Nib File field of the Properties tab of the info window for the  
target.  The value of that field gets translated at build time into  
the NSMainNibFile key in the application's Info.plist file.


The main nib is loaded by NSApplicationMain().  Often it contains the  
main window of your application, whatever that might be.  However, the  
main nib can be reduced to contain only the main menu bar and nothing  
else.  This allows you to defer the decision about what window to show  
until you receive the Apple Event you're expecting.


When you do receive it, you can load whatever nib you like.  Often,  
you use a custom subclass of NSWindowController.  Have it both load  
the nib and act as the nib's owner.  In your nib, you'd configure the  
class of File's Owner to be your custom class.  You'd connect its  
window outlet to the main window in that nib.  In your application  
controller, at the time when you realize which nib you want to load,  
you allocate and initialize an instance of your class, and ask it to  
show its window.  That last step will cause it to load its nib,  
thereby instantiating the window and showing it.


If for some reason you don't want to use NSWindowController to load  
the nib, you can use methods of NSBundle or NSNib to load the nib.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: Weird behavior of mouse location when performing a drag

2008-12-10 Thread chaitanya pandit

Try this,
NSPoint apoint = [self convertPoint:[sender draggedImageLocation]  
fromView:nil];


HTH,
Chaitanya

On 08-Dec-08, at 11:26 PM, Gustavo Pizano wrote:


Hello all.

Well Im performing a drag-ndrop between views of the same app, I  
implemented the  - (NSDragOperation)draggingUpdated:(id   
NSDraggingInfo )sender method, because I need to know the location  
of the mouse so I can place the image in the correct position of the  
view. But weirdly after converting the point to the currentview   
there was a gap of about 145ox in x coordinate and 45 px in the y  
coord, those values are not even close to where the view resides in  
the window. So what I did to fix the problem was the following.


- (NSDragOperation)draggingUpdated:(id  NSDraggingInfo )sender
{
NSPoint converted = [NSEvent mouseLocation];
actualDragPoint = [self convertPoint:converted fromView:nil];   
actualDragPoint.x = actualDragPoint.x - 144 ;
actualDragPoint.y =  actualDragPoint.y -76; 
return NSDragOperationMove;
}

it fixed the problem, but Im wondering why is this happening?


Any clues?

Thanks

Gustavo

___

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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: NSTask and environment variables

2008-12-10 Thread Ken Thomases

On Dec 9, 2008, at 4:51 AM, Ingvar Nedrebo wrote:


On Dec 9, 2008, at 00:43, Chris Idou wrote:


I want to call a script with NSTask and I want to set an environment
variable.

But it seems like bad form to blow away the current environment. So  
I guess I
need to read the current environment and extend it before passing  
it to

NSTask.

Is there any Cocoa API which returns the environment as a  
NSDictionary, or do

I need to drop down to the UNIX getenv() level?



I just call setenv(). That sets one variable without affecting the  
rest of the environment, as far as I know?



Yes, but it affects the current process, which may be undesirable.   
One often wants to set the environment variable only for the child  
process, which is what I assume the OP is after.


Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Return Control To Next Active App Without Hiding?

2008-12-10 Thread Chunk 1978
the closest thing i've come to being able to bring front the most
recent app is using this:

[NSApp hide:self];
[NSApp unhideWithoutActivation];

but that flashes my app, and kinda looks like a glitch... is there any
standard method i can use to make this happen instead?
___

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 [EMAIL PROTECTED]


Re: How to launch window of the application on clicking of dock icon?

2008-12-10 Thread Ken Thomases

On Dec 9, 2008, at 11:49 PM, Arun wrote:


Thanks for the reply.

My app is not a document based.
I tried using the applicationDidBecomeActive to bring up my main  
window. It
works only when my application is not active. i.e., when the   
MenuBar is
occupied by other application. If i launch my app and close the  
window, the
menu bar is still occupied with My App's menu bar. If noe i click on  
the

dock icon, the window will not come up. I need the window to come up.


The advice to use -applicationDidBecomeActive was misguided.

Instead, you should use these delegate methods:

-applicationOpenUntitledFile:
-applicationShouldOpenUntitledFile:
-applicationShouldHandleReopen:hasVisibleWindows:


See here for further explanation: 
http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html

Note that the methods regarding opening an untitled file do not  
necessary have to do with files.  They have to do with whatever window  
the application should open by default.  Also, they are shared by the  
code for the original opening of the application, not just reopening,  
so be sure to consolidate common code there.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: How to detect a paste request for file copy/paste?

2008-12-10 Thread Conor
You still need to give the pasteboard an array of the file type for  
NSFilesPromisePboardType. Your missing the line:


[pboard setPropertyList:[NSArray arrayWithObjects:@txt, nil]  
forType:NSFilesPromisePboardType];


But I would recommend initiating the promised drag with the NSView's  
method:


- (BOOL)dragPromisedFilesOfTypes:(NSArray *)typeArray fromRect: 
(NSRect)aRect source:(id)sourceObjectslideBack:(BOOL)slideBack event: 
(NSEvent *)theEvent;


file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/DragandDrop/Tasks/DraggingFiles.html

Conor
http://www.bruji.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 [EMAIL PROTECTED]


Re: The thread that starts by NSTask didn't clear up

2008-12-10 Thread Etienne Guérard

Hi,

On Dec 10, 2008, at 2:26 AM, Xianyu_Ge wrote:

thanks for your reply. I means in my project, I want to use NSTask  
to launch an application, and send application some parameters, when  
use NSTask launch application that will add a new thread, right?


As far as I understand, you use NSTask to launch your application. But  
this does not imply that a new thread is created to monitor the  
launched process, unless of course, if you setup your own thread to  
monitor the process.
So I think you assume that NSTask will use a thread but this is wrong.  
NSTask is just a wrapper around execve(), no threading involved here.


and then send Apple event, when application received Apple event ,  
it will quit, usually, the thread starts by NSTask will exit,  
because the application had quit, so I don't understand this, if use  
NSTask launch application more times, thread count will always  
increased, even if application had quit. I appreciate that any  
reply, thank you very much.


You can use ThreadViewer to convince yourself that there's no  
threading involved by using NSTask.


EG



---
Best Regards,
Xianyu

On Dec 10, 2008, at 12:44 AM, Etienne Guérard wrote:

	I started an AP use NSTask in my project ,when I loaded this AP,  
thread count will be increased ,after sending apple event to AP ,  
and AP will exit, but thread count can't decrease. If I used this  
method load AP more times, thread count will increased, but there  
was no problem on tiger, just  present leopard. Sorry for my poor  
english.


I assume that AP acually means application.
I understand that you send some Apple event to your application  
like a quit' event, right?
You say that your application exit. OK. So what process the threads  
you're talking about belong to?

Where does NSTask come into this?

You have to be more precise to get an answer...

EG



This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is prohibited. E-mails 
are susceptible to alteration. Neither DxO Labs nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation 
ou diffusion non autorisee est interdite. Tout message electronique est susceptible 
d'alteration. DxO Labs et ses filiales declinent toute responsabilite au titre de ce 
message s'il a ete altere, modifie ou falsifie.

___

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 [EMAIL PROTECTED]


Re: Problems with multiple selection and NSArrayController

2008-12-10 Thread Volker in Lists

Hi,

does the detail arraycontroller show all categories and selects the  
ones contained in the set of your selected master rows? Can't you just  
display only the detail categories that are within the set of the  
selected master? This would be easy to do even with multiple master  
objects selected via the Content Array For Multiple Selection  
binding of the categories controller. And it would reflect the  
expected Cocoa behaviour.


Volker

Am 10.12.2008 um 11:20 schrieb David Niemeijer:


Hi,

I have a master table that displays that gets it's contents  
NSArrayController with items. Each of those items has a categories  
key which contain an NSMutableIndexSet. When the user selects a row  
in the master table my app displays in a detailed view a detail  
table with categories. The contents of that detail table comes from  
a categories NSArrayController and the selection is determined by  
the index set of the categories key of the selected item of the  
master table. If the user changes the selection in that detail table  
the indexes nicely update for the selected item of the master table.  
Up to this point everything works fine so far.


Now I add multiple selection to the master table. When two selected  
items in the master table have index sets that contain the same  
indexes everything is still ok, but when the each have different  
indexes a problem will occur. No categories will get selected in the  
detail table and when I click elsewhere in the master table the  
category indexes of the two originally selected items will become  
empty sets.


So, what would I need to do to prevent problems with multiple  
selection in the master table?


Thanks,

david.
___

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/volker_lists%40ecoobs.de

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Graham Cox

I need to draw outside of the usual drawRect: method (no really, I do!)

The reason is that I have a custom cell that is used in a table/ 
outline view that draws a colour swatch. When clicked it pops up a  
menu of colours so the user can choose another colour. While tracking  
the menu, the cell shows the colour in the menu that the mouse is  
over. When the mouse is released, the cell sends the chosen colour to  
the table's datasource as usual.


The drawing of the colour while tracking the menu needs to take place  
outside the drawRect: mechanism. Why? Because the host view is a  
table, and I need to avoid it reloading the cell from the datasource  
while I'm tracking the menu. If I invalidate the table view, it will  
redraw the entire row. That would be OK if I could rely on it to draw  
only my row, but in some circumstances I have found that it doesn't,  
but redraws the whole table (for example after editing a text cell,  
for some reason any setNeedsDisplayInRect: on a small part of the  
table causes the whole table to reload). That stuffs up the cell  
because its colour value can get switched out (to nil or another  
colour) while it should really reflect what is being tracked in the  
menu or was just chosen from the menu. (I have tried a whole lot of  
tricks to try to make it work that way, believe me, but it's so  
convoluted and I have so little control over what is happening in the  
tableview that I have given up and am trying to work it by short- 
circuiting the cell drawing, but only while tracking).


So anyway, things are almost working fine - in fact they do work fine  
at all times except the very first use of the cell. If the table is  
used in any way prior to clicking the cell (selecting any row, for  
example), it works fine. But if the first ever click on the table is  
on my cell, I get no drawing - it's as if the cell is clipped out  
(though forcing the clip to my cell's rect doesn't fix this so it's  
not actually that). For my cell to work, the table has to have done  
something other than draw its rows.


I draw my cell like this:

- (void)drawImmediately
{
[mControlView lockFocus];
[self drawInteriorWithFrame:mFrame inView:mControlView];
[mControlView unlockFocus];
[[mControlView window] flushWindow];
}


where mControlView and mFrame are ivars that are set on entry to  
the mousetracking method to be the hosting control view and the cell's  
frame respectively. I have verified that mControlView is indeed always  
valid and the correct object at this point. The cell rect is also good.


Maybe it s a graphics context problem? I have tried always setting the  
current context to the view's window but that stops it from ever  
working (which may be a clue). Anyone spot anything I'm doing or not  
doing here?


Also, if you feel tempted to advise me not to do it this way, believe  
me, I have exhaustively investigated that route, which has proven even  
more problematic, because there's insufficient fine control over what  
the tableview itself does in its own drawRect: method. So far this  
approach is the cleanest by far.


tia,

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 [EMAIL PROTECTED]


Wake up Reason

2008-12-10 Thread sheen mac
Hi All,

Is it possible to know the reason the MacBook wake from sleep?.
Its from wake on lan or ac power change or lid wake ? . Where
i will get more info about this?.

Thanks in Advance,
Sheen


  
___

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 [EMAIL PROTECTED]


Re: How Can I Notify DrawRect Method?

2008-12-10 Thread I. Savant

On Dec 9, 2008, at 8:44 PM, Graham Cox wrote:

I realise this is an implementation detail, but there's nothing in  
the docs that implies that the defaults values are unarchived from  
disk every time; why would they be?


  Never implied that. :-) The unarchiving I referred to is non- 
NSCoding-compliant objects (such as NSColor).


--
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 [EMAIL PROTECTED]


Re: How Can I Notify DrawRect Method?

2008-12-10 Thread I. Savant

On Dec 9, 2008, at 10:37 PM, Sean McBride wrote:


Well, such things are never black and white, of course... but I just
wanted to add that caching the value increases your application's  
memory
use (admittedly only slightly in the case being discussed).  But in  
the

general case, by increasing memory use you:
- can fit less in the CPU's cache
- increase paging
- etc.

So it could actually lead to making your app slower!


 Quite possible. Though I'd like to make a counter-point. :-) It's  
inexact but in the case of mobile devices (for Cocoa anyway), you have  
laptops that have hard disks but more RAM. You also have iPhones and  
iPod Touches that have less RAM but a solid state storage device. I  
tend toward leaning more on memory than on processor overhead and  
worry about optimizing from there if needed, but I admit that may be  
overly simplistic.


  DISCLAIMER: None of this is meant to suggest you should go around  
spending any real time and effort optimizing without profiling first.


  I'd love to see some direct comparisons between Apple products  
along these lines but a good test requires a good range of hardware  
and an iPhone developer membership.


--
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 [EMAIL PROTECTED]


Re: The thread that starts by NSTask didn't clear up

2008-12-10 Thread Etienne Guérard

OK
It seems that in leopard NSTask uses a thread to monitor the launched  
process, presumably to detect process termination. This thread should  
disappear shortly after the corresponding NSTask instance is released.


Since the launched NSTask is auto-released you need to do one of the  
following:

1. Install a NSAutoreleasePool somewhere in your loop
2. Use [[NSTask alloc] init] and explicitly release your task when  
you're done.


EG

On Dec 10, 2008, at 11:02 AM, Xianyu_Ge wrote:


hi, EG,
 	Thanks for you help. I had use threadViewer to note thread count,   
when go to step that launch application use NSTask, thread count  
will added, when application quit, the thread didn't stopped,  but  
on tiger this works right I think. I copy some codes as follows:


NSMutableArray* args = [[[NSMutableArray alloc] init] autorelease];
NSString* ips = [NSString stringWithCString : ipAddress];
NSString* dsn = [NSString stringWithCString : dsName];
NSString* tmp = [@-T:\ stringByAppendingString:dsn];
tmp = [tmp stringByAppendingString:@\,];
tmp = [tmp stringByAppendingString:ips];

NSString* arg1 = [NSString stringWithFormat:@-T:\%s\,%s,dsn,ips];

arg1 = tmp;
NSLog(@the command line is %@,arg1);
[args addObject:arg1];

	NSTask* theTask = [NSTask launchedTaskWithLaunchPath:excuPath  
arguments:[NSArray arrayWithObjects:arg1,nil]];

[theTask waitUntilExit];

when step NSTask* theTask = [NSTask  
launchedTaskWithLaunchPath:excuPath arguments:[NSArray  
arrayWithObjects:arg1,nil]];  end, a thread will added until main  
thread exit.



---
Best Regards,
Xianyu





On Dec 10, 2008, at 5:46 PM, Etienne Guérard wrote:


Hi,

On Dec 10, 2008, at 2:26 AM, Xianyu_Ge wrote:

thanks for your reply. I means in my project, I want to use NSTask  
to launch an application, and send application some parameters,  
when use NSTask launch application that will add a new thread,  
right?


As far as I understand, you use NSTask to launch your application.  
But this does not imply that a new thread is created to monitor the  
launched process, unless of course, if you setup your own thread to  
monitor the process.
So I think you assume that NSTask will use a thread but this is  
wrong. NSTask is just a wrapper around execve(), no threading  
involved here.


and then send Apple event, when application received Apple event ,  
it will quit, usually, the thread starts by NSTask will exit,  
because the application had quit, so I don't understand this, if  
use NSTask launch application more times, thread count will always  
increased, even if application had quit. I appreciate that any  
reply, thank you very much.


You can use ThreadViewer to convince yourself that there's no  
threading involved by using NSTask.


EG



---
Best Regards,
Xianyu

On Dec 10, 2008, at 12:44 AM, Etienne Guérard wrote:

	I started an AP use NSTask in my project ,when I loaded this  
AP, thread count will be increased ,after sending apple event to  
AP , and AP will exit, but thread count can't decrease. If I  
used this method load AP more times, thread count will  
increased, but there was no problem on tiger, just  present  
leopard. Sorry for my poor english.


I assume that AP acually means application.
I understand that you send some Apple event to your application  
like a quit' event, right?
You say that your application exit. OK. So what process the  
threads you're talking about belong to?

Where does NSTask come into this?

You have to be more precise to get an answer...

EG






This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is prohibited. E-mails 
are susceptible to alteration. Neither DxO Labs nor any of its subsidiaries or affiliates 
shall be liable for the message if altered, changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation 
ou diffusion non autorisee est interdite. Tout message electronique est susceptible 
d'alteration. DxO Labs et ses filiales declinent toute responsabilite au titre de ce 
message s'il a ete altere, modifie ou falsifie.

___

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 [EMAIL PROTECTED]


Re: How Can I Notify DrawRect Method?

2008-12-10 Thread I. Savant

On Dec 9, 2008, at 10:32 PM, Michael Ash wrote:


This is a common response whenever I talk about not optimizing where
it's not useful. But the thing is, trying to optimize every little
thing makes your app *slower*.


...


Of
course you'll have gone through only a miniscule fraction of the bolts
in the bridge before the people who hired you to build it get fed up
and tell you to open it for traffic or get lost. Result: a very heavy
bridge.


  These are two *completely* separate arguments: Development time  
versus runtime efficiency.


--
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 [EMAIL PROTECTED]


RE: Design patterns: MVC, MVP, Passive View... where is Apple heading???

2008-12-10 Thread Karan, Cem (Civ, ARL/CISD)
  To lay the groundwork for this question, I'm going to state that I'm

  getting my definitions for MVC, MVP, and Passive View from the
  following:
 
  http://en.wikipedia.org/wiki/Model-view-controller
  http://en.wikipedia.org/wiki/Model_View_Presenter
  http://www.martinfowler.com/eaaDev/PassiveScreen.html
 
  Apple has always stated that it uses the MVC design pattern, but I 
  noticed in OS X 10.5 we've gotten NSViewController, KVO, bindings, 
  etc.,  objects that seem to behave more like the Passive View design

  pattern.  Is this where Apple wants us to head?  I want to plan out
my 
  code in a manner that plays as well as possible with Apple's chosen 
  design patterns, which is why I want to know where Apple is headed.
 
  Thanks,
  Cem Karan

Because this is not directly Cocoa related, I moved the question to
stackoverflow:

http://stackoverflow.com/questions/353646/design-patterns-for-apples-coc
oa-frameworks-mvc-mvp-passive-view-where-is-apple

If anyone wants to comment, that appears to be the best place.

Thanks,
Cem Karan
___

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 [EMAIL PROTECTED]


Re: CoreData -- addPersistentStoreWithType crashing

2008-12-10 Thread John Pannell

Hi Ben-

If you are using a custom class to represent an entity in your model,  
you must make sure that it is a subclass of NSManagedObject in your  
code (and not NSObject).  This might not be your issue, but I have had  
this bite me before - it issues the same error with no exception  
thrown, and is quite a challenge to debug.  I fall into this when  
moving fast in model creation, as the template for adding an Objective- 
C Class to a project makes it a subclass of NSObject.


Hope this helps!

John

Positive Spin Media
http://www.positivespinmedia.com

On Dec 10, 2008, at 12:58 AM, Ben Lachman wrote:


Hi all:

I've been making some changes to one of my apps which include a  
change to the data model.  Now whenever I start up the app it  
crashes (EXEC_BAD_ACCESS) in  
addPersistentStoreWithType:configuration:URL:options:error:.  I've  
factored out all the passed arguments and it's still crashing.  I  
figure it must have to do with the change in the model, but I can't  
see why that would make it crash and not report an error or trow an  
exception, particularly if the URL points to a nonexistent  
file )e.g. it will create a new store file). Any thoughts?


Thanks,
-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.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 [EMAIL PROTECTED]


Problems with multiple selection and NSArrayController

2008-12-10 Thread David Niemeijer

Hi,

I have a master table that displays that gets it's contents  
NSArrayController with items. Each of those items has a categories key  
which contain an NSMutableIndexSet. When the user selects a row in the  
master table my app displays in a detailed view a detail table with  
categories. The contents of that detail table comes from a categories  
NSArrayController and the selection is determined by the index set of  
the categories key of the selected item of the master table. If the  
user changes the selection in that detail table the indexes nicely  
update for the selected item of the master table. Up to this point  
everything works fine so far.


Now I add multiple selection to the master table. When two selected  
items in the master table have index sets that contain the same  
indexes everything is still ok, but when the each have different  
indexes a problem will occur. No categories will get selected in the  
detail table and when I click elsewhere in the master table the  
category indexes of the two originally selected items will become  
empty sets.


So, what would I need to do to prevent problems with multiple  
selection in the master table?


Thanks,

david.
___

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 [EMAIL PROTECTED]


Searchable persistent file reference

2008-12-10 Thread Ben

Hi list,

I am trying to store a reference to a file in a database, such that if  
the file moves, I can still search for it in my database.
I have read up on the Carbon Alias Manager and the third party BSAlias/ 
NDAlias classes but none of these quite seem to fit the bill as it  
looks like I am working backwards from their designed use. ie, rather  
than finding the file from a database record, I want to lookup the  
database record from a known file.


In this situation, would it be best to use -[NSFileManager  
attributesOfItemAtPath:error:] and store the NSFileSystemFileNumber?  
I'm not sure how resilient this approach is. Or is there something  
that I have missed completely?


Regards,

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 [EMAIL PROTECTED]


Re: Problems with multiple selection and NSArrayController

2008-12-10 Thread David Niemeijer

Volker,

On Dec 10, 2008, at 11:42 AM, Volker in Lists wrote:
does the detail arraycontroller show all categories and selects the  
ones contained in the set of your selected master rows?


yes.

Can't you just display only the detail categories that are within  
the set of the selected master? This would be easy to do even with  
multiple master objects selected via the Content Array For Multiple  
Selection binding of the categories controller. And it would  
reflect the expected Cocoa behaviour.


The problem with doing that is that it would make it more complicated  
for the user to add new categories, as in that case the detail table  
would only show the already selected categories and thus offer no way  
to select additional categories. Currently adding more categories to  
an item is just a matter of selecting multiple ones. What you are  
suggesting implies adding a different user interface for adding  
categories to an item. Maybe that is the only solution or even best  
solution?


david.


Am 10.12.2008 um 11:20 schrieb David Niemeijer:


Hi,

I have a master table that displays that gets it's contents  
NSArrayController with items. Each of those items has a categories  
key which contain an NSMutableIndexSet. When the user selects a row  
in the master table my app displays in a detailed view a detail  
table with categories. The contents of that detail table comes from  
a categories NSArrayController and the selection is determined by  
the index set of the categories key of the selected item of the  
master table. If the user changes the selection in that detail  
table the indexes nicely update for the selected item of the master  
table. Up to this point everything works fine so far.


Now I add multiple selection to the master table. When two selected  
items in the master table have index sets that contain the same  
indexes everything is still ok, but when the each have different  
indexes a problem will occur. No categories will get selected in  
the detail table and when I click elsewhere in the master table the  
category indexes of the two originally selected items will become  
empty sets.


So, what would I need to do to prevent problems with multiple  
selection in the master table?


Thanks,

david.
___

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/volker_lists%40ecoobs.de

This email sent to [EMAIL PROTECTED]





___

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 [EMAIL PROTECTED]


Static and Dynamic libraries for iPhone apps ?

2008-12-10 Thread Ruslan Zasukhin
Hi All,

1) Can we build e.g.
XCODE menu File =  Project New  = Static Library Cocoa

And later use it for iPhone application to be linked with it?


2) the same question for DYLIB Cocoa, and then
to be used with iPhone app
e.g. If we put it inside of app bundle


Just sometimes it is comfortable to put something into libs, and then only
link to APP.

Will this work?



I believe answer is yes, because iPHone self contains tons of BSD dylibs and
static libs. So we can also do this?

If yes, so we can produce both?  BSD and Cocoa libs?
 


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]


___

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 [EMAIL PROTECTED]


Re: Searchable persistent file reference

2008-12-10 Thread Mike Abdullah
FSRef is the data type for referencing a particular file by record,  
however it's not the pleasant to work with. Have you considered using  
NDAlias etc. but setting them to resolve references by file ref, then  
path. (By default, the alias manager looks up aliases by path first,  
then file ref).


On 10 Dec 2008, at 13:59, Ben wrote:


Hi list,

I am trying to store a reference to a file in a database, such that  
if the file moves, I can still search for it in my database.
I have read up on the Carbon Alias Manager and the third party  
BSAlias/NDAlias classes but none of these quite seem to fit the bill  
as it looks like I am working backwards from their designed use. ie,  
rather than finding the file from a database record, I want to  
lookup the database record from a known file.


In this situation, would it be best to use -[NSFileManager  
attributesOfItemAtPath:error:] and store the NSFileSystemFileNumber?  
I'm not sure how resilient this approach is. Or is there something  
that I have missed completely?


Regards,

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Erik Buck
You don't have to draw outside of -drawRect:.  Instead of invalidating  
the table, just call -setNeedsDisplayInRect: or -displayInRect: and  
pass only the rect of the row that needs to be redrawn. 
  
___


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 [EMAIL PROTECTED]


Re: Searchable persistent file reference

2008-12-10 Thread matt . gough


On 10 Dec 2008, at 14:59, Ben wrote:

I am trying to store a reference to a file in a database, such that  
if the file moves, I can still search for it in my database.
I have read up on the Carbon Alias Manager and the third party  
BSAlias/NDAlias classes but none of these quite seem to fit the bill  
as it looks like I am working backwards from their designed use. ie,  
rather than finding the file from a database record, I want to  
lookup the database record from a known file.


In this situation, would it be best to use -[NSFileManager  
attributesOfItemAtPath:error:] and store the NSFileSystemFileNumber?  
I'm not sure how resilient this approach is. Or is there something  
that I have missed completely?


Not sure that's such a good idea for several reasons, 2 of which are:

The FileSystem number wouldn't survive a copy of the database and file  
to another volume.
I am not sure that NSFileSystemFileNumber will be available or  
persistent for some volume formats.


I think you should stick with the alias approach. If you need to match  
a moved file, then just resolve all the aliases in your database until  
you find the file you are looking for.


You could maybe speed up 'normal' searching by keeping a hash of the  
relative path from the database to the file and searching for that  
first, and only fall back to the full scan if that fails. (If a  
relative path is not available (i.e crossing volumes/servers) then  
just hash the full path of the file.)

___

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 [EMAIL PROTECTED]


Re: Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Graham Cox


On 11 Dec 2008, at 1:23 am, Erik Buck wrote:

You don't have to draw outside of -drawRect:.  Instead of  
invalidating the table, just call -setNeedsDisplayInRect: or - 
displayInRect: and pass only the rect of the row that needs to be  
redrawn.



Thanks - I'm well aware of how that works. The problem as I did state  
was that under some circumstances I can't control or fully isolate,  
the tableview decides to reload all of its visible rows even if only a  
small area was invalidated, thus blowing away my cell's temporary  
state during menu tracking. It's working around this behaviour that  
has led me here, after about two very long days of trying it the  
normal way. In fact, that reminds me, it's high time I went to  
bed...


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 [EMAIL PROTECTED]


Very odd issue when try to implement the drag and drop functions for NSOutlineview

2008-12-10 Thread Alex . Wang
Hi, everyone.
Currently I am working on a project which uses the NSOutlineview heavily. I
thought the drag and drop functions are very important, so I am trying to
implement that.
However, after refer to some tutorials, I still can't make it work... My
steps are :
1. create a controller to manage the outlineview, set the controller to the
datasouce and delegate for the outlineview.
2. register the outineview with the following code in the awakeFromNib
method:
[_outlineView registerForDraggedTypes:
[NSArray arrayWithObject:MyPrivateTableViewDataType]];
3. implement the following methods:
- (BOOL)outlineView:(NSOutlineView *)ov
 writeItems:(NSArray *)items
   toPasteboard:(NSPasteboard *)pboard
 {

 draggedNodes = items;
NSlog(@In the outlinew writeItems method!);
 [pboard declareTypes:[NSArray
arrayWithObject:MyPrivateTableViewDataType] owner:self];
 [pboard setData:[NSData data] forType:MyPrivateTableViewDataType];

return YES;
}

- (NSDragOperation)outlineView:(NSOutlineView*)ov
  validateDrop:(id NSDraggingInfo)info
  proposedItem:(id)item
proposedChildIndex:(NSInteger)childIndex{

  NSLog(@Return the NSDragOperation);
draggedNodes = [[[info draggingSource] dataSource] draggedNodes];
return NSDragOperationGeneric;
}

- (BOOL)outlineView:(NSOutlineView *)ov
 acceptDrop:(id NSDraggingInfo)info
   item:(id)item
 childIndex:(NSInteger)childIndex
{
   NSLog(@should we return the accetpDrop?);
   return YES;
}

After compiled the application and set it up, I had no chance to
successfully get anything from the console although there are so many output
statements when I drag and drop items repeatly.
Can anyone here give me some help or guidance about this issue?
Thank you very much for any help. Good luck.

-- 
Best regards.
___

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 [EMAIL PROTECTED]


how to pass arguments by reference

2008-12-10 Thread Nick Rogers

Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax that  
I should follow?


Thanks,
Nick

___

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 [EMAIL PROTECTED]


Re: Very odd issue when try to implement the drag and drop functions for NSOutlineview

2008-12-10 Thread chaitanya pandit

Hi,
This was a reply that i posted recently for a similar question, i  
think you are missing step 2


To re-order the items in the tableView, you will have to implement a  
custom drag type.

Say for example you name your custom drag type as @myDragType
then
1] Register your table view to accept this drag type using  
registerForDraggedTypes: and passing an array containing  
@myDragType along with super's drag types
2] In your tableView's data source, implement this method  
tableView:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes 
: and return an array containing @myDragType.
3] Implement tableView:writeRowsWithIndexes:toPasteboard: in your  
data source and write any dummy data in the given pasteboard for type  
@myDragType, this can be the data representing the items/indexes  
being dragged
4] Check for a valid drop with  
tableView:validateDrop:proposedRow:proposedDropOperation:
5] Finally set the new indexes for the dragged items in   
tableView:acceptDrop:row:dropOperation:

HTH,
Chaitanya

On 10-Dec-08, at 9:07 PM, Alex.Wang wrote:


Hi, everyone.
Currently I am working on a project which uses the NSOutlineview  
heavily. I
thought the drag and drop functions are very important, so I am  
trying to

implement that.
However, after refer to some tutorials, I still can't make it  
work... My

steps are :
1. create a controller to manage the outlineview, set the controller  
to the

datasouce and delegate for the outlineview.
2. register the outineview with the following code in the awakeFromNib
method:
[_outlineView registerForDraggedTypes:
   [NSArray arrayWithObject:MyPrivateTableViewDataType]];
3. implement the following methods:
- (BOOL)outlineView:(NSOutlineView *)ov
writeItems:(NSArray *)items
  toPasteboard:(NSPasteboard *)pboard
{

draggedNodes = items;
   NSlog(@In the outlinew writeItems method!);
[pboard declareTypes:[NSArray
arrayWithObject:MyPrivateTableViewDataType] owner:self];
[pboard setData:[NSData data] forType:MyPrivateTableViewDataType];

   return YES;
}

- (NSDragOperation)outlineView:(NSOutlineView*)ov
 validateDrop:(id NSDraggingInfo)info
 proposedItem:(id)item
   proposedChildIndex:(NSInteger)childIndex{

 NSLog(@Return the NSDragOperation);
   draggedNodes = [[[info draggingSource] dataSource] draggedNodes];
   return NSDragOperationGeneric;
}

- (BOOL)outlineView:(NSOutlineView *)ov
acceptDrop:(id NSDraggingInfo)info
  item:(id)item
childIndex:(NSInteger)childIndex
{
  NSLog(@should we return the accetpDrop?);
  return YES;
}

After compiled the application and set it up, I had no chance to
successfully get anything from the console although there are so  
many output

statements when I drag and drop items repeatly.
Can anyone here give me some help or guidance about this issue?
Thank you very much for any help. Good luck.

--
Best regards.
___

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/chaitanya%40expersis.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Dave DeLong

Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection:(int)treeDirection...

HTH,

Dave

On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


Thanks,
Nick

___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Nick Rogers

Hi, thanks for the reply.
Now I have:

- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

Still the same error: parse error before  token

Thanks,
Nick

On 10-Dec-08, at 9:15 PM, Dave DeLong wrote:


Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection: 
(int)treeDirection...


HTH,

Dave

On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


Thanks,
Nick

___

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Ken Thomases

On Dec 10, 2008, at 9:45 AM, Dave DeLong wrote:


Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection: 
(int)treeDirection...


I haven't tried that, but it doesn't look right.  It doesn't  
correspond to any C or C++ syntax I've ever seen.




On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


References are a language feature of C++.  Neither C nor Objective-C  
has such a notion.  You would have to use Objective-C++, which is  
usually accomplished by using a .mm extension for your source file.


Note that if you use C++ features in a header file, then all  
translation units which include that header will have to be C++ or  
Objective-C++, unless you conditionalize the code with #ifdef  
__cplusplus.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Dave DeLong

Spoke too soon... whoops.

Put an asterisk before the type, indicating that the type is going to  
come in as a pointer to the data and not the actual data.  Then when  
you call the method, you use the ampersand to pass a pointer to your  
data, like so:


(in some class definition somewhere.  A C function would have slightly  
different syntax, shown below):

- (void) foo:(*int)bar {
  (*bar)++;
}

Then elsewhere,

int baz = 42;
NSLog(@%d, baz);
[someReceiver foo:baz];
NSLog(@%d, baz);

You should see 42 printed, and then 43.

If you wanted to declare foo as a C function, you'd do it like so:

void foo (int *bar) {
  //same stuff
}

Welcome to the wonderful world of pointers.

Dave

On Dec 10, 2008, at 8:45 AM, Dave DeLong wrote:


Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection: 
(int)treeDirection...


HTH,

Dave

On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


Thanks,
Nick

___

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/davedelong%40me.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Custom NSTableView cells

2008-12-10 Thread René v Amerongen


On 10 dec 2008, at 02:40, Graham Cox wrote:

I could use a little guidance, please, on customizing cells for  
display in an NSTableView.


My table has but one column, but each cell in that column is made  
up of 2 or more views.  I think I have what I need as far as the  
cells go, but it's feeding them to the table view that's giving me  
problems.


I'm not sure what you mean by each cell having two views. Do you  
literally mean NSViews, or are you using the term more loosely?  
AFAIK, it's really not feasible to embed actual NSViews in a cell.


http://www.stepwise.com/Articles/Technical/2003-12-20.01.html
___

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 [EMAIL PROTECTED]


IB Scroll View position problem

2008-12-10 Thread Randy Bradley

I have two scroll views in my application, each with a table view, in
addition to a bunch of other items.  Everything is locked to the upper left
corner of the window view.  When the window is resized, I would like the
scroll views to expand and shrink along with the window.  The smaller scroll
view is located on the left, near the middle of the window, is fixed width
and and extends down to the bottom of the window.

Everything is fine as long as the window expands and shrinks to a
vertical size no smaller than the original size.  However, if I make the
window smaller, vertically, then the scroll view assumes a vertical position
that is higher in the window than the original location.  In IB in the
scroll view size, autosizing box, I have the top, left, and bottom
constraints and only the vertical resize constraint.  I think this may be a
bug.  

IB version is 3.0 (629).


Thanks All.

___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Dave DeLong
This is what I get for typing in an email window and not a code  
editor...


- (void) foo:(int*)bar {
  (*bar)++;
}

Dave

On Dec 10, 2008, at 8:54 AM, Dave DeLong wrote:


- (void) foo:(*int)bar {
 (*bar)++;
}


___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread jmunson

is this:

(*int)

the same as:

(int *)

?

I've always seen (int *) as the declaration...

Quoting Dave DeLong [EMAIL PROTECTED]:


Spoke too soon... whoops.

Put an asterisk before the type, indicating that the type is going to
come in as a pointer to the data and not the actual data.  Then when
you call the method, you use the ampersand to pass a pointer to your
data, like so:

(in some class definition somewhere.  A C function would have slightly
different syntax, shown below):
- (void) foo:(*int)bar {
  (*bar)++;
}

Then elsewhere,

int baz = 42;
NSLog(@%d, baz);
[someReceiver foo:baz];
NSLog(@%d, baz);

You should see 42 printed, and then 43.

If you wanted to declare foo as a C function, you'd do it like so:

void foo (int *bar) {
  //same stuff
}

Welcome to the wonderful world of pointers.

Dave

On Dec 10, 2008, at 8:45 AM, Dave DeLong wrote:


Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection:(int)treeDirection...

HTH,

Dave

On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax   
that I should follow?


Thanks,
Nick

___

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/davedelong%40me.com

This email sent to [EMAIL PROTECTED]


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]




___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread James Montgomerie
What you're looking to do is a C++ism, it's not available in Objective- 
C; there's no explicit support for pass by reference.


It's certainly possible to achieve the same ends though.  For  
primitive types, you'll have to pass a pointer.  Declare the method as  
taking, for example 'int *' if you want to pass a pointer-to-int, and  
call it by taking the address of the thing you want to pass a pointer  
to (e.g. use 'myInt' if 'myint' is the primitive you want to pass by  
reference).


For Obj-C objects, 'pass by reference' effectively always happens,  
because you have to pass a pointer to the object (like an  
'NSMutableString *') anyway.


Jamie.

On 10 Dec 2008, at 15:53, Nick Rogers wrote:


Hi, thanks for the reply.
Now I have:

- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
returnedTreeDepth:(int)treeDepth
  returnedKey:(HPlusCatalogKey)catKey
   lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

Still the same error: parse error before  token

Thanks,
Nick

On 10-Dec-08, at 9:15 PM, Dave DeLong wrote:


Put the  before the variable type:

- (UInt32) traverseTreeStraightReturnedDirection: 
(int)treeDirection...


HTH,

Dave

On Dec 10, 2008, at 8:43 AM, Nick Rogers wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
  returnedTreeDepth:(int)treeDepth
returnedKey:(HPlusCatalogKey)catKey
 lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


Thanks,
Nick

___

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

This email sent to [EMAIL PROTECTED]


___

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/jamie%40montgomerie.net

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Return Control To Next Active App Without Hiding?

2008-12-10 Thread Benjamin Dobson

I haven't tested this, but could you use  [NSApp deactivate];?

On 10 Dec 2008, at 09:22:18, Chunk 1978 wrote:


the closest thing i've come to being able to bring front the most
recent app is using this:

[NSApp hide:self];
[NSApp unhideWithoutActivation];

but that flashes my app, and kinda looks like a glitch... is there any
standard method i can use to make this happen instead?

___

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 [EMAIL PROTECTED]


Depressed, Etched Style For Toolbar?

2008-12-10 Thread Chunk 1978
when validating a toolbar item, how do i call this style? (see image attached)
attachment: ToolBarStyle.jpg___

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 [EMAIL PROTECTED]

NSTextField setStringValue not updating properly

2008-12-10 Thread jmunson

Namaste!

I've written a simple interface for ICA as part of my application.

In that interface I have an NSTextField which holds a default path  filename.

Next to that field I have an NSButton for changing that information.   
It opens an NSSavePanel.


I also have a Preview button that grabs the image on the scanner bed.   
This process downloads the file to a temporary directory  filename.


I pass the resulting path and filename via an IBOutlet which is hooked  
to the text field.  These values can originate from the scan preview  
operation, the user typing, or the change button operation.


The text field is not bound to any datasource.

It *appears* to work on the surface, athough sometimes not even then.   
This is confusing the heck out of me.


Anytime the value for the text field needs to change, I call  
[NSTextField setStringValue:(NSString *)aString].


After searching through the message archives, I either find bound  
fields or something else.  The messages that address stuff close this  
stipulate using the above call.


I have also tried validateEditing and display, both to no avail.  I  
can't seem to locate another viable method to get the data stored  
(like a refresh).


What appears to happen (in terms as best I can describe it, not  
necessarily technically correct) is that the text is written to the  
control's view, but, isn't saved to the underlying data structure.


Thus, when I actually need the value later, I don't get what I see  
currently, but what was stored before.  Hopefully that will make  
sense.  In other words, it is as if there are two values:  one for  
display, and one for data.  They don't appear to get synched when I  
use setStringValue.


So, my question is, what do I need to do to get the value actually  
stored and not just displayed?


Thanks in advance!

Peace, Love, and Light,

/s/ Jon C. Munson II



___

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 [EMAIL PROTECTED]


RE: how to pass arguments by reference

2008-12-10 Thread Stefan Sinclair

While I'm not sure if the GCC objective-C compiler accepts C++ references (I've 
never tried), one quick  easy thing to double check is that your source file 
is a .mm file as opposed to a .m file, so that the C++ compiler will be 
used as opposed to the C compiler.
 
-Stefan From: [EMAIL PROTECTED] To: cocoa-dev@lists.apple.com Date: Wed, 10 
Dec 2008 21:13:54 +0530 Subject: how to pass arguments by reference  Hi, I 
have the following in my .m file:   - 
(UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection 
returnedTreeDepth:(int)treeDepth returnedKey:(HPlusCatalogKey)catKey 
lookForKey:(HPlusCatalogKey)lastKey { // code here }  But the error when 
compiling is parse error before  token. Is passing by reference not allowed 
or is there any other syntax that  I should follow?  Thanks, Nick  
___  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/stefan_sinclair%40hotmail.com 
 This email sent to [EMAIL PROTECTED]
_
Suspicious message? There’s an alert for that. 
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad2_122008___

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 [EMAIL PROTECTED]


Re: Wake up Reason

2008-12-10 Thread Derek Chesterfield

From my system.log:

Dec  1 08:20:49 hostname kernel[0]: USB caused wake event (EHCI)

I assume different wake events are also logged.

On 10 Dec 2008, at 11:11, sheen mac wrote:


Is it possible to know the reason the MacBook wake from sleep?

___

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 [EMAIL PROTECTED]


Re: Depressed, Etched Style For Toolbar?

2008-12-10 Thread Mike Abdullah
Look at the various NSToolbar methods with select in their name.  
Search around with those for examples.


On 10 Dec 2008, at 16:21, Chunk 1978 wrote:

when validating a toolbar item, how do i call this style? (see image  
attached)

ToolBarStyle.jpg___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Corbin Dunn


On Dec 10, 2008, at 2:44 AM, Graham Cox wrote:

I need to draw outside of the usual drawRect: method (no really, I  
do!)


The reason is that I have a custom cell that is used in a table/ 
outline view that draws a colour swatch. When clicked it pops up a  
menu of colours so the user can choose another colour. While  
tracking the menu, the cell shows the colour in the menu that the  
mouse is over. When the mouse is released, the cell sends the chosen  
colour to the table's datasource as usual.


The drawing of the colour while tracking the menu needs to take  
place outside the drawRect: mechanism. Why? Because the host view is  
a table, and I need to avoid it reloading the cell from the  
datasource while I'm tracking the menu. If I invalidate the table  
view, it will redraw the entire row. That would be OK if I could  
rely on it to draw only my row, but in some circumstances I have  
found that it doesn't, but redraws the whole table (for example  
after editing a text cell, for some reason any  
setNeedsDisplayInRect: on a small part of the table causes the whole  
table to reload).


There are various reasons why this happens; for one, the focus ring  
may bleed into the rect that was invalidated. But, as you have  
noticed, you should not rely on invalidating just a small portion and  
hoping only that portion should redraw.


I think it is still correct to invalidate your cell's rect, and have  
the table redraw (potentially redrawing everything).



,,,..
Maybe it s a graphics context problem? I have tried always setting  
the current context to the view's window but that stops it from ever  
working (which may be a clue). Anyone spot anything I'm doing or not  
doing here?


Also, if you feel tempted to advise me not to do it this way,  
believe me, I have exhaustively investigated that route, which has  
proven even more problematic, because there's insufficient fine  
control over what the tableview itself does in its own drawRect:  
method. So far this approach is the cleanest by far.


I think you should try another approach. Go back to invalidating the  
rect of the cell that you want to redraw. Essentially, you want one  
cell to maintain specific state while you are doing something else.  
There is one easy approach to do this, which is to maintain a copy of  
the cell while you are showing your special menu, and use that cell to  
draw *just* that one particular row/column.


General steps:
1. Save off the row/column
2. Copy the cell at that row/column when showing your menu
3. Always return that copied cell from the delegate method:
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn: 
(NSTableColumn *)tableColumn row:(NSInteger)row  
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

   else, return [tableColumn dataCell].
4. Don't update the properties for that row/column in -willdisplaycell
5. Update the colors of that copied cell when your menu changes state
6. Drop the copied cell when your menu goes away.

Another approach would be something similar to this great example:

http://developer.apple.com/samplecode/PhotoSearch/

.corbin
___

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 [EMAIL PROTECTED]


Date Formatter year input without year display

2008-12-10 Thread Paul Bruneau

Hi-

I ran into a problem with my production scheduling application as the  
new year approached.


In IB I am using a 10.0 date formatter bound to NSDate properties of a  
model object.


I used: %1m/%1d, %1I:%M%p

which gave me something like: 12/23, 12:30PM

This was used mostly for display, but the user is also able to type  
into the edit field in order to change the value.


As the new year came into play, he might have changed 12/23 to 1/5. My  
thinking was that if he entered just 1/5 it would assume the current  
year, which seems to be correct.


But I thought if he entered 1/5/2009, then Cocoa would help me out and  
do the right thing.


In fact, even when entering the year explicitly, the formatter still  
made the data be 1/5/2008.


I had to add the year to the formatter string to make it accept the  
year as input.


Is this expected? Is there a good way to only display the month and  
day, and yet allow the year to be entered if desired?


Thank 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 [EMAIL PROTECTED]


NSView subviews mutability - follow up to NSDictionary mutability test thread

2008-12-10 Thread jonat...@mugginsoft.com
A follow up of sorts to Cocoabuilder - ([EMAIL PROTECTED])  
NSDictionary mutability test




from Cocoabuilder - (Bill Bumgarner) Re: NSDictionary mutability test

Performance

An NSMutableDictionary instance can be returned from a method declared
as returning (NSDictionary*) without risk that the client is going to
go and change the contents behind your back.  If test for mutability
were common, then all kinds of methods across the 'kits would have  
to -

copy the return value and, potentially, deeply.

also:Cocoabuilder - (Andy Lee) Re: NSDictionary mutability test

Yup.  I just did a quick test using -[NSView subviews].  The return
type is NSArray*, but if you send -addSubview: to the view, the size
of the previously returned array grows by 1.

I would never assume a returned array is immutable just because the
declared return type of a method is NSArray*.



NSView advertising itself as returning an NSArray* but actually  
returning a mutable class does have its sneaky consequences.


[[NSView subviews]  
makeObjectsPerformSelector:@selector(removeFromSuperview)];


this fails with one of dear our old friends: Collection NSCFArray:  
0x128d4e0 was mutated while being enumerated.


we need:

NSArray *subviews = [[NSView subviews] copy];
[subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];

Jonathan Mitchell

Central Conscious Unit
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 [EMAIL PROTECTED]


NSOutlineView problem with Text cells.

2008-12-10 Thread Arun
Hi

I have an App in which i use NSOutlineView in the left hand side for
Navigational controls.
The Root and child's have text cells. I am have changed the font size for
the texts in the text cells.
After this the text in the cells are not aligned. The leave a lot of space
in the bottom and looks as if they were moved up.
This also happens in the NSTableView.
Is there any way in which i can allign the text to the center of the cells
so that the text exactly reside in the center and leaves equal spaces w.r.t
the text cell height.

Thanks
Arun KA
___

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 [EMAIL PROTECTED]


Re: How Can I Notify DrawRect Method?

2008-12-10 Thread Michael Ash
On Wed, Dec 10, 2008 at 7:05 AM, I. Savant [EMAIL PROTECTED] wrote:
 On Dec 9, 2008, at 10:32 PM, Michael Ash wrote:

 This is a common response whenever I talk about not optimizing where
 it's not useful. But the thing is, trying to optimize every little
 thing makes your app *slower*.

 ...

 Of
 course you'll have gone through only a miniscule fraction of the bolts
 in the bridge before the people who hired you to build it get fed up
 and tell you to open it for traffic or get lost. Result: a very heavy
 bridge.

  These are two *completely* separate arguments: Development time versus
 runtime efficiency.

They're not separate at all. Development time is always limited. You
achieve the best runtime efficiency by focusing that development time
where it can do the most good. Disregarding this by trying to optimize
every piece of code in your app makes your app slower because you
won't have time to do a good job on every piece of code in your app,
not even close.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: NSOutlineView problem with Text cells.

2008-12-10 Thread Corbin Dunn


On Dec 10, 2008, at 9:09 AM, Arun wrote:


Hi

I have an App in which i use NSOutlineView in the left hand side for
Navigational controls.
The Root and child's have text cells. I am have changed the font  
size for

the texts in the text cells.
After this the text in the cells are not aligned. The leave a lot of  
space

in the bottom and looks as if they were moved up.
This also happens in the NSTableView.
Is there any way in which i can allign the text to the center of the  
cells
so that the text exactly reside in the center and leaves equal  
spaces w.r.t

the text cell height.


Yes -- subclass the cell, and center the text before drawing it. You  
can override -drawInteriorWithFrame, adjust the frame so the text will  
be centered, and call super.


corbin
___

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 [EMAIL PROTECTED]


Re: How Can I Notify DrawRect Method?

2008-12-10 Thread jmunson
You both have valid points.  However, I think you are missing  
something.  That something being the overall goal of the application  
as predicated by that never-ever-returns:  Time.  That goal can be  
multi-faceted.  For example, one item in the overall list is target  
platform.


By deciding on what platform(s) to target, you can decide where to  
spend your time during to development to achieve the results you want.  
 Sometimes that decision can also lead to split forks in the  
development tree (e.g., platform-specific support).


Since I have found it nearly impossible to develop the perfect app  
before writing any code or going into some sort of demo mode, I  
favor an iterative design loop:  get program parameters, code, test,  
check against parameters, check with client, lather, rinse, repeat.


During that design/construction cycle, one should be able to identify  
what needs optimization, etc.  That will cut down on the debate of  
technical theory - the proof being mostly in the pudding.  Of course,  
the theory can help identify potential hotspots (items to watch) which  
can then be checked during testing cycles.


Neither development time nor optimization are distinctly separate in  
my view - they are interdependent given the goal of the application.   
One may get favored over the other, but, again, that depends upon the  
restrictions placed by the goal of the application.


Quoting Michael Ash [EMAIL PROTECTED]:


On Wed, Dec 10, 2008 at 7:05 AM, I. Savant [EMAIL PROTECTED] wrote:

On Dec 9, 2008, at 10:32 PM, Michael Ash wrote:


This is a common response whenever I talk about not optimizing where
it's not useful. But the thing is, trying to optimize every little
thing makes your app *slower*.


...


Of
course you'll have gone through only a miniscule fraction of the bolts
in the bridge before the people who hired you to build it get fed up
and tell you to open it for traffic or get lost. Result: a very heavy
bridge.


 These are two *completely* separate arguments: Development time versus
runtime efficiency.


They're not separate at all. Development time is always limited. You
achieve the best runtime efficiency by focusing that development time
where it can do the most good. Disregarding this by trying to optimize
every piece of code in your app makes your app slower because you
won't have time to do a good job on every piece of code in your app,
not even close.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]





___

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 [EMAIL PROTECTED]


Detecting the Enter Key

2008-12-10 Thread Eric Gorr

One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)



Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
case NSEnterCharacter:
case NSNewlineCharacter:
case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to  
detect this key in onKeyDown?


Is there a better way?

Thank 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 [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread Ken Thomases

On Dec 10, 2008, at 11:43 AM, Eric Gorr wrote:


One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)


kVK_ANSI_KeypadEnter

but it's only defined in a Carbon header (Events.h in the HIToolbox  
sub-framework).




Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
   case NSEnterCharacter:
   case NSNewlineCharacter:
   case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to  
detect this key in onKeyDown?


Given that you found that in Apple-written sample code, I'd say that's  
what they recommend.  ;)


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread Benjamin Dobson
I would go for the second one. I would guess that the second one would  
pick up all the various Enter keys, whereas the first would only pick  
up a single key. The second also looks much more elegant to me. I do  
not have any experience with this; I am merely saying what looks best  
from my point of view.


On 10 Dec 2008, at 17:43:06, Eric Gorr wrote:


One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)



Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
   case NSEnterCharacter:
   case NSNewlineCharacter:
   case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to  
detect this key in onKeyDown?


Is there a better way?

Thank 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/importedfromspace%40googlemail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Searchable persistent file reference

2008-12-10 Thread Gary L. Wade
An alias stores quite a bit of information in it to allow you to find a file
object (files, folder, disks) if it moves or is renamed or if any of the
elements of its path is renamed, and can usually work with varied file
systems.  I am not familiar with BSAlias or NDAlias, but if they provide a
good wrapper around the CoreServices AliasHandle and associated functions,
they would be a good place for a high-level solution.

On 12/10/2008 6:59 AM, Ben [EMAIL PROTECTED] wrote:

 Hi list,
 
 I am trying to store a reference to a file in a database, such that if
 the file moves, I can still search for it in my database.
 I have read up on the Carbon Alias Manager and the third party BSAlias/
 NDAlias classes but none of these quite seem to fit the bill as it
 looks like I am working backwards from their designed use. ie, rather
 than finding the file from a database record, I want to lookup the
 database record from a known file.
 
 In this situation, would it be best to use -[NSFileManager
 attributesOfItemAtPath:error:] and store the NSFileSystemFileNumber?
 I'm not sure how resilient this approach is. Or is there something
 that I have missed completely?
 
 Regards,
 
 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 [EMAIL PROTECTED]


Re: Multithreading and Mach ports

2008-12-10 Thread John Love

Reference:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/ 
/apple_ref/doc/uid/1057i-CH16-SW7




While I'm trying to piece your replies together, I have a quick  
question .. reference Listing 5-15 and, in particular, the comment:


// Create and configure the worker thread port.

It appears that the passed (NSPort*)outPort is also the worker, or  
background, thread port.  If true, then are we sending from a  
background port to another background port???


Thanks for this in-between request.

 
___


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 [EMAIL PROTECTED]


Distributing apps

2008-12-10 Thread Richard S. French
I have found a lot of Cocoa books and tutorials about writing applications.
I haven¹t found any instructions as to how to put that application into an
icon that can be run when clicked on your desktop or downloaded by others.
Please let me know if I¹ve missed it.
Thanks, Richard.
___

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 [EMAIL PROTECTED]


Re: Distributing apps

2008-12-10 Thread Benjamin Dobson


On 10 Dec 2008, at 18:15:51, Richard S. French wrote:

I have found a lot of Cocoa books and tutorials about writing  
applications.
I haven’t found any instructions as to how to put that application  
into an
icon that can be run when clicked on your desktop or downloaded by  
others.

Please let me know if I’ve missed it.
Thanks, Richard.


Write your application in Xcode, then click Build. This will produce  
an application bundle that can be run when double-clicked. For  
information on distributing your application in a form the Internet  
will work with, see http://developer.apple.com/documentation/developertools/conceptual/SoftwareDistribution/Introduction/chapter_1_section_1.html#/ 
/apple_ref/doc/uid/1145i-CH1-DontLinkElementID_69___


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 [EMAIL PROTECTED]


Re: Distributing apps

2008-12-10 Thread Volker in Lists

Hi,

when you build your app in Xcode with the Release target setting, you  
will get your app with the standard app icon in the build folder. This  
folder usually resides within your project directory. Via the targets  
Get Info panel you can set app icon - which you have to supply  
yourself, to get a custom icon. This app you can send to others.


Cheers,
Volker

Am 10.12.2008 um 19:15 schrieb Richard S. French:

I have found a lot of Cocoa books and tutorials about writing  
applications.
I haven’t found any instructions as to how to put that application  
into an
icon that can be run when clicked on your desktop or downloaded by  
others.

Please let me know if I’ve missed it.
Thanks, Richard.
___

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/volker_lists%40ecoobs.de

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: how to pass arguments by reference

2008-12-10 Thread Clark S. Cox III
C, and by extension Objective-C, do not have references in the C++  
sense. You'll have to pass a pointer to the thing that you want your  
method to be able to modify.


Sent from my iPhone

On Dec 10, 2008, at 7:43, Nick Rogers [EMAIL PROTECTED] wrote:


Hi,
I have the following in my .m file:


- (UInt32)traverseTreeStraightReturnedDirection:(int)treeDirection
 returnedTreeDepth:(int)treeDepth
   returnedKey:(HPlusCatalogKey)catKey
lookForKey:(HPlusCatalogKey)lastKey
{
// code here
}

But the error when compiling is parse error before  token.
Is passing by reference not allowed or is there any other syntax  
that I should follow?


Thanks,
Nick

___

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/clarkcox3%40gmail.com

This email sent to [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread Michael Ash
On Wed, Dec 10, 2008 at 12:43 PM, Eric Gorr [EMAIL PROTECTED] wrote:
 One way to check to see if the enter key has been pressed is to:

 [theEvent keyCode] == 0x04C

 where 0x04C is the keyCode corresponding to the enter key.
 (Is there an Apple defined constant for this key code?)



 Another way, found at:

 http://developer.apple.com/samplecode/TrackBall/listing9.html

 is to do:

 NSString *characters = [theEvent characters];

 switch ([characters characterAtIndex:0])
 {
case NSEnterCharacter:
case NSNewlineCharacter:
case NSCarriageReturnCharacter:
 }



 My question is which method is the preferred or recommended way to detect
 this key in onKeyDown?

 Is there a better way?

It really depends on whether you want to detect the physical key or
the logical key. Input methods may conceivably change the mapping from
one to the other and how you want to check will depend on how you want
your program's behavior to change in that situation. Most of the time
you'll want to use the second technique.

Also note that if you use the second technique, you must check that
[characters length]  0 before you grab character 0. It is entirely
legal for an NSEvent's characters to be empty, and you don't want to
throw an exception because of that.

Mike
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread Eric Gorr


On Dec 10, 2008, at 2:28 PM, Michael Ash wrote:

On Wed, Dec 10, 2008 at 12:43 PM, Eric Gorr [EMAIL PROTECTED]  
wrote:

One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)



Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
  case NSEnterCharacter:
  case NSNewlineCharacter:
  case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to  
detect

this key in onKeyDown?

Is there a better way?


It really depends on whether you want to detect the physical key or
the logical key.


I am not sure if I understand the difference. Can you expand on this?

___

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 [EMAIL PROTECTED]


Table view containing cells with both an image and text

2008-12-10 Thread Eric Gorr
I need a column in my NSTableView with cells that contain both an  
image and some text.


My first inclination is to subclass NSCell and have my subclass manage  
both a NSImageCell and a NSTextFieldCell. Basically, I would imagine  
would override:


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

and have it call drawWithFrame on the internal image cell and text  
cell with the appropriate frames.


Then, assuming I am on the right track, is it also then correct that  
what


- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex


would return is what NSCell's setObjectValue gets called with? Can't  
think of any reason why this wouldn't be the case...


Thank 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 [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread jmunson

I'm certain he means:

Physical key:  actual key on keyboard that was pressed (may be  
independent of the letter/word/symbol on the key face)


Logical key:  this would map to the letter/word/symbol on the key  
face, regardless of physical placement on the board


HTH,

Peace, Love, and Light,

/s/ Jon C. Munson II

Quoting Eric Gorr [EMAIL PROTECTED]:



On Dec 10, 2008, at 2:28 PM, Michael Ash wrote:


On Wed, Dec 10, 2008 at 12:43 PM, Eric Gorr [EMAIL PROTECTED] wrote:

One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)



Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
 case NSEnterCharacter:
 case NSNewlineCharacter:
 case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to detect
this key in onKeyDown?

Is there a better way?


It really depends on whether you want to detect the physical key or
the logical key.


I am not sure if I understand the difference. Can you expand on this?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]




___

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 [EMAIL PROTECTED]


Re: Detecting the Enter Key

2008-12-10 Thread Alex Heinz


On Dec 10, 2008, at 2:39 PM, Eric Gorr wrote:



On Dec 10, 2008, at 2:28 PM, Michael Ash wrote:

On Wed, Dec 10, 2008 at 12:43 PM, Eric Gorr [EMAIL PROTECTED]  
wrote:

One way to check to see if the enter key has been pressed is to:

[theEvent keyCode] == 0x04C

where 0x04C is the keyCode corresponding to the enter key.
(Is there an Apple defined constant for this key code?)



Another way, found at:

http://developer.apple.com/samplecode/TrackBall/listing9.html

is to do:

NSString *characters = [theEvent characters];

switch ([characters characterAtIndex:0])
{
 case NSEnterCharacter:
 case NSNewlineCharacter:
 case NSCarriageReturnCharacter:
}



My question is which method is the preferred or recommended way to  
detect

this key in onKeyDown?

Is there a better way?


It really depends on whether you want to detect the physical key or
the logical key.


I am not sure if I understand the difference. Can you expand on this?


The physical key means (roughly) the switch on the keyboard that  
sends an electrical signal with the code 0x04C, which might not  
necessarily correspond to a key marked enter on all keyboards. The  
logical key is the action performed by that signal, in this case, a  
line break.

___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Corbin Dunn


On Dec 10, 2008, at 11:54 AM, Eric Gorr wrote:

I need a column in my NSTableView with cells that contain both an  
image and some text.


My first inclination is to subclass NSCell and have my subclass  
manage both a NSImageCell and a NSTextFieldCell. Basically, I would  
imagine would override:


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

and have it call drawWithFrame on the internal image cell and text  
cell with the appropriate frames.


Then, assuming I am on the right track, is it also then correct that  
what


- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex


would return is what NSCell's setObjectValue gets called with? Can't  
think of any reason why this wouldn't be the case...




Yeah, you are right, that is the case.

However, I'd recommend subclassing NSTextFieldCell and having it draw  
an image. It'll make other stuff work for you automatically (cell  
expansion tooltips, type selection). See: 	http://developer.apple.com/samplecode/PhotoSearch/ 



corbin



___

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 [EMAIL PROTECTED]


Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread aaron smith
Hey All, this could be a newbie question, or a somewhat mid-level
question. Basically, I don't understand how I can create views that
aren't associated with an NSWindow, or NSPanel.

Here's a breakdown of what I'm trying to accomplish..
-I have a MainMenu nib.
-in that it has the usual 1 window.
-On the Window, I have a NSToolbar.
-The NSToolbar has 2 buttons (view1,view2) View 1 will be the default.

Now what I want to do is show/hide view1/view2 depending on which
button you click. What I'm confused about is achieving tab like
behavior, without using a tab view.

How do I go about create views separately, and attaching them to the
NSWindow, based on the toolbar buttons. I'm looking for is some
direction.

Here's kind of what I was thinking..

option 1. Create multiple NSWindows or NSPanels, for view1,view2. Use
the contentView property of those windows to attach to my main window
when you've clicked a toolbar button.
option 2. Use separate nibs for the views, each nib would be an
NSPanel. Then the main bundle loads those nibs in, attaches it's
contentView to the main bundle's main view.

Is this the right direction? I'd really appreciate some feedback.

Thanks all
___

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 [EMAIL PROTECTED]


Re: Date Formatter year input without year display

2008-12-10 Thread Ashley Clark

On Dec 10, 2008, at 10:48 AM, Paul Bruneau wrote:


Hi-

I ran into a problem with my production scheduling application as  
the new year approached.


In IB I am using a 10.0 date formatter bound to NSDate properties of  
a model object.


I used: %1m/%1d, %1I:%M%p

which gave me something like: 12/23, 12:30PM

This was used mostly for display, but the user is also able to type  
into the edit field in order to change the value.


As the new year came into play, he might have changed 12/23 to 1/5.  
My thinking was that if he entered just 1/5 it would assume the  
current year, which seems to be correct.


But I thought if he entered 1/5/2009, then Cocoa would help me out  
and do the right thing.


In fact, even when entering the year explicitly, the formatter still  
made the data be 1/5/2008.


I had to add the year to the formatter string to make it accept the  
year as input.


Is this expected? Is there a good way to only display the month and  
day, and yet allow the year to be entered if desired?



I've yet to find a better way but I accomplished something similar,  
parsing multiple date formats with one formatter, by making a sort of  
meta-formatter.


Basically define a subclass of NSDateFormatter that references a  
display formatter and an array of input formatters. I used static  
instances of the formatters but you could also just change the  
formatter settings as well.


Then override all of the NSFormatter methods passing them on to either  
the display formatter or iterating through your input formatters (most  
specific to least specific) until one can successfully parse the input  
string.



Ashley

___

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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread Nick Zitzmann


On Dec 10, 2008, at 1:50 PM, aaron smith wrote:


How do I go about create views separately, and attaching them to the
NSWindow, based on the toolbar buttons.



Create them programmatically using -initWithFrame:, do any setup work  
you have to do, then add them as either the content view of a window,  
or a subview of the content view.


Either that, or archive them in a nib, load the nib, and then attach  
them to the window or window's content view. Do whichever is easiest  
for you.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread Ken Thomases

On Dec 10, 2008, at 2:50 PM, aaron smith wrote:


Hey All, this could be a newbie question, or a somewhat mid-level
question. Basically, I don't understand how I can create views that
aren't associated with an NSWindow, or NSPanel.

Here's a breakdown of what I'm trying to accomplish..
-I have a MainMenu nib.
-in that it has the usual 1 window.
-On the Window, I have a NSToolbar.
-The NSToolbar has 2 buttons (view1,view2) View 1 will be the default.

Now what I want to do is show/hide view1/view2 depending on which
button you click. What I'm confused about is achieving tab like
behavior, without using a tab view.


Why not use a tab view?  You can configure its appearance to hide the  
actual tabs, in which case it becomes a convenient control for  
managing and switching amongst several views.




How do I go about create views separately, and attaching them to the
NSWindow, based on the toolbar buttons. I'm looking for is some
direction.

Here's kind of what I was thinking..

option 1. Create multiple NSWindows or NSPanels, for view1,view2. Use
the contentView property of those windows to attach to my main window
when you've clicked a toolbar button.
option 2. Use separate nibs for the views, each nib would be an
NSPanel. Then the main bundle loads those nibs in, attaches it's
contentView to the main bundle's main view.

Is this the right direction? I'd really appreciate some feedback.


Views don't need to be contained in a window in the nib.  You can drag  
a view from the library directly into the nib.  You can then set up  
outlets from, for example, File's Owner to these views to reference  
them later in the code.


Depending on the design, all the views may be in the same nib as the  
window or, if they are likely to be reused in other contexts, each  
view can be put into its own nib which you'd use NSViewController to  
load and own.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Eric Gorr


On Dec 10, 2008, at 3:41 PM, Corbin Dunn wrote:



On Dec 10, 2008, at 11:54 AM, Eric Gorr wrote:

I need a column in my NSTableView with cells that contain both an  
image and some text.


My first inclination is to subclass NSCell and have my subclass  
manage both a NSImageCell and a NSTextFieldCell. Basically, I would  
imagine would override:


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

and have it call drawWithFrame on the internal image cell and text  
cell with the appropriate frames.


Then, assuming I am on the right track, is it also then correct  
that what


- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex


would return is what NSCell's setObjectValue gets called with?  
Can't think of any reason why this wouldn't be the case...




Yeah, you are right, that is the case.

However, I'd recommend subclassing NSTextFieldCell and having it  
draw an image. It'll make other stuff work for you automatically  
(cell expansion tooltips, type selection). See: 	http://developer.apple.com/samplecode/PhotoSearch/ 



Interesting.

So, it looks like what is going on here is:

  willDisplayCell

is essentially be used to assign the additional information (such as  
the image) the cell needs while objectValueForTableColumn returns the  
primary text to be displayed.


Perhaps not quite a clean as I might have liked - would have preferred  
to be able to simply return all of information needed by the cell in  
objectValueForTableColumn rather then splitting it between  
objectValueForTableColumn and willDisplayCell.


But, as you pointed out, the benefits gained by not writing all of the  
extra code to support type selection, etc. makes it quite worthwhile.



___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Randall Meadows

On Dec 10, 2008, at 1:41 PM, Corbin Dunn wrote:


On Dec 10, 2008, at 11:54 AM, Eric Gorr wrote:

I need a column in my NSTableView with cells that contain both an  
image and some text.


My first inclination is to subclass NSCell and have my subclass  
manage both a NSImageCell and a NSTextFieldCell. Basically, I would  
imagine would override:


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

and have it call drawWithFrame on the internal image cell and text  
cell with the appropriate frames.


Then, assuming I am on the right track, is it also then correct  
that what


- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex


would return is what NSCell's setObjectValue gets called with?  
Can't think of any reason why this wouldn't be the case...


Yeah, you are right, that is the case.

However, I'd recommend subclassing NSTextFieldCell and having it  
draw an image. It'll make other stuff work for you automatically  
(cell expansion tooltips, type selection). See: 	http://developer.apple.com/samplecode/PhotoSearch/ 



I'm working through this exact thing right now.  Couple things I  
noticed:


- that example uses an NSOutlineView instead of an NSTableView, but  
close enough, withsome translation...


- the cellFrame passed into -drawInteriorWithFrame:inView: is not  
really the interior of the frame; I've had to do


cellFrame.origin.x -= 1, cellFrame.origin.y -= 1, cellFrame.size.width  
+= 3, cellFrame.size.height += 1;


to actually completely fill the cell, otherwise I get a white border  
around the edges (since I'm filling the cell with a custom dark  
color).  I gather I must be doing something wrong, or not doing  
something I should be, but doing the above completely fills the cell  
whereas the default value doesn't.


One additional question I have (sorry, Eric, don't mean to hijack your  
thread): in my -drawInterior... method, I draw an attributed string  
with an NSFont attribute of LucidaGrande-Bold 13.00 pt. P []  
(0x16b8c4e0) fobj=0x16b8c450, spc=4.28, however, it sure looks like  
it's drawing in non-bold, instead.  I compared it with a LucidaGrande- 
Bold 13 point sample in TextEdit, and it's vastly different.  I could  
see something changing behind my back when I simply pass an attributed  
string back as the object value, but how is that being done when I'm  
drawing it explicitly?


attrs = [NSDictionary dictionaryWithObjectsAndKeys:
   NSFontAttributeName, [NSFont boldSystemFontOfSize:13.0],
   NSBackgroundColorAttributeName, [NSColor blackColor],
   nil];
nameRect = NSInsetRect(cellFrame, 2, 0);
attrStr = [[NSAttributedString alloc] initWithString:name  
attributes:attrs];

[attrStr drawInRect:nameRect];

Screenshot of this (blue) versus TextEdit: http://www.not-pc.com/LucidaGrande-13.png 


___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Corbin Dunn


Yeah, you are right, that is the case.

However, I'd recommend subclassing NSTextFieldCell and having it  
draw an image. It'll make other stuff work for you automatically  
(cell expansion tooltips, type selection). See: 	http://developer.apple.com/samplecode/PhotoSearch/ 



Interesting.

So, it looks like what is going on here is:

 willDisplayCell

is essentially be used to assign the additional information (such as  
the image) the cell needs while objectValueForTableColumn returns  
the primary text to be displayed.


Perhaps not quite a clean as I might have liked - would have  
preferred to be able to simply return all of information needed by  
the cell in objectValueForTableColumn rather then splitting it  
between objectValueForTableColumn and willDisplayCell.


But, as you pointed out, the benefits gained by not writing all of  
the extra code to support type selection, etc. makes it quite  
worthwhile.





You could make the -objectValue something like an NSDictionary; the  
drawback of this, is that it won't work as well with editing the  
contents of the cell, so I don't recommend that approach. The above  
approach is very common.


corbin

___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Corbin Dunn


On Dec 10, 2008, at 1:14 PM, Randall Meadows wrote:


On Dec 10, 2008, at 1:41 PM, Corbin Dunn wrote:


On Dec 10, 2008, at 11:54 AM, Eric Gorr wrote:

I need a column in my NSTableView with cells that contain both an  
image and some text.


My first inclination is to subclass NSCell and have my subclass  
manage both a NSImageCell and a NSTextFieldCell. Basically, I  
would imagine would override:


- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView

and have it call drawWithFrame on the internal image cell and text  
cell with the appropriate frames.


Then, assuming I am on the right track, is it also then correct  
that what


- (id)tableView:(NSTableView *)aTableView  
objectValueForTableColumn:(NSTableColumn*)aTableColumn row: 
(NSInteger)rowIndex


would return is what NSCell's setObjectValue gets called with?  
Can't think of any reason why this wouldn't be the case...


Yeah, you are right, that is the case.

However, I'd recommend subclassing NSTextFieldCell and having it  
draw an image. It'll make other stuff work for you automatically  
(cell expansion tooltips, type selection). See: 	http://developer.apple.com/samplecode/PhotoSearch/ 



I'm working through this exact thing right now.  Couple things I  
noticed:


- that example uses an NSOutlineView instead of an NSTableView, but  
close enough, withsome translation...


- the cellFrame passed into -drawInteriorWithFrame:inView: is not  
really the interior of the frame; I've had to do


No; it really is!




cellFrame.origin.x -= 1, cellFrame.origin.y -= 1,  
cellFrame.size.width += 3, cellFrame.size.height += 1;


Yeah, you don't want to do this; you will have re-draw issues when the  
cell is invalidated. It sounds like you want to set the - 
intercellSpacing to 0,0, or override the -drawRow/drawRect method and  
first fill in the area with a solid background color.


Essentially, what you are doing is undoing the intercell spacing.




to actually completely fill the cell, otherwise I get a white border  
around the edges (since I'm filling the cell with a custom dark  
color).  I gather I must be doing something wrong, or not doing  
something I should be, but doing the above completely fills the cell  
whereas the default value doesn't.


One additional question I have (sorry, Eric, don't mean to hijack  
your thread): in my -drawInterior... method, I draw an attributed  
string with an NSFont attribute of LucidaGrande-Bold 13.00 pt. P []  
(0x16b8c4e0) fobj=0x16b8c450, spc=4.28, however, it sure looks like  
it's drawing in non-bold, instead.  I compared it with a  
LucidaGrande-Bold 13 point sample in TextEdit, and it's vastly  
different.  I could see something changing behind my back when I  
simply pass an attributed string back as the object value, but how  
is that being done when I'm drawing it explicitly?


I don't know what is wrong off the top of my head, sorry!
corbin




attrs = [NSDictionary dictionaryWithObjectsAndKeys:
  NSFontAttributeName, [NSFont boldSystemFontOfSize:13.0],
  NSBackgroundColorAttributeName, [NSColor blackColor],
  nil];
nameRect = NSInsetRect(cellFrame, 2, 0);
attrStr = [[NSAttributedString alloc] initWithString:name  
attributes:attrs];

[attrStr drawInRect:nameRect];

Screenshot of this (blue) versus TextEdit: http://www.not-pc.com/LucidaGrande-13.png 



___

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 [EMAIL PROTECTED]


Setting A Background Image On A Window

2008-12-10 Thread Neil
I've googled around and poked at the documentation in Xcode, but I  
can't seem to find any references to this.  I'm trying to do something  
like setBackgroundColor, but instead of picking a color, I want to  
pick an image.


The end goal is to program an emulator for a small medical device like  
an insulin pump; so the background of the window would be an image of  
the device, and then I'd put some buttons and fields and such on top.

___

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 [EMAIL PROTECTED]


Starting Cocoa apps from the command line

2008-12-10 Thread Shayne Wissler
Hello,

I have a Cocoa application that I am compiling in the traditional UNIX
manner using Makefiles and I want to be able to invoke it with
command-line arguments and without creating/installing it like
traditional OSX apps, as in x.app/Contents/MacOS/x. When I tried the
usual thing that works on UNIX, compiling to binary and just running
it, my application got mouse events but no keyboard events, among
other strange things.

Is there a way to do this without making some kind of wrapper caller
that generates the directory and a script or some such? Or is it
wholly frowned upon to do what I'm wanting, and if so, why does it
half-work rather than fail with a decent error message?


Shayne Wissler
___

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 [EMAIL PROTECTED]


Re: CoreData -- addPersistentStoreWithType crashing

2008-12-10 Thread Melissa J. Turner

Hi Ben -

What's the backtrace you get when you crash your application in the  
debugger?


+Melissa

On Dec 10, 2008, at 02:58, Ben Lachman wrote:


Hi all:

I've been making some changes to one of my apps which include a  
change to the data model.  Now whenever I start up the app it  
crashes (EXEC_BAD_ACCESS) in  
addPersistentStoreWithType:configuration:URL:options:error:.  I've  
factored out all the passed arguments and it's still crashing.  I  
figure it must have to do with the change in the model, but I can't  
see why that would make it crash and not report an error or trow an  
exception, particularly if the URL points to a nonexistent file ) 
e.g. it will create a new store file). Any thoughts?


Thanks,
-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: [EMAIL PROTECTED]
twitter: @benlachman
mobile: 740.590.0009

___

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/mjturner%40apple.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Setting A Background Image On A Window

2008-12-10 Thread Brandon Walkin
Try making an NSColor from your image using +colorWithPatternImage:,  
and set that color object on the window using -setBackgroundColor:.


On 10-Dec-08, at 4:47 PM, Neil wrote:

I've googled around and poked at the documentation in Xcode, but I  
can't seem to find any references to this.  I'm trying to do  
something like setBackgroundColor, but instead of picking a color, I  
want to pick an image.


The end goal is to program an emulator for a small medical device  
like an insulin pump; so the background of the window would be an  
image of the device, and then I'd put some buttons and fields and  
such on top.

___

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/bwalkin%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Starting Cocoa apps from the command line

2008-12-10 Thread Mani Ghasemlou
Unless I misunderstood your situation, I believe using the open
command should work.

Example:


open x.app


Cheers,
Mani

On Wed, Dec 10, 2008 at 4:47 PM, Shayne Wissler [EMAIL PROTECTED] wrote:
 Hello,

 I have a Cocoa application that I am compiling in the traditional UNIX
 manner using Makefiles and I want to be able to invoke it with
 command-line arguments and without creating/installing it like
 traditional OSX apps, as in x.app/Contents/MacOS/x. When I tried the
 usual thing that works on UNIX, compiling to binary and just running
 it, my application got mouse events but no keyboard events, among
 other strange things.

 Is there a way to do this without making some kind of wrapper caller
 that generates the directory and a script or some such? Or is it
 wholly frowned upon to do what I'm wanting, and if so, why does it
 half-work rather than fail with a decent error message?


 Shayne Wissler
 ___

 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/mani%40tungle.com

 This email sent to [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: Starting Cocoa apps from the command line

2008-12-10 Thread Steven W Riggins
If you are building a cocoa application, make it a normal cocoa  
application and use the open command to launch it.


On Dec 10, 2008, at 1:47 PM, Shayne Wissler wrote:

Is there a way to do this without making some kind of wrapper caller
that generates the directory and a script or some such? Or is it
wholly frowned upon to do what I'm wanting, and if so, why does it
half-work rather than fail with a decent error message?


___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Randall Meadows

On Dec 10, 2008, at 2:41 PM, Corbin Dunn wrote:


On Dec 10, 2008, at 1:14 PM, Randall Meadows wrote:
- the cellFrame passed into -drawInteriorWithFrame:inView: is not  
really the interior of the frame; I've had to do


No; it really is!


You're this  close to convincing me! :)

cellFrame.origin.x -= 1, cellFrame.origin.y -= 1,  
cellFrame.size.width += 3, cellFrame.size.height += 1;


Yeah, you don't want to do this; you will have re-draw issues when  
the cell is invalidated. It sounds like you want to set the - 
intercellSpacing to 0,0, or override the -drawRow/drawRect method  
and first fill in the area with a solid background color.


Essentially, what you are doing is undoing the intercell spacing.


OK, I set intercellSpacing to (0,0), take out my hack, and:

(gdb) p (NSSize)[controlView intercellSpacing]
$1 = {
  width = 0, height = 0
}
(gdb) p (NSRect)[controlView bounds]
$2 = {
  origin = {
x = 0, y = 0
  },
  size = {
width = 425, height = 460
  }
}
(gdb) p (NSRect)aCellFrame
$3 = {
  origin = {
x = 0, y = 0
  },
  size = {
width = 422, height = 18
  }
}

Notice the cellFrame is still 3 pixels narrower than the table view  
itself.

___

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 [EMAIL PROTECTED]


Re: Starting Cocoa apps from the command line

2008-12-10 Thread Sean McBride

On 2008-Dec-10, at 16:47, Shayne Wissler wrote:


Is there a way to do this without making some kind of wrapper caller
that generates the directory and a script or some such? Or is it
wholly frowned upon to do what I'm wanting, and if so, why does it
half-work rather than fail with a decent error message?


It is wholly frowned upon.  You might consider using CMake instead of  
autotools, it can generate the needed .app structure.


Sean

___

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 [EMAIL PROTECTED]


Core Data triggering an objc_assign_strongCast crash?!

2008-12-10 Thread Nick Zitzmann
I've suddenly been experiencing a problem where calling - 
[NSManagedObject validateForDelete:] causes the method to call  
objc_assign_strongCast, which then mysteriously crashes. The  
application does not use GC, but the object is properly retained, so  
it's not that. Has anyone ever seen this before, and if so, what did  
you do to fix it?


Things I've already tried:

1. Running with Guard Malloc turned on (Guard Malloc finds no problems)
2. Running the X86-64 version of the app in addition to the usual X86  
version

3. Running with zombies on (the object is not a zombie)

I haven't yet tried running it under PPC or PPC64.

Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread aaron smith
Hey Ken and Nick, thanks for the feedback. I have continuing questions
if you wouldn't mind.

archive them in a nib, load the nib, and then attach them to the
window or window's content view.
-So I would use a separate nib that contains NSPanels, with the views
layed out in that, load the nib, then attach it's content to the main
windows content?

Why not use a tab view?
-I did think of this, but wasn't sure if this would be bad practice. I
wouldn't see why it would be bad, but wasn't sure. In any case I think
trying to do it without tabs is a good exercise.

Views don't need to be contained in a window in the nib. You can drag
a view from the library directly into the nib. You can then set up
outlets from, for example, File's Owner to these views to reference
them later in the code.
-So, by doing this, you don't get to visually see the view in
interface builder? But through code you would piece it all together?
Is there a way to visually see in interface builder the view, without
it being in a window/panel?

Thanks a lot for the feedback.





On Wed, Dec 10, 2008 at 1:13 PM, Brandon Walkin [EMAIL PROTECTED] wrote:
 Hi,
 I've released a free plugin for Interface Builder 3 that contains an easy to
 use tabbed toolbar that should suit your needs. You can grab it
 here: http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/
 Cheers,
 Brandon
 On 10-Dec-08, at 3:50 PM, aaron smith wrote:

 Hey All, this could be a newbie question, or a somewhat mid-level
 question. Basically, I don't understand how I can create views that
 aren't associated with an NSWindow, or NSPanel.

 Here's a breakdown of what I'm trying to accomplish..
 -I have a MainMenu nib.
 -in that it has the usual 1 window.
 -On the Window, I have a NSToolbar.
 -The NSToolbar has 2 buttons (view1,view2) View 1 will be the default.

 Now what I want to do is show/hide view1/view2 depending on which
 button you click. What I'm confused about is achieving tab like
 behavior, without using a tab view.

 How do I go about create views separately, and attaching them to the
 NSWindow, based on the toolbar buttons. I'm looking for is some
 direction.

 Here's kind of what I was thinking..

 option 1. Create multiple NSWindows or NSPanels, for view1,view2. Use
 the contentView property of those windows to attach to my main window
 when you've clicked a toolbar button.
 option 2. Use separate nibs for the views, each nib would be an
 NSPanel. Then the main bundle loads those nibs in, attaches it's
 contentView to the main bundle's main view.

 Is this the right direction? I'd really appreciate some feedback.

 Thanks all
 ___

 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/bwalkin%40gmail.com

 This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Table view containing cells with both an image and text

2008-12-10 Thread Corbin Dunn


On Dec 10, 2008, at 2:15 PM, Randall Meadows wrote:


On Dec 10, 2008, at 2:41 PM, Corbin Dunn wrote:


On Dec 10, 2008, at 1:14 PM, Randall Meadows wrote:
- the cellFrame passed into -drawInteriorWithFrame:inView: is not  
really the interior of the frame; I've had to do


No; it really is!


You're this  close to convincing me! :)


It really is; I promise :)




cellFrame.origin.x -= 1, cellFrame.origin.y -= 1,  
cellFrame.size.width += 3, cellFrame.size.height += 1;


Yeah, you don't want to do this; you will have re-draw issues when  
the cell is invalidated. It sounds like you want to set the - 
intercellSpacing to 0,0, or override the -drawRow/drawRect method  
and first fill in the area with a solid background color.


Essentially, what you are doing is undoing the intercell spacing.


OK, I set intercellSpacing to (0,0), take out my hack, and:

(gdb) p (NSSize)[controlView intercellSpacing]
$1 = {
 width = 0, height = 0
}
(gdb) p (NSRect)[controlView bounds]
$2 = {
 origin = {
   x = 0, y = 0
 },
 size = {
   width = 425, height = 460
 }
}
(gdb) p (NSRect)aCellFrame
$3 = {
 origin = {
   x = 0, y = 0
 },
 size = {
   width = 422, height = 18
 }
}

Notice the cellFrame is still 3 pixels narrower than the table view  
itself.


The cell's width is set to the width of the column it resides in. The - 
width of the tablecolumn for that given cell is probably not large  
enough.


Really, -frameOfCellAtColumn:row: will be equal to what is passed to - 
drawRect:.. of the cell. You can subclass and change the rect returned  
from the first thing to tweak the sizes (but don't change the row  
height -- use the variable row height delegate method for that).


corbin


___

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 [EMAIL PROTECTED]


Re: Starting Cocoa apps from the command line

2008-12-10 Thread Andrew Farmer

On 10 Dec 08, at 13:47, Shayne Wissler wrote:

I have a Cocoa application that I am compiling in the traditional UNIX
manner using Makefiles and I want to be able to invoke it with
command-line arguments and without creating/installing it like
traditional OSX apps, as in x.app/Contents/MacOS/x. When I tried the
usual thing that works on UNIX, compiling to binary and just running
it, my application got mouse events but no keyboard events, among
other strange things.

Is there a way to do this without making some kind of wrapper caller
that generates the directory and a script or some such? Or is it
wholly frowned upon to do what I'm wanting, and if so, why does it
half-work rather than fail with a decent error message?


I'm not sure, but I can tell you that mplayer does what you're talking  
about and works fine. You may want to take a look at how they do it.

___

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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread Nick Zitzmann


On Dec 10, 2008, at 3:30 PM, aaron smith wrote:


-So I would use a separate nib that contains NSPanels, with the views
layed out in that, load the nib, then attach it's content to the main
windows content?


You don't even need panels; custom views can be placed at the top of a  
nib.



-I did think of this, but wasn't sure if this would be bad practice. I
wouldn't see why it would be bad, but wasn't sure. In any case I think
trying to do it without tabs is a good exercise.



Actually, using NSTabView is a good idea if you just want to replace  
one view with another. You can configure it so that the tabs don't  
actually show, and can only be changed programmatically. I've done  
this before with good results.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread aaron smith
Sweet. Thanks Nick!

On Wed, Dec 10, 2008 at 2:38 PM, Nick Zitzmann [EMAIL PROTECTED] wrote:

 On Dec 10, 2008, at 3:30 PM, aaron smith wrote:

 -So I would use a separate nib that contains NSPanels, with the views
 layed out in that, load the nib, then attach it's content to the main
 windows content?

 You don't even need panels; custom views can be placed at the top of a nib.

 -I did think of this, but wasn't sure if this would be bad practice. I
 wouldn't see why it would be bad, but wasn't sure. In any case I think
 trying to do it without tabs is a good exercise.


 Actually, using NSTabView is a good idea if you just want to replace one
 view with another. You can configure it so that the tabs don't actually
 show, and can only be changed programmatically. I've done this before with
 good results.

 Nick Zitzmann
 http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread Brandon Walkin
The NSPanels are unnecessary middle men in your case. Rather than  
using an NSPanel in order to access its contentView, instead create a  
new standalone view object in IB by dragging in a custom view from the  
library to the document window (not the canvas). Then double click the  
view's icon in the document window, and the view will open up in a  
window. You can then go ahead and lay out its contents, just as you  
would with a NSPanel's contentView.


On 10-Dec-08, at 5:30 PM, aaron smith wrote:


Hey Ken and Nick, thanks for the feedback. I have continuing questions
if you wouldn't mind.

archive them in a nib, load the nib, and then attach them to the
window or window's content view.
-So I would use a separate nib that contains NSPanels, with the views
layed out in that, load the nib, then attach it's content to the main
windows content?

Why not use a tab view?
-I did think of this, but wasn't sure if this would be bad practice. I
wouldn't see why it would be bad, but wasn't sure. In any case I think
trying to do it without tabs is a good exercise.

Views don't need to be contained in a window in the nib. You can drag
a view from the library directly into the nib. You can then set up
outlets from, for example, File's Owner to these views to reference
them later in the code.
-So, by doing this, you don't get to visually see the view in
interface builder? But through code you would piece it all together?
Is there a way to visually see in interface builder the view, without
it being in a window/panel?

Thanks a lot for the feedback.





On Wed, Dec 10, 2008 at 1:13 PM, Brandon Walkin [EMAIL PROTECTED]  
wrote:

Hi,
I've released a free plugin for Interface Builder 3 that contains  
an easy to

use tabbed toolbar that should suit your needs. You can grab it
here: http://www.brandonwalkin.com/blog/2008/11/13/introducing-bwtoolkit/
Cheers,
Brandon
On 10-Dec-08, at 3:50 PM, aaron smith wrote:

Hey All, this could be a newbie question, or a somewhat mid-level
question. Basically, I don't understand how I can create views that
aren't associated with an NSWindow, or NSPanel.

Here's a breakdown of what I'm trying to accomplish..
-I have a MainMenu nib.
-in that it has the usual 1 window.
-On the Window, I have a NSToolbar.
-The NSToolbar has 2 buttons (view1,view2) View 1 will be the  
default.


Now what I want to do is show/hide view1/view2 depending on which
button you click. What I'm confused about is achieving tab like
behavior, without using a tab view.

How do I go about create views separately, and attaching them to the
NSWindow, based on the toolbar buttons. I'm looking for is some
direction.

Here's kind of what I was thinking..

option 1. Create multiple NSWindows or NSPanels, for view1,view2. Use
the contentView property of those windows to attach to my main window
when you've clicked a toolbar button.
option 2. Use separate nibs for the views, each nib would be an
NSPanel. Then the main bundle loads those nibs in, attaches it's
contentView to the main bundle's main view.

Is this the right direction? I'd really appreciate some feedback.

Thanks all
___

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/bwalkin%40gmail.com

This email sent to [EMAIL PROTECTED]



___

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/bwalkin%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?

2008-12-10 Thread Ken Thomases

On Dec 10, 2008, at 4:30 PM, aaron smith wrote:


Views don't need to be contained in a window in the nib. You can drag
a view from the library directly into the nib. You can then set up
outlets from, for example, File's Owner to these views to reference
them later in the code.
-So, by doing this, you don't get to visually see the view in
interface builder? But through code you would piece it all together?
Is there a way to visually see in interface builder the view, without
it being in a window/panel?


Working with a stand-alone view in a nib _does_ let you visually  
design it.  Interface Builder does show it in a window frame when  
you're editing it, but it isn't really in a window.


You can drag a custom view out of the library, or you can copy the  
content view of a window and then paste it at the top level.  You can  
also drag a window's content view into the library so that the library  
will have a ready-made plain (non-custom) NSView for your future use.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Re: How to launch window of the application on clicking of dock icon?

2008-12-10 Thread Ömer Kardaş
You can also use -windowShouldClose event and simply hide your  
application instead of closing the window. Clicking on the dockicon  
will simply show it.


- (BOOL)windowShouldClose:(id)window {
[[NSApplication sharedApplication] hide:self];
return NO;
}

On Dec 10, 2008, at 7:49 AM, Arun wrote:


Thanks for the reply.

My app is not a document based.
I tried using the applicationDidBecomeActive to bring up my main  
window. It
works only when my application is not active. i.e., when the   
MenuBar is
occupied by other application. If i launch my app and close the  
window, the
menu bar is still occupied with My App's menu bar. If noe i click on  
the

dock icon, the window will not come up. I need the window to come up.

-Arun KA



On Wed, Dec 10, 2008 at 12:21 AM, Raleigh Ledet [EMAIL PROTECTED]  
wrote:



This depends on your application.

A document based application will automatically create a new untitled
document for you. Which is generally what you want. If you app is  
really

document based, its best to use the document based project template.

If you app is not document based (say Mail or System preferences)  
then you
have to consider what the expected / correct behavior is. Mail  
stays active
when you close all of it's windows (checking email in the  
background). For
this behavior use -applicationDidBecomeActive: to check if any  
widows are

shown. If not, then show the expected window.

For some (rare) apps on OS X, staying open is not expected /  
wanted. For
example, System Preferences quits when you close its one and only  
window.
This can be done via - 
applicationShouldTerminateAfterLastWindowClosed.


If this is just a test app, you might want to try them all to get a  
feel
for it. But for a real app, consider very carefully which behavior  
you want.


-raleigh


On 09 Dec,2008, at 9:02 AM, Arun wrote:

Hi,


I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in  
the

Dock.
If i close the window, the dock icon still stays. But if i click  
on the

dock
icon then also the main window is visible.
The only way i can see the main window is by quitting the app and
launching
it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.

Thanks
Arun KA
___

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/ledet%40apple.com

This email sent to [EMAIL PROTECTED]





___

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/omerkardas%40me.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Problem drawing outside of drawRect: in a custom table cell

2008-12-10 Thread Graham Cox


On 11 Dec 2008, at 3:46 am, Corbin Dunn wrote:

There are various reasons why this happens; for one, the focus ring  
may bleed into the rect that was invalidated. But, as you have  
noticed, you should not rely on invalidating just a small portion  
and hoping only that portion should redraw.


I think it is still correct to invalidate your cell's rect, and have  
the table redraw (potentially redrawing everything).



OK, at least that confirms my observations - I'm not going mad after  
all! (Or I might be, but not because of this...)


I think you should try another approach. Go back to invalidating the  
rect of the cell that you want to redraw. Essentially, you want one  
cell to maintain specific state while you are doing something else.


Exactly.

There is one easy approach to do this, which is to maintain a copy  
of the cell while you are showing your special menu, and use that  
cell to draw *just* that one particular row/column.


D'oh! Of course. A copy... obvious, now you point it out.


General steps:
1. Save off the row/column
2. Copy the cell at that row/column when showing your menu
3. Always return that copied cell from the delegate method:
- (NSCell *)tableView:(NSTableView *)tableView  
dataCellForTableColumn:(NSTableColumn *)tableColumn row: 
(NSInteger)row AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

  else, return [tableColumn dataCell].
4. Don't update the properties for that row/column in -willdisplaycell
5. Update the colors of that copied cell when your menu changes state
6. Drop the copied cell when your menu goes away.

Another approach would be something similar to this great example:

http://developer.apple.com/samplecode/PhotoSearch/

.corbin



Great, I'll give this a shot. Actually I woke up this morning thinking  
that I'd need to do something along these lines (isolate the cell  
being tracked), so sleeping on it really works - I definitely should  
avoid these 16 hour straight coding sessions... I'll also check out  
the suggested sample.


Thanks!

--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 [EMAIL PROTECTED]


large texts in NSTextView on 10.4

2008-12-10 Thread Giuseppe Cantavenera

I have to deal with very large texts in a textView , on OS X 10.4.

Does anybody now how to implement a subclass of NSLayoutManager that  
acts like nonContigousLayout on 10.5,  so to achieve acceptable  
performance also  on 10.4 ?


Which methods should I override?

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 [EMAIL PROTECTED]


Re: Starting Cocoa apps from the command line

2008-12-10 Thread Jason Stephenson

Andrew Farmer wrote:


I'm not sure, but I can tell you that mplayer does what you're talking 
about and works fine. You may want to take a look at how they do it.


OpenOffice.org, too. It builds an app bundle, etc., using command line 
tools. It may not be a good place to start, though. It is about 1.8 GB 
of code all together.


The relevant part to the OP's question, though, would be in the 
instsetoonative module where the different installers are created.


Jason
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to [EMAIL PROTECTED]


Countdown With NSTimer - Hours, Minutes, Seconds Remaining?

2008-12-10 Thread Chunk 1978
i believe i painted myself into a corner here... i have a
NSPopUpButton with 3 items.  1 Hour, 2 Hours, 3 Hours.  each item has
respected tag numbers 1, 2 and 3.  i'm attempting to print out time
remaining but i can only get as far as displaying seconds remaining
with this:  NSLog(@%.2d Seconds Remaining, (hoursSelected -
second));  but i would like for the log to output @%.2d Hours, %.2d
Minutes and %2d Seconds Remaining;  i can't wrap my head around it,
and i fear that my trying to be as if/else statementless as possible
by using the tag numbers of the PopUp Menu is causing me problems.

-=-=-=-=-

-(int)timeMenuSelection
{
return [[menu selectedItem] tag];
}

- (IBAction)startTimer:(id)sender
{
startTime = [NSDate timeIntervalSinceReferenceDate];

[killTimer invalidate];
[killTimer release];
killTimer = nil;

killTimer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self
selector:@selector(updateTime:) userInfo:nil repeats:YES] retain];
}

- (void)updateTime:(NSTimer *)theTimer
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSTimeInterval interval = now - startTime;
int second = (int)interval;

//Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours.
//Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours.
//Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours.

int hoursSelected = ([self timeMenuSelection] * 3600);

if (second = hoursSelected)
{
NSLog(@%.2d Seconds Remaining, (hoursSelected - second));
}
else
{
NSLog(@TIME'S UP!);
[killTimer invalidate];
[killTimer release];
killTimer = nil;
}
}

-=-=-=-=-
___

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 [EMAIL PROTECTED]


Re: Countdown With NSTimer - Hours, Minutes, Seconds Remaining?

2008-12-10 Thread Graham Cox


On 11 Dec 2008, at 11:03 am, Chunk 1978 wrote:


i believe i painted myself into a corner here... i have a
NSPopUpButton with 3 items.  1 Hour, 2 Hours, 3 Hours.  each item has
respected tag numbers 1, 2 and 3.  i'm attempting to print out time
remaining but i can only get as far as displaying seconds remaining
with this:  NSLog(@%.2d Seconds Remaining, (hoursSelected -
second));  but i would like for the log to output @%.2d Hours, %.2d
Minutes and %2d Seconds Remaining;  i can't wrap my head around it,
and i fear that my trying to be as if/else statementless as possible
by using the tag numbers of the PopUp Menu is causing me problems.




warning: typed into mail, off the top of my head:


int hours, minutes, seconds, totalSecondsRemaining;


totalSecondsRemaining = ( menuValue * 3600 ) - timeElapsedSoFar;

hours = totalSecondsRemaining % 3600;
totalSecondsRemaining -= ( hours * 3600 );
minutes = totalSecondsRemaining % 60;
totalSecondsRemaining -= ( minutes * 60 );
seconds = totalSecondsRemaining;

NSLog(@remaining time: %.2d hours, %.2d minutes, %.2d seconds,  
hours, minutes, seconds );



n.b the key is to use the mod operator (%). I believe in some schools  
modulo arithmetic is called clock arithmetic.


hth,

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 [EMAIL PROTECTED]


Re: Countdown With NSTimer - Hours, Minutes, Seconds Remaining?

2008-12-10 Thread Nathan Day

You need something like

NSLog(@%.2d Hours, %.2d Minutes and %2d Seconds Remaining,
	hoursSelected-seconds/3600, (hoursSelected*60-seconds/60)%60,  
(hoursSelected*3600-seconds)%60 );



On 11/12/2008, at 11:03 , Chunk 1978 wrote:


i believe i painted myself into a corner here... i have a
NSPopUpButton with 3 items.  1 Hour, 2 Hours, 3 Hours.  each item has
respected tag numbers 1, 2 and 3.  i'm attempting to print out time
remaining but i can only get as far as displaying seconds remaining
with this:  NSLog(@%.2d Seconds Remaining, (hoursSelected -
second));  but i would like for the log to output @%.2d Hours, %.2d
Minutes and %2d Seconds Remaining;  i can't wrap my head around it,
and i fear that my trying to be as if/else statementless as possible
by using the tag numbers of the PopUp Menu is causing me problems.

-=-=-=-=-

-(int)timeMenuSelection
{
return [[menu selectedItem] tag];
}

- (IBAction)startTimer:(id)sender
{
startTime = [NSDate timeIntervalSinceReferenceDate];

[killTimer invalidate];
[killTimer release];
killTimer = nil;

killTimer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self
selector:@selector(updateTime:) userInfo:nil repeats:YES] retain];
}

- (void)updateTime:(NSTimer *)theTimer
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSTimeInterval interval = now - startTime;
int second = (int)interval;

//Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours.
//Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours.
//Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours.

int hoursSelected = ([self timeMenuSelection] * 3600);

if (second = hoursSelected)
{
NSLog(@%.2d Seconds Remaining, (hoursSelected - second));
}
else
{
NSLog(@TIME'S UP!);
[killTimer invalidate];
[killTimer release];
killTimer = nil;
}
}

-=-=-=-=-
___

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

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Countdown With NSTimer - Hours, Minutes, Seconds Remaining?

2008-12-10 Thread Ashley Clark

If you save off a starting time object you could use NSDateComponents.


NSDate *startDate = /* set at beginning */
NSCalendar *cal = [NSCalendar currentCalendar];
NSCalendarUnit units = NSHourCalendarUnit | NSMinuteCalendarUnit |  
NSSecondCalendarUnit;


NSDateComponents *comps = [cal components:units fromDate:startDate  
toDate:[NSDate date] options:0];


The resulting comps object will respond to -hour, -minute and -second  
messages.



Ashley

On Dec 10, 2008, at 6:03 PM, Chunk 1978 wrote:


i believe i painted myself into a corner here... i have a
NSPopUpButton with 3 items.  1 Hour, 2 Hours, 3 Hours.  each item has
respected tag numbers 1, 2 and 3.  i'm attempting to print out time
remaining but i can only get as far as displaying seconds remaining
with this:  NSLog(@%.2d Seconds Remaining, (hoursSelected -
second));  but i would like for the log to output @%.2d Hours, %.2d
Minutes and %2d Seconds Remaining;  i can't wrap my head around it,
and i fear that my trying to be as if/else statementless as possible
by using the tag numbers of the PopUp Menu is causing me problems.

-=-=-=-=-

-(int)timeMenuSelection
{
return [[menu selectedItem] tag];
}

- (IBAction)startTimer:(id)sender
{
startTime = [NSDate timeIntervalSinceReferenceDate];

[killTimer invalidate];
[killTimer release];
killTimer = nil;

killTimer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self
selector:@selector(updateTime:) userInfo:nil repeats:YES] retain];
}

- (void)updateTime:(NSTimer *)theTimer
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSTimeInterval interval = now - startTime;
int second = (int)interval;

//Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours.
//Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours.
//Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours.

int hoursSelected = ([self timeMenuSelection] * 3600);

if (second = hoursSelected)
{
NSLog(@%.2d Seconds Remaining, (hoursSelected - second));
}
else
{
NSLog(@TIME'S UP!);
[killTimer invalidate];
[killTimer release];
killTimer = nil;
}
}

-=-=-=-=-
___

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/aclark%40ghoti.org

This email sent to [EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Problem setting a Core Data Document Icon

2008-12-10 Thread vince
I  can't seem to set a default icon for my supported docs in a Core Data
project.
The .icns file is in my Bundle and placed in the Resources bin. I manually
inserted the file name in the Target's Supported Document field.
I rebooted my system a few times since and still no changes to the newly
saved files.

Am I missing a step?

Thanks for the help.

vince.
___

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 [EMAIL PROTECTED]


Re: Countdown With NSTimer - Hours, Minutes, Seconds Remaining?

2008-12-10 Thread Chunk 1978
i read in the docs that the use of NSCalandarDate is discouraged
because it's going to be depreciated for OS X 10.6... i'm not really
sure if depreciated means that any code with NSCalandarDate will no
longer function with the new OS or if it will just be considered out
dated...

On Wed, Dec 10, 2008 at 7:36 PM, Ashley Clark [EMAIL PROTECTED] wrote:
 If you save off a starting time object you could use NSDateComponents.


 NSDate *startDate = /* set at beginning */
 NSCalendar *cal = [NSCalendar currentCalendar];
 NSCalendarUnit units = NSHourCalendarUnit | NSMinuteCalendarUnit |
 NSSecondCalendarUnit;

 NSDateComponents *comps = [cal components:units fromDate:startDate
 toDate:[NSDate date] options:0];

 The resulting comps object will respond to -hour, -minute and -second
 messages.


 Ashley

 On Dec 10, 2008, at 6:03 PM, Chunk 1978 wrote:

 i believe i painted myself into a corner here... i have a
 NSPopUpButton with 3 items.  1 Hour, 2 Hours, 3 Hours.  each item has
 respected tag numbers 1, 2 and 3.  i'm attempting to print out time
 remaining but i can only get as far as displaying seconds remaining
 with this:  NSLog(@%.2d Seconds Remaining, (hoursSelected -
 second));  but i would like for the log to output @%.2d Hours, %.2d
 Minutes and %2d Seconds Remaining;  i can't wrap my head around it,
 and i fear that my trying to be as if/else statementless as possible
 by using the tag numbers of the PopUp Menu is causing me problems.

 -=-=-=-=-

 -(int)timeMenuSelection
{
return [[menu selectedItem] tag];
}

 - (IBAction)startTimer:(id)sender
{
startTime = [NSDate timeIntervalSinceReferenceDate];

[killTimer invalidate];
[killTimer release];
killTimer = nil;

killTimer = [[NSTimer scheduledTimerWithTimeInterval:1 target:self
 selector:@selector(updateTime:) userInfo:nil repeats:YES] retain];
}

 - (void)updateTime:(NSTimer *)theTimer
{
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSTimeInterval interval = now - startTime;
int second = (int)interval;

//Tag #1 x 3600 Seconds = 3600 Seconds = 2 Hours.
//Tag #2 x 3600 Seconds = 7200 Seconds = 2 Hours.
//Tag #3 x 3600 Seconds = 10800 Seconds = 3 Hours.

int hoursSelected = ([self timeMenuSelection] * 3600);

if (second = hoursSelected)
{
NSLog(@%.2d Seconds Remaining, (hoursSelected - second));
}
else
{
NSLog(@TIME'S UP!);
[killTimer invalidate];
[killTimer release];
killTimer = nil;
}
}

 -=-=-=-=-
 ___

 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/aclark%40ghoti.org

 This email sent to [EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Re: The thread that starts by NSTask didn't clear up

2008-12-10 Thread Xianyu Ge
I appreciate that you give me you hand, Thank you very much, I have solved
this questions, and I also learn knowledge that NSTask is just a wrapper
around execve(), no threading involved. Thanks.

2008/12/10 Etienne Guérard [EMAIL PROTECTED]

 OK
 It seems that in leopard NSTask uses a thread to monitor the launched
 process, presumably to detect process termination. This thread should
 disappear shortly after the corresponding NSTask instance is released.

 Since the launched NSTask is auto-released you need to do one of the
 following:
 1. Install a NSAutoreleasePool somewhere in your loop
 2. Use [[NSTask alloc] init] and explicitly release your task when you're
 done.

 EG


 On Dec 10, 2008, at 11:02 AM, Xianyu_Ge wrote:

  hi, EG,
Thanks for you help. I had use threadViewer to note thread count,
  when go to step that launch application use NSTask, thread count will
 added, when application quit, the thread didn't stopped,  but on tiger this
 works right I think. I copy some codes as follows:

NSMutableArray* args = [[[NSMutableArray alloc] init] autorelease];
NSString* ips = [NSString stringWithCString : ipAddress];
NSString* dsn = [NSString stringWithCString : dsName];
NSString* tmp = [@-T:\ stringByAppendingString:dsn];
tmp = [tmp stringByAppendingString:@\,];
tmp = [tmp stringByAppendingString:ips];

NSString* arg1 = [NSString stringWithFormat:@
 -T:\%s\,%s,dsn,ips];

arg1 = tmp;
NSLog(@the command line is %@,arg1);
[args addObject:arg1];

NSTask* theTask = [NSTask launchedTaskWithLaunchPath:excuPath
 arguments:[NSArray arrayWithObjects:arg1,nil]];
[theTask waitUntilExit];

 when step NSTask* theTask = [NSTask launchedTaskWithLaunchPath:excuPath
 arguments:[NSArray arrayWithObjects:arg1,nil]];  end, a thread will added
 until main thread exit.


 ---
 Best Regards,
Xianyu





 On Dec 10, 2008, at 5:46 PM, Etienne Guérard wrote:

  Hi,

 On Dec 10, 2008, at 2:26 AM, Xianyu_Ge wrote:

  thanks for your reply. I means in my project, I want to use NSTask to
 launch an application, and send application some parameters, when use 
 NSTask
 launch application that will add a new thread, right?


 As far as I understand, you use NSTask to launch your application. But
 this does not imply that a new thread is created to monitor the launched
 process, unless of course, if you setup your own thread to monitor the
 process.
 So I think you assume that NSTask will use a thread but this is wrong.
 NSTask is just a wrapper around execve(), no threading involved here.

  and then send Apple event, when application received Apple event , it
 will quit, usually, the thread starts by NSTask will exit, because the
 application had quit, so I don't understand this, if use NSTask launch
 application more times, thread count will always increased, even if
 application had quit. I appreciate that any reply, thank you very much.


 You can use ThreadViewer to convince yourself that there's no threading
 involved by using NSTask.

 EG


 ---
 Best Regards,
Xianyu

 On Dec 10, 2008, at 12:44 AM, Etienne Guérard wrote:

 I started an AP use NSTask in my project ,when I loaded this AP,
 thread count will be increased ,after sending apple event to AP , and AP
 will exit, but thread count can't decrease. If I used this method load AP
 more times, thread count will increased, but there was no problem on 
 tiger,
 just  present leopard. Sorry for my poor english.


 I assume that AP acually means application.
 I understand that you send some Apple event to your application like a
 quit' event, right?
 You say that your application exit. OK. So what process the threads
 you're talking about belong to?
 Where does NSTask come into this?

 You have to be more precise to get an answer...

 EG



 
 This message and any attachments (the message) are confidential and
 intended solely for the addressee(s). Any unauthorised use or dissemination
 is prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor
 any of its subsidiaries or affiliates shall be liable for the message if
 altered, changed or falsified.
 Ce message et toutes les pieces jointes (ci-apres le message) sont
 confidentiels et etablis a l'intention exclusive de ses destinataires. Toute
 utilisation ou diffusion non autorisee est interdite. Tout message
 electronique est susceptible d'alteration. DxO Labs et ses filiales
 declinent toute responsabilite au titre de ce message s'il a ete altere,
 modifie ou falsifie.




-- 
Best Regards
Xianyu
___

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


  1   2   >