XCode Debugger - a couple of questions from newbie

2009-01-28 Thread Alexander Bokovikov

Hi, All,

Please, anybody, help me to understand how this thing works:

I'm trying to set a breakpoint at the main() call in the main.m. I'd like to 
see the arguments. Or maybe there is NS to get them? One way or another, 
my bp doesn't work for some reason. Please take a look at the screenshot, 
made before I click "Build and debug":


http://home.bokovikov.com/etc/mac/xcode/break1.png

It it all OK here? Hope yes. At least my bp is active. Now I'm pressing 
"Build and Debug" and I see this:


http://home.bokovikov.com/etc/mac/xcode/break2.png

What does it mean? Does it mean that my bp is set in a wrong location? What 
this blue frame means? And why? Is it impossible to set a bp within main()? 
Whatever else?


Yet another problem is that I can't set bp within the disassembler view. I 
see the same popup menu, as for source view, but nothing happens when I 
click "Add breakpoint", when I'm in disassembler view. Is it a bug or 
feature or my misunderstanding?


Finally, I see a lot of records in the bp list after all my experiments, and 
many of bp's are located within "asm...", though I never saw them really. 
And I can't empty this window. "Delete" popup menu item does noot work. Can 
I delete all these lines somehow? Please take a look at the screenshot here:


http://home.bokovikov.com/etc/mac/xcode/bplist.png

Thanks in advance.

___

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

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

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

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


Re: Binding Buttons and Popup Menus to NSDictionary made from a prefs plist?

2009-01-28 Thread Ken Thomases

On Jan 26, 2009, at 9:09 AM, Robert Monaghan wrote:


I am trying to wrap my head around using a plist.


When you refer to a "plist", are you referring to a property list data  
structure as it might exist in memory, or a property list file?  Or  
perhaps you're referring to user defaults?


In memory, a property list is just an abstraction.  It's an NSString,  
NSNumber, NSData, NSDate, or a collection (NSArray or NSDictionary)  
containing only theses types.  (For simplicity, I'm eliding mutable  
versions of these types and their Core Foundation equivalents.)



Everything that I have seen on the mailing list so far, involves  
using an NSTableView to work with NSDictionaries.


I'm sure that more reading will turn up lots of other examples that  
don't use NSDictionaries.


Key-Value Coding, Key-Value Observing, and Bindings all deal with  
objects which have properties, which may be referred to by name,  
a.k.a. key.


NSMutableDictionary is useful as a generic object which may have any  
set of properties.  NSMutableDictionary can be nice for some rapid  
prototyping.  However, you'll probably find that it will be  
insufficient for a real application.


The problem with using NSMutableDictionary for your model objects is  
that it's pure data with precious little behavior.  Object-oriented  
programming is about combining data with the operations (behavior)  
that act on it.  Unless your model has no smarts, no "business/domain  
logic", then a dictionary is not going to be sufficient.


So, you should definitely consider replacing your uses of  
NSMutableDictionary with real custom classes that represent your model  
objects.  Sometimes doing so forces thinking about your design that  
exposes problems with it.




Here is what I have set up.
I have several NSButtons and pre-populated NSPopup Buttons, where  
the index values or states are stored as NSNumbers inside a plist  
file. Fairly easy to figure out. You just specify a key, and you get  
an NSNumber Object.


Here you say "plist file", but you can't create bindings to a file.   
So, what's really going on?



I am now trying use several of these plists. I have a list of  
projects in an NSTextColum, each with its own plist. I want to  
select one of the projects in the tableview, and have the controls  
changed to reflect the states from the appropriate plist. Again, in  
theory, plists should work well, here.


NSTextColum?  I'm going to assume you mean a table column with text  
field cell.  From what you're describing -- selecting a row in a table  
updates controls to reflect the selection -- this sounds like a master- 
detail interface.


Yes, "plists" should work well here, in the sense that you can model  
the set of projects using a to-many relationship represented with an  
array, and each element being a dictionary describing a project.


By the way, you haven't described the object having this to-many  
relationship.



So far, I have an NSArrayController working well, with a list of  
projects/plists. However, I can't seem to get the bindings to work  
for the various controls. I am attempting to bind the buttons and  
popup menus to *something" that that can drive them. I not only want  
the controls to be updated with each project that is selected, but  
have the NSDictionary that is holding the plist, to be updated when  
the user changes the controls.


You use the verb "drive" here (and below), but I'm not sure I follow  
what you mean.  You want something to "drive" your buttons and pop-up  
menus? In what sense?  Do what to them?


In the Model-View-Controller (MVC) design pattern, if anything is  
going to act on the views, it would be the controller.  Often though,  
the views "drive" the controller, in the sense of sending action  
messages to it or setting its properties through bindings.  The views  
also get their values from the controller through bindings, built on  
KVO.




Here is what I have tried:
NSDictionaryController.
I have an observeValueForKeyPath set up, to watch my  
NSArrayController, with a list of projects.
Once I have a project selected, it then binds an NSMutableDictionary  
to the NSDictionaryController
Something like this: [seqPrefsCtlr bind:NSContentDictionaryBinding  
toObject:self withKeyPath:@"prefsDict" options:nil];


Honestly, that is clear as mud to me.

Why are you using an NSDictionaryController?  If you're using an  
NSMutableDictionary as a model object, that doesn't necessarily mean  
that an NSDictionaryController is appropriate.  It's only appropriate  
if you need to treat the set of key-value pairs as an array, where the  
keys are not properties but part of the data.  If you're using a  
dictionary as an entity, where its keys are properties, then I don't  
see where NSDictionaryController enters into it.


An NSArrayController is a mediating controller.  There should be a  
coordinating controller somewhere, which you haven't described.  The  
NSArrayController doesn't "own

Re: How to catch and log EXC_BAD_ACCESS?

2009-01-28 Thread Ken Thomases

On Jan 26, 2009, at 5:33 AM, Oleg Krupnov wrote:


For the beta-testing purposes, I'd like my app to handle the situation
when the EXC_BAD_ACCESS exception occurs, and treat it gracefully -
i.e. send a crash report and perhaps terminate.


You might look into NSExceptionHandler, which can do something  
somewhat useful on the way to terminating your app.  Although, really,  
letting Crash Reporter collect the report is probably better.  And, as  
discussed, EXC_BAD_ACCESS/SIGSEGV should lead to terminating your app.


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 arch...@mail-archive.com


Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-28 Thread Ken Thomases

On Jan 27, 2009, at 8:23 AM, Adam Venturella wrote:


Will thanks for the heads up, for my purposes this time around, the
input stream will be coming in off the file system, but I did not want
to load the whole thing into an NSData object.


Have you considered NSFileHandle and its -readDataOfLength: method?   
Or for that matter, stdio?


Cheers,
Ken

___

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

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

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

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


Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-28 Thread Jeremy Pereira


On 27 Jan 2009, at 23:07, Graham Cox wrote:



On 28 Jan 2009, at 2:24 am, Jeremy Pereira wrote:

Yes.  That is correct, but since buffer is already a pointer to the  
first byte of the array and then you are taking a reference to it,  
key will end up containing the address of the buffer.  You really  
need:



uint key = *(uint*)buffer;





That's incorrect. Or rather, in this case it doesn't make any  
difference, but the use of '&' is more general as it works whether  
buffer is an array or not.



When you declare:

uint8 buffer[8];

You've reserved 8 bytes on the stack. Whether you use 'buffer' or  
'&buffer' you obtain the same address, as C treats array variables  
as pointers. But:


Having tried it just now, I stand corrected.

However, I would argue that this is the C compiler behaving in a  
deliberately inconsistent way, since in C, arrays and pointers are  
supposed to be the same thing.  As buffer is actually a constant,  
taking its address should really result in a compiler error in the  
same way as int a = &123;







uint8 buffer;

You get very different results from 'buffer' and '&buffer' so in the  
interests of defensive programming, using '&' is allowing your code  
to tolerate a change to the buffer declaration without breaking.  
Because of the additional cast *(int*) such a change would go  
unnoticed by the compiler but probably have a very bad outcome at  
runtime. It's a good habit IMO to always take the address in these  
cases to make it clear in your code what your intentions were when  
you wrote it.


I disagree.  Consider the following program:

---
#include 

int buf[2];

static void foo(int buf1[])
{
printf ("buf1 %08x %08x\n", buf1, &buf1);
}

int main ()
{
unsigned int key = *(unsigned int*)&buf;
printf ("buf  %08x %08x\n", buf, &buf);
foo(buf);
return 0 ;
}
---

If I compile and run it, I get the following output:

buf  2030 2030
buf1 2030 ba00

Clearly if I naively copy and paste

unsigned int key = *(unsigned int*)&buf;

from main to foo and just change the name, I will get the wrong result.




--Graham




___

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

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

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

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


Canvas View really large?

2009-01-28 Thread Rick Langschultz

Hello everyone,

I am developing some drawing software and needed some assistance. I  
have a basic view: TSLabel which is just a small plain view that  
doesn't really do anything - just a rectangle. This rectangle can be  
dragged and moved around it's superview - TSCanvasView which is a  
subclass of a TSZoomView.


Here is my code for a mouseDown: event:

	NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]  
fromView:nil];

NSLog(@"Mouse Down at X point: %i", mouseLoc.x);
NSLog(@"Mouse Down at Y point: %i", mouseLoc.y);

My results are pretty large actually, here is the results:
	2009-01-28 02:02:39.548 TestApp[59739:10b] Mouse Down at X point:  
-2089457256
	2009-01-28 02:02:39.549 TestApp[59739:10b] Mouse Down at Y point:  
-2089602536


I suspect it is because I have the canvas displaying a checkerboard  
background that checkerboards the TSCanvasView's drawing.


Can anyone tell me why the X, Y coords are so astronomical? And is  
there any code I should look at. Here are my references:


Sketch.app - Apple Developer Tools / Examples
MySQL Workbench
EFLaceView

Any input, or pointers would be greatly appreciated.

Thanks,
Rick Langschultz
___

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

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

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

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


drag the whole window just by dragging the Image placed on it

2009-01-28 Thread Rahulkumar
 

Few days ago I posted a querry that

 

"I can move a Window i.e. a NSWindow object with the just a simple call
[myWindow setMovableByWindowBackground:TRUE]. This makes window movable from
every point I drag my mouse pointer. Now if I place an NSImage Object over
the window and try to drag the whole window there by only dragging the Image
, it does not works. 

Is there is any way to drag the whole window just by dragging the Image
placed on it?"

 

Any solutions.

Thanks.


 

 

 

 

 

 

___

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

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

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

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


action on double click of image

2009-01-28 Thread Rahulkumar
Hi,

 

I am trying to perform some action on double click of image. Can anybody
suggest me some solution. something which gets called after double clicking
on the

image. any help will be appreciated.

 

Thanks in advance.

 

Regards,

 


PersistentSystemsPrivateLimited

 

P

Rahulkumar Tibdewal | Software Engineer -Telecom| Persistent Systems Ltd.

  rahulkumar_tibde...@persistent.co.in
| Cell: +91 9975582373| Tel: +91 (0712) 398 6107

Innovation in software product design, development and delivery-
 www.persistentsys.com

 

 

Please consider the impact to the environment before printing this email

 

 

 

 

<>___

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

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

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

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

Multiple NSTabViewItems that can't fit in a Single NSTabView

2009-01-28 Thread Rahulkumar
I want to display Multiple NSTabViewItems that can't fit in a Single
NSTabView. In windows, if tabview items doesn't fit in a tab then they are
displayed by dividing them in 2 lines. Is there anything like this on Mac
platform so that I can display around 10 TabViewItems in a single NSTabView?

 

 

Thanks

 

Regards,

Rahul


 

 

 

 

 

 

___

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

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

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

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


Update your app

2009-01-28 Thread Filip van der Meeren

Good afternoon,

I want to add an updatefunction to my applications, but I am wondering  
how to implement it.
Does someone here have experience with updating your own applications  
without letting the user downloading some parts manually.


Thank you very much,

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

___

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

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

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

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


Re: Update your app

2009-01-28 Thread Scott Anguish

You want Sparkle.

http://sparkle.andymatuschak.org/

On 28-Jan-09, at 8:43 AM, Filip van der Meeren wrote:


Good afternoon,

I want to add an updatefunction to my applications, but I am  
wondering how to implement it.
Does someone here have experience with updating your own  
applications without letting the user downloading some parts manually.



___

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

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

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

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


Re: action on double click of image

2009-01-28 Thread Mike Abdullah

As a very cursory search with Google would have found you:
http://www.google.com/search?client=safari&rls=en-gb&q=nsimageview+double+click&ie=UTF-8&oe=UTF-8
http://lists.apple.com/archives/Cocoa-dev/2007/Mar/msg00542.html

Mike.

On 28 Jan 2009, at 09:47, Rahulkumar wrote:


Hi,



I am trying to perform some action on double click of image. Can  
anybody
suggest me some solution. something which gets called after double  
clicking

on the

image. any help will be appreciated.



Thanks in advance.



Regards,




PersistentSystemsPrivateLimited



P

Rahulkumar Tibdewal | Software Engineer -Telecom| Persistent Systems  
Ltd.


 rahulkumar_tibde...@persistent.co.in
| Cell: +91 9975582373| Tel: +91 (0712) 398 6107

Innovation in software product design, development and delivery-
 www.persistentsys.com





Please consider the impact to the environment before printing this  
email










___

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

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

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

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


___

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

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

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

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


Re: drag the whole window just by dragging the Image placed on it

2009-01-28 Thread Mike Abdullah

Look at -[NSView mouseDownCanMoveWindow]

On 28 Jan 2009, at 09:07, Rahulkumar wrote:




Few days ago I posted a querry that



"I can move a Window i.e. a NSWindow object with the just a simple  
call
[myWindow setMovableByWindowBackground:TRUE]. This makes window  
movable from
every point I drag my mouse pointer. Now if I place an NSImage  
Object over
the window and try to drag the whole window there by only dragging  
the Image

, it does not works.

Is there is any way to drag the whole window just by dragging the  
Image

placed on it?"



Any solutions.

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

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


___

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

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

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

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


Re: Canvas View really large?

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


On 28 Jan 2009, at 08:09, Rick Langschultz wrote:


Hello everyone,

I am developing some drawing software and needed some assistance. I  
have a basic view: TSLabel which is just a small plain view that  
doesn't really do anything - just a rectangle. This rectangle can be  
dragged and moved around it's superview - TSCanvasView which is a  
subclass of a TSZoomView.


Here is my code for a mouseDown: event:

	NSPoint mouseLoc = [self convertPoint:[theEvent locationInWindow]  
fromView:nil];

NSLog(@"Mouse Down at X point: %i", mouseLoc.x);
NSLog(@"Mouse Down at Y point: %i", mouseLoc.y);



It won't help that NSPoint.x is declared CGFloat. A %f format  
specifier should help.



My results are pretty large actually, here is the results:
	2009-01-28 02:02:39.548 TestApp[59739:10b] Mouse Down at X point:  
-2089457256
	2009-01-28 02:02:39.549 TestApp[59739:10b] Mouse Down at Y point:  
-2089602536


I suspect it is because I have the canvas displaying a checkerboard  
background that checkerboards the TSCanvasView's drawing.


Can anyone tell me why the X, Y coords are so astronomical? And is  
there any code I should look at. Here are my references:


Sketch.app - Apple Developer Tools / Examples
MySQL Workbench
EFLaceView

Any input, or pointers would be greatly appreciated.

Thanks,
Rick Langschultz
___

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

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

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

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


Jonathan Mitchell

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 arch...@mail-archive.com


Re: Update your app

2009-01-28 Thread Filip van der Meeren

The same as Adium!
Nice, thank you...

Filip van der Meeren
fi...@code2develop.com
http://sourceforge.net/projects/xlinterpreter

On 28 Jan 2009, at 15:00, Scott Anguish wrote:


You want Sparkle.

http://sparkle.andymatuschak.org/

On 28-Jan-09, at 8:43 AM, Filip van der Meeren wrote:


Good afternoon,

I want to add an updatefunction to my applications, but I am  
wondering how to implement it.
Does someone here have experience with updating your own  
applications without letting the user downloading some parts  
manually.




___

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

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

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

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


Spaces: Receiving a space change notification.

2009-01-28 Thread Half Activist

Hello everyone,

Is it possible to receive a notification when the active space changes?
	Or is it possible to programatically make an application display on  
all spaces?


h.a.
___

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

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

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

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


Re: Spaces: Receiving a space change notification.

2009-01-28 Thread Jesper Storm Bache

On Jan 28, 2009, at 6:53 AM, Half Activist wrote:

Hello everyone,

	Is it possible to receive a notification when the active space  
changes?


No



Or is it possible to programatically make an application display on
all spaces?


Spaces target windows, so rather than thinking "an application on all  
Spaces", think "my windows on all Spaces" (or some of my windows on  
all Spaces).

See NSWindowCollectionBehavior in NSWindow

Jesper Storm Bache




h.a.
___

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

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

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

This email sent to jsba...@adobe.com


___

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

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

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

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


How to draw text with fade out effect?

2009-01-28 Thread Oleg Krupnov
I want to produce the effect of a text string fading out when it's too
long to be displayed in a rect. This kind of effect is used in many
apps.

My first solution was to simply draw the text and then on top of it
draw a gradient fill ranging from the fully transparent color to the
background color of the rect. This works fine, however only for solid
opaque backgrounds.

Now I have the problem that the background is not solid and/or not
opaque. There is no longer such thing as "background color" I could
use in the gradient. How do I solve this problem?

I've tried to go the way of converting the text to a path and fill it
with gradient, but encountered some problems: 1) I don't know the
right line width to stroke the path, I only fill it, and so the path
never looks of the same weight as the simply drawn text; 2) the path
is not aligned to the baseline of text, and I don't know the right
offsets, so the path is never aligned the same way as the simply drawn
text. 3) gradient fill of this path did not produce smooth fade out
for some reason.

I'm hoping there is an easier way I've missed, but any advice is welcome!
___

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

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

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

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


Re: How to draw text with fade out effect?

2009-01-28 Thread Ricky Sharp
You could render your text to an image first, composite it with the  
opaque-to-transparent mask and finally draw the result.


I used to create images from text, but I ended up with issues  
regarding resolution independence for some reason. So, you may need to  
test this solution with RI if needed.


Sent from my iPhone

On Jan 28, 2009, at 9:38 AM, Oleg Krupnov   
wrote:



I want to produce the effect of a text string fading out when it's too
long to be displayed in a rect. This kind of effect is used in many
apps.

My first solution was to simply draw the text and then on top of it
draw a gradient fill ranging from the fully transparent color to the
background color of the rect. This works fine, however only for solid
opaque backgrounds.

Now I have the problem that the background is not solid and/or not
opaque. There is no longer such thing as "background color" I could
use in the gradient. How do I solve this problem?

I've tried to go the way of converting the text to a path and fill it
with gradient, but encountered some problems: 1) I don't know the
right line width to stroke the path, I only fill it, and so the path
never looks of the same weight as the simply drawn text; 2) the path
is not aligned to the baseline of text, and I don't know the right
offsets, so the path is never aligned the same way as the simply drawn
text. 3) gradient fill of this path did not produce smooth fade out
for some reason.

I'm hoping there is an easier way I've missed, but any advice is  
welcome!

___

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

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

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

This email sent to rsh...@mac.com

___

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

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

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

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


Re: How to draw text with fade out effect?

2009-01-28 Thread Thomas Davie


On 28 Jan 2009, at 16:49, Ricky Sharp wrote:

You could render your text to an image first, composite it with the  
opaque-to-transparent mask and finally draw the result.


I used to create images from text, but I ended up with issues  
regarding resolution independence for some reason. So, you may need  
to test this solution with RI if needed.


This solution will also throw sub-pixel anti-aliasing in the bin.

Bob
___

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

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

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

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


Re: How to draw text with fade out effect?

2009-01-28 Thread Oleg Krupnov
Sounds interesting, but how do I technically "composite the image with
the mask"?

Also I'm not sure I understand the resolution issues you mentioned.

Could you please give a little bit more detail? Thanks!


On Wed, Jan 28, 2009 at 5:49 PM, Ricky Sharp  wrote:
> You could render your text to an image first, composite it with the
> opaque-to-transparent mask and finally draw the result.
>
> I used to create images from text, but I ended up with issues regarding
> resolution independence for some reason. So, you may need to test this
> solution with RI if needed.
>
> Sent from my iPhone
>
> On Jan 28, 2009, at 9:38 AM, Oleg Krupnov  wrote:
>
>> I want to produce the effect of a text string fading out when it's too
>> long to be displayed in a rect. This kind of effect is used in many
>> apps.
>>
>> My first solution was to simply draw the text and then on top of it
>> draw a gradient fill ranging from the fully transparent color to the
>> background color of the rect. This works fine, however only for solid
>> opaque backgrounds.
>>
>> Now I have the problem that the background is not solid and/or not
>> opaque. There is no longer such thing as "background color" I could
>> use in the gradient. How do I solve this problem?
>>
>> I've tried to go the way of converting the text to a path and fill it
>> with gradient, but encountered some problems: 1) I don't know the
>> right line width to stroke the path, I only fill it, and so the path
>> never looks of the same weight as the simply drawn text; 2) the path
>> is not aligned to the baseline of text, and I don't know the right
>> offsets, so the path is never aligned the same way as the simply drawn
>> text. 3) gradient fill of this path did not produce smooth fade out
>> for some reason.
>>
>> I'm hoping there is an easier way I've missed, but any advice is welcome!
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/rsharp%40mac.com
>>
>> This email sent to rsh...@mac.com
>
___

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

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

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

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


Re: Modal Sheet without Spaghetti?

2009-01-28 Thread Michael Ash
On Tue, Jan 27, 2009 at 11:35 PM, Jerry Krinock  wrote:
> Thanks for your thoughts, Graham and Michael.  My irritation is not so much
> with the "Do you really want to do this?  How?" dialogs, but in presenting
> errors.
>
> Probably I should have given a more concrete example, as I now have [1].
>  This simplified code from my real app performs a "sync in" to a document of
> some data from a source on a remote server.  For many good reasons (for
> example, to facilitate other programmatic entries into this process and to
> allow subclasses to have different implementations), the -makeConnection
> method is the sixth function in a call stack that begins with the IBAction
> syncIn:.
>
> Now, what if the network connection fails?  I've been presenting the error
> in a modal dialog, but as I said in my original post, since this network
> connection failure only affects the current document, I believe that good UI
> design would want the error presented in a sheet on the document window
> instead.  However, to do so, my code would become a bloody mess.
>
> So I looked again at -[NSDocument presentError:] and saw that it "does not
> return until the user dismisses the alert".  Whoopee!!  But upon trying it,
> I see that gives a free-standing modal dialog box instead of the sheet that
> I want.  Oh, well.
>
> Apple's dialog-box implementation of -[NSDocument presentError:] leads me to
> believe that Apple has punted on this problem as well.  I guess I'll just
> continue to use the modal dialog -- until I have a free day to consider this
> challenge.

Yes, if you need to make a call that doesn't return until the user
makes a choice, then you cannot use a sheet. Choose one or the other,
but not both.

However this is the sort of thing I meant when I said that this
problem could indicate a design problem. Basically, I don't think that
user interaction should be happening this far down in your code. When
an error occurs deep down in your code, you immediately prompt the
user and then make a choice there. It would be much better (in my
opinion and only seeing your outline code here, not really knowing
what's going on, grain of salt, offer void in Tennessee, etc.) to
simply have that inner code return an error and not try to recover at
all. This error can then propagate up to a more reasonable level. At
that point you can then display a sheet and subsequently retry the
connection or do whatever else it is that's appropriate for you.

This still requires breaking your code up, but instead of "before" and
"after" parts, you have a more logical, sensible division that's
easier to work with.

Mike
___

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

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

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

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


Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-28 Thread Michael Ash
On Wed, Jan 28, 2009 at 6:00 AM, Jeremy Pereira  wrote:
>
> On 27 Jan 2009, at 23:07, Graham Cox wrote:
>
>>
>> On 28 Jan 2009, at 2:24 am, Jeremy Pereira wrote:
>>
>>> Yes.  That is correct, but since buffer is already a pointer to the first
>>> byte of the array and then you are taking a reference to it, key will end up
>>> containing the address of the buffer.  You really need:
>>>
 uint key = *(uint*)buffer;
>>>
>>
>>
>> That's incorrect. Or rather, in this case it doesn't make any difference,
>> but the use of '&' is more general as it works whether buffer is an array or
>> not.
>>
>>
>> When you declare:
>>
>> uint8 buffer[8];
>>
>> You've reserved 8 bytes on the stack. Whether you use 'buffer' or
>> '&buffer' you obtain the same address, as C treats array variables as
>> pointers. But:
>
> Having tried it just now, I stand corrected.
>
> However, I would argue that this is the C compiler behaving in a
> deliberately inconsistent way, since in C, arrays and pointers are supposed
> to be the same thing.  As buffer is actually a constant, taking its address
> should really result in a compiler error in the same way as int a = &123;

It's not the C compiler, it's the language. This behavior is required
by the language specification, so the compiler can't help but comply.

The pointer/array duality is one of the most confusing things in C
because it is somewhat inconsistent, but it's also quite
straightforward.

Let's say you declare an array:

int x[32];

Now if you use the symbol "x", it has type int*. As such, it's
perfectly valid to write something like x+2 (gives you a pointer to
the 3rd element of the x array), to pass x directly to functions which
take pointers, and to cast it to another pointer type. It's even legal
to write *x, which gets you the first element of the array.

What happens when you use "&x"? That gives you the same value *but of
a different type*. The type of &x is int*[32], i.e. a pointer to an
array of 32 ints. You can declare a pointer of this type using amusing
and bizarre syntax:

int (*y)[32] = &x;

This has consequences for pointer arithmetic. (&x)+2 is not the same
as (x+2); the latter gives you the 3rd element of the array, the
former gives you a pointer off into hyperspace, where the 3rd array
would be if you stacked 3 (or more) of these things up contiguously.

Now we can talk all we want about how these things "should" work, and
I agree that this behavior can be kind of odd, but the fact is that
it's a part of the language, a part of the standard, it is how it is,
and it's not going to be changed.

Mike
___

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

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

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

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


Re: Is there a more efficient way to get the first 4 bytes off a NSInputStream to compare

2009-01-28 Thread Jeremy Pereira


On 28 Jan 2009, at 17:08, Michael Ash wrote:

On Wed, Jan 28, 2009 at 6:00 AM, Jeremy Pereira   
wrote:


On 27 Jan 2009, at 23:07, Graham Cox wrote:

However, I would argue that this is the C compiler behaving in a
deliberately inconsistent way, since in C, arrays and pointers are  
supposed
to be the same thing.  As buffer is actually a constant, taking its  
address
should really result in a compiler error in the same way as int a =  
&123;


It's not the C compiler, it's the language. This behavior is required
by the language specification, so the compiler can't help but comply.


If you want to be pedantic, it is the compiler doing the behaving,  
it's the compiler doing the compiling, not the language specification.  
I put the word "deliberately" in to indicate that it is in accordance  
with the spec.  Had I thought it not in accordance with the  
specification, I would have used the word "bug".




Now we can talk all we want about how these things "should" work, and
I agree that this behavior can be kind of odd, but the fact is that
it's a part of the language, a part of the standard, it is how it is,
and it's not going to be changed.


You don't have to accept something as sensible just because it is in a  
specification.  You do, of course, have to put up with it, unless you  
have enough influence to get the specification changed.






___

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

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

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

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


Re: getting WindowRef for focus window in other applications

2009-01-28 Thread Scott Ribe
> D'oh) is there any workaround to keep tracking of recent window user typed in
> ?

I suspect so, within CoreGraphics stuff, but I'm not sure. I fired off that
last email too quickly. Here's the part I left off:

You should describe to us the details of exactly what it is you're trying to
accomplish. Depending on what you want to do, it might be impossible, it
might be possible through assistive technologies, it might be possible
through scripting, it might be possible through CoreGraphics & window
server. It might also be possible on 10.5, but not 10.4. And so on.

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


___

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

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

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

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


Re: CALayer autoresizing behaviour

2009-01-28 Thread Michael A. Crawford
That sounds like a good plan.  I did something similar in order to try  
to work out a problem I had with nested CATextLayer objects not  
displaying.  The test app worked great.  When I reproduced the  
necessary bits of code in my application, I still cannot see the text  
layers.  It is very frustrating.  Either Apple has a bug (I pray this  
is not the case) or I've missed something.  I walked away from the  
problem for a while to work on another area of my app.  I'll get back  
to it later, not because it is low-priority, but because I've been  
trying to solve the problem for a while with little success.



As for the auto-resizing, problem you are having, when looking over my  
code, I stopped as soon as I noticed the 'needDisplayOnBoundsChange'  
property.  Perhaps there is more to it that I've forgotten.  I'll have  
another look at my code and get back to you.


-Michael
--
The united stand.  The divided get played.

-- Bernie MAC




On Jan 28, 2009, at 5:57 AM, Joe Wildish wrote:


Michael,

Thanks for getting back to me. Yes, it is still a problem. However,  
I have a fairly large list of problems I'm working on right now, and  
this isn't near the top :) So I've not looked at it again since  
posting to the list ...


Having said that; I am intending to knock up a small test app that  
simply gives a root layer to a view, adds a fixed size layer to  
that, and then adds another layer to *that* layer ... with the  
appropriate mask set for the autoresizing - and then see what  
happens. AFAIK, this is exactly what my actual app is doing, but I'm  
not seeing the layer resize.


Any input you have would be appreciated.

Regards,
-Joe

On 26 Jan 2009, at 21:09, Michael A. Crawford wrote:

Joe, is this still a problem?  I have some code the seems to work  
properly but I need to study it and compare it to yours before I  
comment further.  Sorry for the wait but I'm just learning this  
stuff and I wrote the code a couple of months ago and haven't had  
to re-visit it.  When I have something for you, I'll send it to the  
list so everyone can benefit.






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Modal Sheet without Spaghetti?

2009-01-28 Thread Matt Neuburg
On Tue, 27 Jan 2009 17:10:20 -0800, Jerry Krinock  said:
>Butt if the possible problem involves a document, I believe it would
>be a better user experience to use a sheet instead of a dialog.  But,
>arghhh, the method
>-[NSApp  
>beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]
>returns immediately, sending its return message to a modal delegate
>selector.  So I must go back up the nest, all the way up to the event
>which drove the process, and split all these methods into two methods,
>the code "before" and "after" the sheet runs.  Repeat this for all
>other possible entry points into this innermost method.  And there
>goes another afternoon.
>
>-(void)methodC1 {
> // Some code here (C1)
>
> [NSApp beginSheet:...
>modalForWindow:...
> modalDelegate:self
>didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
>}

The delegate does not have to be self, and the didEndSelector does not have
to be named didEndSheet: (it can have any name you like, as long as its
parameters are NSWindow*, int, void*). So, yes, it's true that methodC1 now
ends and we have to re-enter elsewhere, but it is up to you *where* we
reenter, and you can use that fact to help straighten out some of the logic.

Furthermore, when there is a sequence of events that can bring up a sequence
of sheets in various ways according to various logic, don't forget about
contextInfo. The contextInfo that you hand in to the call to beginSheet:
comes back out in your didEnd method, so it can tell that method where to go
next. It might be some sort of carrier of state and/or even an invocation.

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

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


Re: Multiple NSTabViewItems that can't fit in a Single NSTabView

2009-01-28 Thread Raleigh Ledet

Rahul,

This is a classic sign that you really really need to rethink your UI.  
No, really, tabs are the wrong solution to your problem. I don't know  
your exact problem, so I can't tell you what is the best solution in  
your case., but a multi-line tab control is definitely not it.


Off the top of my head, BBEdit, VLC and TextMate are examples of  
different ways of allowing the user to adjust lots of preferences  
without requiring a multi-line tab control.


-raleigh

On Jan 28, 2009, at 3:00 AM, Rahulkumar wrote:


I want to display Multiple NSTabViewItems that can't fit in a Single
NSTabView. In windows, if tabview items doesn't fit in a tab then  
they are
displayed by dividing them in 2 lines. Is there anything like this  
on Mac
platform so that I can display around 10 TabViewItems in a single  
NSTabView?






Thanks



Regards,

Rahul














___

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

Please do not post admin requests or moderator comments to the list.
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 le...@apple.com


___

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

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

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

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


-finstrument-functions and program startup

2009-01-28 Thread Karan, Cem (Civ, ARL/CISD)
First off, I know this question is going to the wrong list, but I have NO idea 
which list would be best.  If anyone wants to jump in and tell me a better 
list, I'll gladly move there.

Background:
I have an application that is working very, very hard to drive me insane.  It 
is multithreaded, lazy, and has my broken attempt at trampoline code.  Now, it 
crashes once in a while, but I'm not sure what the trail of broken bits are 
that causes the crash.  If only I had a way of instrumenting every single entry 
and exit of each function, I could log it all… which is exactly what 
-finstrument-functions does.  For those of you that don't know about it, when 
you compile your code using -finstrument-functions, just after the entry point 
of each instrumented function the function __cyg_profile_func_enter() will be 
called, and __cyg_profile_func_exit() will be called just before function exit. 
 You define those functions as you wish.

The tricky part is that there are certain functions that must not be 
instrumented like that, so you need to set the attribute no_instrument_function 
on those functions.  In my case, I want to run some startup code before either 
of those methods ever get called.  I put my code into main(), but, IIRC, there 
is some function that gets called before main() does.  If that is a library 
function, I'm OK since __cyg*() won't get compiled into anything I don't have 
the source for, but if gcc is generating some code that calls __cyg*() before I 
get the chance to do the setup, I'm going to have another crash.  So, is there 
anything called before main()?  What about just before main() returns?

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 arch...@mail-archive.com

Drag and drop from NSCollectionView

2009-01-28 Thread Eric Gorr
I am going to need to the same thing (dragging one or more items from  
a NSCollectionView to some place else) and I found this old thread:


http://lists.apple.com/archives/cocoa-dev/2008/Oct/msg00104.html

Unfortunately, no clear solution was mentioned and I was wondering if  
someone might be able to point me to one.


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 arch...@mail-archive.com


Multiple Nib Question

2009-01-28 Thread Joseph Crawford

Hello Everyone,

I had my project all working smooth using 1 nib file which contained  
my MainMenu and my window.  I have since separated them because a lot  
of people suggested it.  However this separation has led me to hit an  
issue.


In my ManManu nib I have my App Delegate which then loads my window by  
instantiating the instance of my WindowController which displays the  
window.


The issue is this.  The application will copy sample files over to my  
application support directory (AppController) and also the  
SidebarController needs to be able to read this directory.  I have the  
following method in my AppController


- (NSString *)appSupportFolder {

   NSArray *paths =  
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,  
NSUserDomainMask, YES);
   NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 
0] : NSTemporaryDirectory();
   return [basePath stringByAppendingPathComponent:@"TomTom POI  
Manager"];

}

As you can see this just determines the path to the users Application  
Support folder and returns that path.


My issue is that this method is in the AppController class which is in  
my MainMenu nib.  In my MainWindow nib I have a method that is trying  
to call the above method through an outlet to AppController, however  
since AppController is in another nib I cannot make the connection.


What would be the best way to solve this issue?

My thoughts are this.

1.) duplicate code across multiple nibs (not a good idea)
2.) create a class method (not sure this is the best answer either)
3.) in AppDelegate when the [[MainWindowController alloc] init] method  
is called, call initWithAppSupportPath:path so that the window  
controller gains knowledge of the path


Are any of the above a good method to use, do you have any alternative  
suggestions?


I am familiar with encapsulation in classes but this while multiple  
nib process is new for me.
If you can suggest any reading I would be more than willing to read  
for the answer as well


Thanks,
Joseph Crawford
___

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

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

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

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


Re: Multiple Nib Question

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


On 28 Jan 2009, at 19:04, Joseph Crawford wrote:


Hello Everyone,

I had my project all working smooth using 1 nib file which contained  
my MainMenu and my window.  I have since separated them because a  
lot of people suggested it.  However this separation has led me to  
hit an issue.


In my ManManu nib I have my App Delegate which then loads my window  
by instantiating the instance of my WindowController which displays  
the window.


The issue is this.  The application will copy sample files over to  
my application support directory (AppController) and also the  
SidebarController needs to be able to read this directory.  I have  
the following method in my AppController


- (NSString *)appSupportFolder {

  NSArray *paths =  
NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,  
NSUserDomainMask, YES);
  NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 
0] : NSTemporaryDirectory();
  return [basePath stringByAppendingPathComponent:@"TomTom POI  
Manager"];

}

As you can see this just determines the path to the users  
Application Support folder and returns that path.


My issue is that this method is in the AppController class which is  
in my MainMenu nib.  In my MainWindow nib I have a method that is  
trying to call the above method through an outlet to AppController,  
however since AppController is in another nib I cannot make the  
connection.


What would be the best way to solve this issue?

My thoughts are this.

1.) duplicate code across multiple nibs (not a good idea)
2.) create a class method (not sure this is the best answer either)
3.) in AppDelegate when the [[MainWindowController alloc] init]  
method is called, call initWithAppSupportPath:path so that the  
window controller gains knowledge of the path




One solution might be to make your AppController your NSApp delegate.
As NSApp is a global singleton you will be able access your  
appController anywhere.


Are any of the above a good method to use, do you have any  
alternative suggestions?


I am familiar with encapsulation in classes but this while multiple  
nib process is new for me.
If you can suggest any reading I would be more than willing to read  
for the answer as well


Thanks,
Joseph Crawford
___

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

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

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

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


Jonathan Mitchell

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 arch...@mail-archive.com


setIntercellSpacing

2009-01-28 Thread Mr. Gecko
Hello, I'm having a problem where [self  
setIntercellSpacing:NSMakeSize(0.0, 0.0)]; will make all my rows  
disappear from the table... I need this so I can have a custom  
background for the selected rows.

How might I fix this?

Mr. Gecko
___

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

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

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

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


[SOLVED] Re: CoreData silently failing to insert?

2009-01-28 Thread Nick Zitzmann
Thanks to everyone that responded. One off-list message I received  
made me think about the problem a little more, and after some  
debugging, I realized I had a PEBKAC problem on my hands. My app does  
some fetch requests to check on existing data in the database,  
compares it to what's in a non-CD model, and deletes objects if  
certain bits of data are missing. In this case, there are several data  
structures sharing a common entity. I just didn't count on - 
executeFetchRequest: searching both the persistent store and the  
objects that were inserted but not saved. D'oh! Making the predicate  
more discriminatory worked around this, and now all is well.


Nick Zitzmann


___

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

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

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

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


(no subject)

2009-01-28 Thread David Blanton

Using this code:

NSIndexSet *is = [NSIndexSet 
indexSetWithIndex:rowIndex];   
[_tableView selectRowIndexes:is 
byExtendingSelection:YES];

to select rows, the rows are selected  and highlighted, but the first  
column is not highlighted.


Is there something else that should be done?



David Blanton




___

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

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

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

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


NStableView roe selection

2009-01-28 Thread David Blanton

oops no subject  previously, sorry.

Using this code:

NSIndexSet *is = [NSIndexSet 
indexSetWithIndex:rowIndex];   
[_tableView selectRowIndexes:is 
byExtendingSelection:YES];

to select rows, the rows are selected  and highlighted, but the first  
column is not highlighted.


Is there something else that should be done?



David Blanton


David Blanton




___

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

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

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

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


Re: Check URL Status

2009-01-28 Thread Mr. Gecko
yeah that wouldn't work for what I need, if I could just do  
NSHTTPURLResponse *response = [NSURLConnection  
responseForRequest:request]; that would work, but it's not in cocoa...


On Jan 19, 2009, at 5:39 AM, Mike Abdullah wrote:

Create a NSURLConnection for the HD URL. It will receive an  
NSHTTPURLResponse object with -statusCode 404.


Mike.

On 19 Jan 2009, at 01:20, Mr. Gecko wrote:

Hello, I'm trying to find out how I can check a URL status in  
cocoa. I have two links to videos on a server one HD and one SD.  
sometime the HD isn't there and I need my program to check for 404  
and if it has a 404 it'll revert to SD.


Thanks for tips and or help,
Mr. Gecko
___

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

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

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

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




___

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

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

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

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


Re: -finstrument-functions and program startup

2009-01-28 Thread Greg Parker

On Jan 28, 2009, at 10:33 AM, Karan, Cem (Civ, ARL/CISD) wrote:
First off, I know this question is going to the wrong list, but I  
have NO idea which list would be best.  If anyone wants to jump in  
and tell me a better list, I'll gladly move there.


Background:
I have an application that is working very, very hard to drive me  
insane.  It is multithreaded, lazy, and has my broken attempt at  
trampoline code.  Now, it crashes once in a while, but I'm not sure  
what the trail of broken bits are that causes the crash.  If only I  
had a way of instrumenting every single entry and exit of each  
function, I could log it all… which is exactly what -finstrument- 
functions does.


You'll likely get better results from dtrace than -finstrument- 
functions. DTrace can be programmed to act on function entry or exit  
for all functions in a specified file. (DTrace experts: this is your  
cue to chime in.)


Be warned that any instrumentation tool is likely to perturb your bug  
away, if it is in fact a problem with multithreading or code generation.



 For those of you that don't know about it, when you compile your  
code using -finstrument-functions, just after the entry point of  
each instrumented function the function __cyg_profile_func_enter()  
will be called, and __cyg_profile_func_exit() will be called just  
before function exit.  You define those functions as you wish.


The tricky part is that there are certain functions that must not be  
instrumented like that, so you need to set the attribute  
no_instrument_function on those functions.  In my case, I want to  
run some startup code before either of those methods ever get  
called.  I put my code into main(), but, IIRC, there is some  
function that gets called before main() does.  If that is a library  
function, I'm OK since __cyg*() won't get compiled into anything I  
don't have the source for, but if gcc is generating some code that  
calls __cyg*() before I get the chance to do the setup, I'm going to  
have another crash.  So, is there anything called before main()?   
What about just before main() returns?


+load methods and static C++ constructors are obvious examples of code  
run before main().


For testing purposes, you could add a flag that's set after your prep  
work is complete, and check it in __cyg_profile_func_enter. You could  
even do the prep work inside __cyg_profile_func_enter if the flag  
isn't set yet.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: XCode Debugger - a couple of questions from newbie

2009-01-28 Thread Scott Ribe
Try turning off lazy loading of symbols, in Xcode's preferences.

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


___

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

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

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

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


Re: setIntercellSpacing

2009-01-28 Thread Corbin Dunn

hi mr gecko,

you probably have something else wrong; the intercell spacing just  
affects the spacing between cells in the tableview. look for  
exceptions, and/or try experimenting with drawing in your cell.


corbin


Le Jan 28, 2009 à 11:44 AM, Mr. Gecko a écrit :

Hello, I'm having a problem where [self  
setIntercellSpacing:NSMakeSize(0.0, 0.0)]; will make all my rows  
disappear from the table... I need this so I can have a custom  
background for the selected rows.

How might I fix this?

Mr. Gecko
___


___

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

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

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

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


Re: setIntercellSpacing

2009-01-28 Thread Mr. Gecko
It only seemed to mess up when I resized the window. Now it seems to  
not be doing it, I don't know what I changed...


On Jan 28, 2009, at 3:30 PM, Corbin Dunn wrote:


hi mr gecko,

you probably have something else wrong; the intercell spacing just  
affects the spacing between cells in the tableview. look for  
exceptions, and/or try experimenting with drawing in your cell.


corbin


Le Jan 28, 2009 à 11:44 AM, Mr. Gecko a écrit :

Hello, I'm having a problem where [self  
setIntercellSpacing:NSMakeSize(0.0, 0.0)]; will make all my rows  
disappear from the table... I need this so I can have a custom  
background for the selected rows.

How might I fix this?

Mr. Gecko
___




___

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

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

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

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


Re: setIntercellSpacing

2009-01-28 Thread Corbin Dunn


Le Jan 28, 2009 à 1:51 PM, Mr. Gecko a écrit :

It only seemed to mess up when I resized the window. Now it seems to  
not be doing it, I don't know what I changed...


Oh, well, you forgot to mention that earlier. It may be due to  live- 
resize caching. Try subclassing the tableview, override -drawRect:,  
and call super (that's it). It disables the caching. This is an issue  
that is being worked on, but if you can reproduce a problem, *please*  
log bugs.


thanks,

corbin



On Jan 28, 2009, at 3:30 PM, Corbin Dunn wrote:


hi mr gecko,

you probably have something else wrong; the intercell spacing just  
affects the spacing between cells in the tableview. look for  
exceptions, and/or try experimenting with drawing in your cell.


corbin


Le Jan 28, 2009 à 11:44 AM, Mr. Gecko a écrit :

Hello, I'm having a problem where [self  
setIntercellSpacing:NSMakeSize(0.0, 0.0)]; will make all my rows  
disappear from the table... I need this so I can have a custom  
background for the selected rows.

How might I fix this?

Mr. Gecko
___






___

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

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

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

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


Re: NStableView roe selection

2009-01-28 Thread Corbin Dunn


Le Jan 28, 2009 à 12:43 PM, David Blanton a écrit :


oops no subject  previously, sorry.

Using this code:

NSIndexSet *is = [NSIndexSet 
indexSetWithIndex:rowIndex];   
[_tableView selectRowIndexes:is 
byExtendingSelection:YES];

to select rows, the rows are selected  and highlighted, but the  
first column is not highlighted.


Thats because you are selecting rows, not the column. What are you  
trying to do?


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 arch...@mail-archive.com


Re: Check URL Status

2009-01-28 Thread Andrew Farmer

On 28 Jan 09, at 13:15, Mr. Gecko wrote:
yeah that wouldn't work for what I need, if I could just do  
NSHTTPURLResponse *response = [NSURLConnection  
responseForRequest:request]; that would work, but it's not in cocoa...


Actually, it is. It's just named slightly differently...

NSURLConnection sendSynchronousRequest:returningResponse:error:
___

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

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

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

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


Re: Modal Sheet without Spaghetti?

2009-01-28 Thread Jan Brittenson

Jerry Krinock wrote:


Does anyone have an idiom or way of appreciating this problem which 
does not produce such spaghetti and headaches? 

How about a state machine:

enum State { STATE_INIT, STATE_PREPARE, STATE_EXECUTE, STATE_FINISHED, 
STATE_DEAD };


State state;

HandleEvent(event)
{
   switch (state) {
   case STATE_INIT:
   // initialize here
   state = STATE_PREPARE:
   // fallthru
   case STATE_PREPARE:
if (need_some_particular_state_first) { break; }
if (need_user_response)  { ask_for_it(); break; }
state = STATE_EXECUTE;
// fallthru
   case STATE_EXECUTE:
   // do stuff
   state = STATE_FINISHED; // so when display is dismissed we continue
   display_results();
   break;
   case STATE_FINISHED:
   // wrap up
   state = STATE_DEAD;
   // fallthru
   case STATE_DEAD:
   break;
   default:
assert(0);
  }
}


___

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

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

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

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


Re: Modal Sheet without Spaghetti?

2009-01-28 Thread Alex Kac
That's how we do it. Of course, we try to handle all this in the  
controllers, not in the model, so it propagates up to the controller  
from the model via a delegate or something and then we use the state  
machine there.


On Jan 28, 2009, at 4:19 PM, Jan Brittenson wrote:


Jerry Krinock wrote:


Does anyone have an idiom or way of appreciating this problem which  
does not produce such spaghetti and headaches?

How about a state machine:

enum State { STATE_INIT, STATE_PREPARE, STATE_EXECUTE,  
STATE_FINISHED, STATE_DEAD };


State state;

HandleEvent(event)
{
  switch (state) {
  case STATE_INIT:
  // initialize here
  state = STATE_PREPARE:
  // fallthru
  case STATE_PREPARE:
   if (need_some_particular_state_first) { break; }
   if (need_user_response)  { ask_for_it(); break; }
   state = STATE_EXECUTE;
   // fallthru
  case STATE_EXECUTE:
  // do stuff
  state = STATE_FINISHED; // so when display is dismissed we  
continue

  display_results();
  break;
  case STATE_FINISHED:
  // wrap up
  state = STATE_DEAD;
  // fallthru
  case STATE_DEAD:
  break;
  default:
   assert(0);
 }
}


___

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

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

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

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

"I am not young enough to know everything."
--Oscar Wilde




___

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

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

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

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


how to override all keyboard events?

2009-01-28 Thread Carlo Gulliani
Good time, everybody. I use WebView in my app, which is loading html with 
flash. I'm trying to catch keyboard events, so i added the next function to my 
NSWindow's class - (void)keyDown: (NSEvent *) event
{ NSLog(@"KEYDOWN: %@", event);
}
 
It works while i didn't press on any buttons in my flash, when i pressed on 
button in flash, my app doesn't listen keyboard events, how to solve it?

and the next question:

i override initWithContentRect method and made my app's decoration with 
styleMask: NSBorderlessWindowMask

My app has 2 buttons: "normal mode" and "fullscreen mode":

NSSizesize = [[NSScreenmainScreen] frame].size;

-(IBAction) normal_mode:(id)sender
{
win= NSMakeRect(((size.width/2) - 512), ((size.height/2) - 384), 1024, 768);
SetSystemUIMode(kUIModeNormal, 0);
[selfsetFrame:windisplay:YESanimate:YES];
}

-(IBAction) fullscreen_mode:(id)sender
{
win= NSMakeRect(0, 0, size.width, size.htight);
SetSystemUIMode(kUIModeNormal, 0);
[selfsetFrame:windisplay:YESanimate:YES];
}

it works, but i need add TitleBar with buttons(minimize, close, maximize) to my 
window while i pressing "normal mode" button. I tried add:
unsignedintstyle = (NSClosableWindowMask| NSResizableWindowMask);
[self setFrame:win display:YES animate:YES styleMask:style];

but i haven't got a result, how can i change titlebar of my app when i pressed 
any buttons?



  
___

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

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

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

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


NSTableView Grows with # of rows

2009-01-28 Thread Jason Cox

Hey guys,

Im using a tableview linked up to an array controller. I want the  
height of the tableview to grow with the # of objects in the array  
controller. Like addressbook, add  an e-mail and it just appears below  
it.


Any ideas or code samples on how to do this would be great... Perhaps  
i shouldnt use the tableview?


Thanks guys!

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 arch...@mail-archive.com


NObjective .NET <--> Objective-C bridge

2009-01-28 Thread Евгений Гришуль
Hello,

I'm happy to present a new release of NObjective bridge.
NObjective bridge to Objective-C provides the necessary classes to develop
and run .NET applications which interact with Objective-C frameworks and
libraries under Mac OS X with high performance, reliability and provides
automatically generated proxies around all Objective-C classes for Mac OS
10.4 and Mac OS 10.5.

This release brings compatibility with Mono 2.2 and provide more precise
generated method signatures.

See performance results on:
http://code.google.com/p/objcmapper

WBR,
Eugeny Grishul
___

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

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

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

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


Re: NSTextView.preferredPasteboardTypeFromArray

2009-01-28 Thread Douglas Davidson


On Jan 26, 2009, at 8:36 PM, Chris Idou wrote:

This method's list of allowedTypes when I do the drag doesn't  
include my TokenPboardType. Now if I return TokenPboardType anyway,  
it seems to work. my readSelectionFromPasteboard gets called with  
TokenPboardType and it all seems to work. But it feels like I'm  
doing the wrong thing somehow, since from the doco it sounds like  
you shouldn't return a type that is not in the allowedTypes.


Try overriding -acceptableDragTypes as well as -readablePasteboardTypes.

Douglas Davidson

___

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

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

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

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


Re: [Q] efficient or good model for send/receive with streams scheduled in runloop?

2009-01-28 Thread Shawn Erickson
On Tue, Jan 27, 2009 at 8:33 AM, JongAm Park
 wrote:

> However, I have difficulty in making it to send data and receive ack from a
> server.
> Sometimes, it receives some meaningful data about changed information from a
> server, if a client send a request to change some data.
> But sometimes it also receives ack.
> So, I would like to make it do next job after receiving an ack.

OK sounds good so make it do the next job.

> So, I embraced a send routine with a lock. But the whole client process is
> in dead-lock status, because it is not multi-threaded.
> ( a receive routine already locked. )

A lock? As in NSLock, etc.? Why do you think you need a lock here
given it isn't multi-thread and the fact that IO appears to be driven
by a runloop which will serialize access for you.

> Under this situation, is there a good network programming model or pattern?
> How should I solve this issue?

You gave us very little actionable information, we can only guess at
your implementation. You will have to provide more details and ideally
sample code.

-Shawn
___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread I. Savant

On Jan 28, 2009, at 1:50 PM, Jason Cox wrote:

Im using a tableview linked up to an array controller. I want the  
height of the tableview to grow with the # of objects in the array  
controller. Like addressbook, add  an e-mail and it just appears  
below it.



  Maybe I'm not understanding what you're trying to do, but a table  
view *already* grows with the number of items *displayed in the table  
view*.


  That the NSTableView typically comes already embedded in an  
NSScrollView (when dragged in IB) is beside the point. :-)


  If I'm not understanding, maybe a more in-depth description would  
help.


--
I.S.

___

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

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

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

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


NSMouseEntered during drag op, losing window reference

2009-01-28 Thread Luke Evans
I've been following some Apple sample code with respect to mouse  
dragging logic (within a table - but that's probably not important).
The particular approach involves maintaining full control of the drag  
state by starting a loop that processes all pertinent events until the  
mouse button is released.


By and large this works fine, you can watch and react to the events  
during the drag operation and you can dispatch events for 'normal'  
processing as necessary with:

[NSApp sendEvent:event];

Now, I need to handle dragging beyond the bounds of the originating  
view because I wish to implement auto-scrolling during the drag.  This  
actually works great using NSPeriodic events.
There's one fly in the ointment however.  When the mouse leaves the  
bounds of the view, I correctly get an NSMouseExited event from the  
tracking area that is set up.  However, when the mouse reenters the  
view/tracking area, still under drag, I get an NSMouseEntered, but the  
window is nil.  This causes grief, and is in contrast with a  
NSMouseEntered events that happen when I'm not managing the drag.


I'm wondering if I'm missing a way to lock the window as the event  
target while I'm dragging (after all, code associated with this window  
is 'in control' at this point and making decisions about the meaning  
of all mouse movement).


Various ideas for hacking a solution present themselves (after all, at  
least I'm not _missing_ the event entirely), but I'm inclined to  
believe that the source of my angst is likely correctable by more  
respectable, and/or canonical means.


Cheers

-- Luke





___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread Sean McBride
On 1/28/09 6:57 PM, I. Savant said:

>   That the NSTableView typically comes already embedded in an
>NSScrollView (when dragged in IB) is beside the point. :-)

Smiley aside, I think it's more than just 'typical'.  Unless I'm missing
some magic incantation, IB does not let you remove a tableview from its
scrollview.  No doubt it's possible programatically...

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread I. Savant

On Jan 28, 2009, at 7:15 PM, Sean McBride wrote:

Smiley aside, I think it's more than just 'typical'.  Unless I'm  
missing some magic incantation, IB does not let you remove a  
tableview from its scrollview.  No doubt it's possible  
programatically...


  Select the table (the scroll view becomes selected), then choose  
"Layout" | "Unembed Objects". Works for me.


--
I.S.


___

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

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

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

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


Detecting Initialization

2009-01-28 Thread David H. Silber
Is there some means of detecting if an instance has been initialized?

I'm thinking not.  Apple's "NSObject Class Reference" says "The init
method defined in the NSObject class does no initialization", and
googling around on the topic has not produced any means of doing so.  I
ask here in case someone has some knowledge I have not been able to
find.  Even a definitive "No" would help, as I could stop searching for
an answer which doesn't exist.

Thanks,
David

-- 
David H. Silber
___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread Sean McBride
On 1/28/09 7:26 PM, I. Savant said:

>> Smiley aside, I think it's more than just 'typical'.  Unless I'm
>> missing some magic incantation, IB does not let you remove a
>> tableview from its scrollview.  No doubt it's possible
>> programatically...
>
>   Select the table (the scroll view becomes selected), then choose
>"Layout" | "Unembed Objects". Works for me.

So it does.  Neat.  Odd that the click-and-hold that works for moving
other views around in the hierarchy does not work with the tableview.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: Check URL Status

2009-01-28 Thread Mr. Gecko
but wouldn't that return the data of the file it self as well? Because  
I don't want the data because it's like 130MB and it'll take a long  
time to get the data just for a check...


On Jan 28, 2009, at 4:12 PM, Andrew Farmer wrote:


On 28 Jan 09, at 13:15, Mr. Gecko wrote:
yeah that wouldn't work for what I need, if I could just do  
NSHTTPURLResponse *response = [NSURLConnection  
responseForRequest:request]; that would work, but it's not in  
cocoa...


Actually, it is. It's just named slightly differently...

NSURLConnection sendSynchronousRequest:returningResponse:error:


___

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

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

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

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


Re: Check URL Status

2009-01-28 Thread Andrew Farmer

On 28 Jan 09, at 16:30, Mr. Gecko wrote:
but wouldn't that return the data of the file it self as well?  
Because I don't want the data because it's like 130MB and it'll take  
a long time to get the data just for a check...


It'll return whatever response is appropriate for your request.  
Setting the HTTP method of your request to HEAD will get you what  
you're looking for.

___

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

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

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

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


Re: Detecting Initialization

2009-01-28 Thread Andrew Farmer

On 28 Jan 09, at 16:06, David H. Silber wrote:

Is there some means of detecting if an instance has been initialized?


No. However, this shouldn't ever be necessary - there should never be  
a situation where you're passing around uninitialized objects.

___

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

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

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

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


Re: Detecting Initialization

2009-01-28 Thread Graham Cox


On 29 Jan 2009, at 11:06 am, David H. Silber wrote:


Is there some means of detecting if an instance has been initialized?

I'm thinking not.  Apple's "NSObject Class Reference" says "The init
method defined in the NSObject class does no initialization", and
googling around on the topic has not produced any means of doing  
so.  I

ask here in case someone has some knowledge I have not been able to
find.  Even a definitive "No" would help, as I could stop searching  
for

an answer which doesn't exist.



The answer is no, but in order to comply with Cocoa's non-optional  
rule on this, if an instance exists, it's initialised. Otherwise  
you've made a grave error.


WAYTTD?

--Graham


___

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

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

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

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


Custom Class Bindings

2009-01-28 Thread Richard Somers

How are custom class bindings exposed to Interface Builder?

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 arch...@mail-archive.com


Re: Custom Class Bindings

2009-01-28 Thread Richard Somers

Just found my answer in Interface Builder User Guide.

"Objects with bindable properties can expose those properties in  
Interface Builder through their Interface Builder plug-in object."


"You configure bindings in Interface Builder by starting at the object  
that exposes a bindable property. Typically, this object is a Cocoa  
view or controller object, although you can also expose bindable  
properties from your own custom objects using an Interface Builder  
plug-in."


On Jan 28, 2009, at 5:49PM, Richard Somers wrote:


How are custom class bindings exposed to Interface Builder?



___

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

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

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

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


Re: Check URL Status

2009-01-28 Thread Mike Abdullah


On 29 Jan 2009, at 00:30, Mr. Gecko wrote:

but wouldn't that return the data of the file it self as well?  
Because I don't want the data because it's like 130MB and it'll take  
a long time to get the data just for a check...


Which is precisely why the URL loading system is asynchronous by  
design. You should set up the connection, wait until the NSURLResponse  
is received and then cancel the connection before it can download the  
full video file.


Mike.
___

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

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

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

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


Sub-pixel font smoothing with CGBitmapContext

2009-01-28 Thread Slava Pestov
Hi all,

When I render text into a CGBitmapContext that has been filled with a
solid color, sub-pixel font smoothing is not applied and text looks
suboptimal compared to text rendered elsewhere. How can I enable font
smoothing? Calling CGContextSetShouldSmoothFonts doesn't seem to help.

Slava
___

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

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

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

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


Plain Text UTI Madness

2009-01-28 Thread Seth Willits


I'm trying to get this NSOpenPanel to select all plain text files.  
This should be *simple* right? Sheesh. So I thought I'd use a UTI (in  
addition to some specific extensions and the HFS type 'TEXT'), so I  
added kUTTypePlainText. That really should be just dandy for my needs.


Except it's not.

I have a file without an extension, which in Finder is shown as "Plain  
text", has kMDItemKind = "Plain text", and yet kMDItemContentType is  
"public.data" -- what gives? Why is it a plain text "kind" of file,  
but not public.plain-text?


Short of allowing *any* file to be selected by this open panel, the  
only thing I can think to do is create a delegate which checks  
kMDItemContentType for the file to see if it's "Plain text". I really  
would rather not.


Can anyone offer some helpful tips?


Thanks,


--
Seth Willits


___

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

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

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

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


Re: Detecting Initialization

2009-01-28 Thread David H. Silber
On Thu, Jan 29, 2009 at 11:39:21AM +1100, Graham Cox wrote:
> 
> On 29 Jan 2009, at 11:06 am, David H. Silber wrote:
> 
> >Is there some means of detecting if an instance has been initialized?
> >
> >I'm thinking not.  Apple's "NSObject Class Reference" says "The init
> >method defined in the NSObject class does no initialization", and
> >googling around on the topic has not produced any means of doing  
> >so.  I
> >ask here in case someone has some knowledge I have not been able to
> >find.  Even a definitive "No" would help, as I could stop searching  
> >for
> >an answer which doesn't exist.
 
> 
> The answer is no, but in order to comply with Cocoa's non-optional  
> rule on this, if an instance exists, it's initialised. Otherwise  
> you've made a grave error.
> 
> WAYTTD?

I was hoping to be able to write a unit test which would confirm that an
object had been properly initialized.

Thanks,
David

-- 
David H. Silber
___

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

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

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

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


Re: Plain Text UTI Madness

2009-01-28 Thread Sean McBride
Seth Willits (sli...@araelium.com) on 2009-01-28 8:56 PM said:

>I'm trying to get this NSOpenPanel to select all plain text files.
>This should be *simple* right? Sheesh. So I thought I'd use a UTI (in
>addition to some specific extensions and the HFS type 'TEXT'), so I
>added kUTTypePlainText. That really should be just dandy for my needs.
>
>Except it's not.
>
>I have a file without an extension, which in Finder is shown as "Plain
>text", has kMDItemKind = "Plain text", and yet kMDItemContentType is
>"public.data" -- what gives? Why is it a plain text "kind" of file,
>but not public.plain-text?

Does this extension-less file have an HFS type?

If not, UTIs won't help you.  The OS currently derives a file's UTI by
examining:
 a) its extension
 b) its HFS type
 c) its MIME type

Note the HFS creator is not consulted, nor is the file's contents.

So if you have no extension and no HFS type, I dunno which UTI you'll
get.  Probably public.data, from what you say.

"Plain Text" seems to be the Finder's catch all.  Try this: 'touch /
foo', then Get Info on that file.  It's "Plain Text".

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 arch...@mail-archive.com


Re: setIntercellSpacing

2009-01-28 Thread Mr. Gecko

found out, I forgot to run -reloadData

On Jan 28, 2009, at 4:02 PM, Corbin Dunn wrote:



Le Jan 28, 2009 à 1:51 PM, Mr. Gecko a écrit :

It only seemed to mess up when I resized the window. Now it seems  
to not be doing it, I don't know what I changed...


Oh, well, you forgot to mention that earlier. It may be due to  live- 
resize caching. Try subclassing the tableview, override -drawRect:,  
and call super (that's it). It disables the caching. This is an  
issue that is being worked on, but if you can reproduce a problem,  
*please* log bugs.


thanks,

corbin



On Jan 28, 2009, at 3:30 PM, Corbin Dunn wrote:


hi mr gecko,

you probably have something else wrong; the intercell spacing just  
affects the spacing between cells in the tableview. look for  
exceptions, and/or try experimenting with drawing in your cell.


corbin


Le Jan 28, 2009 à 11:44 AM, Mr. Gecko a écrit :

Hello, I'm having a problem where [self  
setIntercellSpacing:NSMakeSize(0.0, 0.0)]; will make all my rows  
disappear from the table... I need this so I can have a custom  
background for the selected rows.

How might I fix this?

Mr. Gecko
___








___

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

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

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

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


Re: NSView behaves different on 10.4 vs 10.5?

2009-01-28 Thread Adam Gerson
According to the documentation its not exactly recommended to use them
in 10.5 either, even though it appears to draw just fine in 10.5. If
my client wants to keep overlapping sibling views to save the time of
refactoring is this a terrible idea if he only plans to support 10.5+?

"For performance reasons, Cocoa does not enforce clipping among
sibling views or guarantee correct invalidation and drawing behavior
when sibling views overlap."

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/WorkingWithAViewHierarchy/chapter_5_section_5.ht

Thanks,
Adam

On Mon, Jan 19, 2009 at 10:40 PM, Jim Correia  wrote:
> On Jan 19, 2009, at 10:36 PM, Adam Gerson wrote:
>
>> The cards in the hand are drawn overlapping.
>
> [...]
>
>> Could anyone shed some slight on what could be occurring?
>
> Overlapping sibling views are supported on 10.5 and later.
>
> If you need to support 10.4, you'll have to use a different strategy for
> your cards.
>
> - Jim
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/agersonl%40gmail.com
>
> This email sent to agers...@gmail.com
>
___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread I. Savant

On Jan 28, 2009, at 7:24 PM, Sean McBride wrote:

So it does.  Neat.  Odd that the click-and-hold that works for  
moving other views around in the hierarchy does not work with the  
tableview.


  Very odd. First thing I noticed when I double-checked my assertions  
when I saw your message. :-) I'm surprised this is the case but I must  
admit it's the first I've tried it directly (I'm too used to IB 2 -  
the "*old* new Interface Builder").


  Enhancement request ... ;-)

--
I.S.

___

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

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

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

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


Re: NSView behaves different on 10.4 vs 10.5?

2009-01-28 Thread Jim Correia

On Jan 28, 2009, at 9:44 PM, Adam Gerson wrote:


According to the documentation its not exactly recommended to use them
in 10.5 either, even though it appears to draw just fine in 10.5. If
my client wants to keep overlapping sibling views to save the time of
refactoring is this a terrible idea if he only plans to support 10.5+?

"For performance reasons, Cocoa does not enforce clipping among
sibling views or guarantee correct invalidation and drawing behavior
when sibling views overlap."


It is my understanding that this piece of documentation is out of  
date, and that on 10.5 and later overlapping sibling views are fully  
supported.


I have filed a bug requesting that the documentation be updated/ 
corrected.


Jim
___

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

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

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

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


Re: Multiple Nib Question

2009-01-28 Thread Jonathan Hess

- (NSString *)appSupportFolder {

  NSArray *paths = NSSearchPathForDirectoriesInDomains 
(NSApplicationSupportDirectory, NSUserDomainMask, YES);
  NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 
0] : NSTemporaryDirectory();
  return [basePath stringByAppendingPathComponent:@"TomTom POI  
Manager"];

}


This method doesn't appear to use self or any of self's state. You  
could make it a regular C function instead of a method of the app  
delegate.


Jon Hess
___

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

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

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

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


Re: NSTableView Grows with # of rows

2009-01-28 Thread Jonathan Hess


On Jan 28, 2009, at 4:24 PM, Sean McBride wrote:


On 1/28/09 7:26 PM, I. Savant said:


Smiley aside, I think it's more than just 'typical'.  Unless I'm
missing some magic incantation, IB does not let you remove a
tableview from its scrollview.  No doubt it's possible
programatically...


 Select the table (the scroll view becomes selected), then choose
"Layout" | "Unembed Objects". Works for me.


So it does.  Neat.  Odd that the click-and-hold that works for moving
other views around in the hierarchy does not work with the tableview.


Interface Builder 3.1 and later no longer have the click+hold+drag  
gesture to move views in the hierarchy. Instead you can just use  
normal drag and drop.


The reason you can't drag a table view out of a scroll view isn't a  
limitation of the table view. Instead, its that the scroll view is  
required to have a document view.


Jon Hess



--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to jh...@apple.com


___

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

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

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

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


Re: Detecting Initialization

2009-01-28 Thread Stuart Malin


On Jan 28, 2009, at 4:46 PM, cocoa-dev-requ...@lists.apple.com wrote:



On Thu, Jan 29, 2009 at 11:39:21AM +1100, Graham Cox wrote:


On 29 Jan 2009, at 11:06 am, David H. Silber wrote:

Is there some means of detecting if an instance has been  
initialized?


I'm thinking not.  Apple's "NSObject Class Reference" says "The init
method defined in the NSObject class does no initialization", and
googling around on the topic has not produced any means of doing
so.  I
ask here in case someone has some knowledge I have not been able to
find.  Even a definitive "No" would help, as I could stop searching
for
an answer which doesn't exist.




The answer is no, but in order to comply with Cocoa's non-optional
rule on this, if an instance exists, it's initialised. Otherwise
you've made a grave error.

WAYTTD?


I was hoping to be able to write a unit test which would confirm  
that an

object had been properly initialized.


I have written unit tests that confirm/validate object initialization.  
The ones I have written use accessors to gain then test (via  
assertion) the value of properties that should be initialized. When I  
have multiple initializers, I unit test them individually. Of course,  
if there is a failure in the accessors, these unit tests will indicate  
that the object isn't properly initialized, but still, catching bugs  
is what unit testing is all about. If you are just looking to ensure  
that the object was created at all, you can assert that it is not nil.  
You can, for instance, create assertions that invoke methods on the  
object (say, if you want to confirm its Class).   What specifically  
about the object's initialization are you wanting to confirm?


___

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

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

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

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


Setting cocoa application in system menu bar.

2009-01-28 Thread Vijay Kanse
Hello,
I need my application to set in system menu bar.
I am able to set in menu bar. and i am getting all the events associated
with application click menu.
I stetted two click events on menu bar. openWindow and quit. on click of
openWindow I am loading nib file. this nib contains multiple windows.

-(void)openWIndow:(id)sender
{
  [NSApplication sharedApplication];
  [NSApp setDelegate:self];
  [NSBundle loadNibNamed:"MainMenu" owner:self];
}

it is only showing the windows which has mark true visible at launch in IB.
and other window is showing their address 0x00 at a time of debugging. that
means all the windows are not
initialized.
I am taking reference from:
http://th30z.netsons.org/2008/10/cocoa-system-statusbar-item-aka-traybar/


Thanks.
___

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

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

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

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


URL Parsing

2009-01-28 Thread Seth Willits


I can put together my own solution, but I'm *sure* there has to be  
some real way of doing this built-in *somewhere*, so I have to ask...


My app has a URL handler, and I want the user to be able to click a  
link to save some time to things. The URL would have the form:
myapp://action?key1=valueNoSpaces&key2=value+with+space&key3=value+with 
%0Apercent%0Aescapes


Does anyone know of a couple of methods that can simply grab the  
action and KV pairs decoded without a lot of hassle?



Thanks,

--
Seth Willits



___

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

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

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

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


Re: Multiple Nib Question

2009-01-28 Thread Michael Ash
On Wed, Jan 28, 2009 at 2:04 PM, Joseph Crawford  wrote:
> Hello Everyone,
>
> I had my project all working smooth using 1 nib file which contained my
> MainMenu and my window.  I have since separated them because a lot of people
> suggested it.  However this separation has led me to hit an issue.
>
> In my ManManu nib I have my App Delegate which then loads my window by
> instantiating the instance of my WindowController which displays the window.
>
> The issue is this.  The application will copy sample files over to my
> application support directory (AppController) and also the SidebarController
> needs to be able to read this directory.  I have the following method in my
> AppController
>
> - (NSString *)appSupportFolder {
>
>   NSArray *paths =
> NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
> NSUserDomainMask, YES);
>   NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] :
> NSTemporaryDirectory();
>   return [basePath stringByAppendingPathComponent:@"TomTom POI Manager"];
> }
>
> As you can see this just determines the path to the users Application
> Support folder and returns that path.
>
> My issue is that this method is in the AppController class which is in my
> MainMenu nib.  In my MainWindow nib I have a method that is trying to call
> the above method through an outlet to AppController, however since
> AppController is in another nib I cannot make the connection.
>
> What would be the best way to solve this issue?
>
> My thoughts are this.
>
> 1.) duplicate code across multiple nibs (not a good idea)
> 2.) create a class method (not sure this is the best answer either)
> 3.) in AppDelegate when the [[MainWindowController alloc] init] method is
> called, call initWithAppSupportPath:path so that the window controller gains
> knowledge of the path

Door #3 is the correct approach IMO, although it should simply be
-initWithPath:. The fact that you're saving to the App Support
directory should not influence the bulk of your program. Write it all
to accept arbitrary paths, then just hand it the App Support path from
the main controller at the beginning of your program. This makes your
design cleaner overall, especially if you should later change your
mind about where stuff should go.

In general, as much as possible, pass data around as parameters (or
obtain it from callbacks) rather than looking it up globally. It makes
your code more modular and cleaner.

Mike
___

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

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

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

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


Re: Detecting Initialization

2009-01-28 Thread Michael Ash
On Wed, Jan 28, 2009 at 8:48 PM, David H. Silber  wrote:
> On Thu, Jan 29, 2009 at 11:39:21AM +1100, Graham Cox wrote:
>>
>> On 29 Jan 2009, at 11:06 am, David H. Silber wrote:
>>
>> >Is there some means of detecting if an instance has been initialized?
>> >
>> >I'm thinking not.  Apple's "NSObject Class Reference" says "The init
>> >method defined in the NSObject class does no initialization", and
>> >googling around on the topic has not produced any means of doing
>> >so.  I
>> >ask here in case someone has some knowledge I have not been able to
>> >find.  Even a definitive "No" would help, as I could stop searching
>> >for
>> >an answer which doesn't exist.
>
>>
>> The answer is no, but in order to comply with Cocoa's non-optional
>> rule on this, if an instance exists, it's initialised. Otherwise
>> you've made a grave error.
>>
>> WAYTTD?
>
> I was hoping to be able to write a unit test which would confirm that an
> object had been properly initialized.

What counts as "initialized" depends entirely on the class in question.

NSObject does nothing in its initializer. As a consequence, an
NSObject instance is fully initialized as soon as it comes back from
+alloc, and stays that way until it is destroyed. There's no way to
have an uninitialized NSObject instance.

For your classes, you get to decide what counts as initialized. Do you
want to check for certain necessary bits of state? Do you want to just
set an "initialized" flag that you check? It's all up to you. Keep in
mind that an allocated but uninitialized object has its instance
variables filled with zero, that will help you to identify that state.

Mike
___

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

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

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

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


Formatting Core Data Conflict List

2009-01-28 Thread Steve Steinitz

Hello,

I'm trying to track down the cause of hundreds of optimistic 
locking errors in a multi-user core data application.  A clue 
might be found in the core data conflict list.  However, its a 
format that I don't recognize and find difficult to read.  Does 
anyone know a way to display it nicely, i.e. indented so as to 
show the nesting or in some kind of outline view?  I tried 
property list editor and xCode to no avail.


I've pasted a sample below (please don't quote the whole thing 
in any replies)


Thanks,

Steve


Conflict List:
(
{
cachedRow = {
archivedBalance = 1065;
archivedTotal = ;
bikesDiscount = ;
closed = 0;
customer = ;
date = 2009-01-27 17:32:00 +1100;
deleted = ;
discount = ;
generalSale = ;
invoiceNumber = 32;
notes = ;
otherDiscount = ;
pending = 0;
salesPerson = 0x1331a00 
;
};
newVersion = 13;
object =  (entity: Sale; id: 0x12deff0 
 ; 
data: {

archivedBalance = 466;
archivedTotal = nil;
bikes = (
0x137ab00 
);
bikesDiscount = nil;
closed = 0;
customer = nil;
date = 2009-01-27 17:32:00 +1100;
deleted = nil;
discount = nil;
generalSale = nil;
invoiceNumber = 32;
lineItems = (
0x1379fe0 

);
notes = nil;
otherDiscount = nil;
payments = (
);
pending = 1;
riskPoints = (
);
salesPerson = 0x13454f0 
;
});
oldVersion = 11;
snapshot = {
archivedBalance = 466;
archivedTotal = ;
bikes = {(
 (entity: Bike; id: 0x137ab00 
 ; 
data: {

assembled = 0;
assembler = nil;
campaignModel = nil;
cost = 0;
mold = 0x12e0640 
;
notes = nil;
received = 1;
sale = 0x12deff0 
;
salePrice = 450;
serialNumber = TYUT;
})
)};
bikesDiscount = ;
closed = 0;
customer = ;
date = 2009-01-27 17:32:00 +1100;
deleted = ;
discount = ;
generalSale = ;
invoiceNumber = 32;
lineItems = {(
 (entity: LineItem; id: 
0x1379fe0 
 
; data: {

applyDiscount = 0;
campaignModel = nil;
notes = Bottle;
product = 0x135c760 
;
quantity = 1;
sale = 0x12deff0 
;
salePrice = 16;
})
)};
notes = ;
otherDiscount = ;
payments = {(
)};
pending = 0;
riskPoints = {(
)};
salesPerson = na Mary Wonderful;
};
},
{
cachedRow = {
archivedBalance = 0;
archivedTotal = ;
bikesDiscount = ;
closed = 0;
customer = ;
date = 2009-01-27 17:21:44 +1100;
deleted = ;
discount = ;
generalSale = ;
invoiceNumber = 30;
notes = ;
otherDiscount = ;
pending = 0;
salesPerson = 0x13271d0 
;
};
newVersion = 21;
object =  (entity: Sale; id: 0x12ea530 
 ; 
data: {

archivedBalance = 0;
archivedTotal = nil;
bikes = (
);
bikesDiscount = nil;
closed = 0;
customer = nil;
date = 2009-01-27 17:21:44 +1100;
deleted = nil;
discount = nil;
generalSale = nil;
invoiceNumber = 30;
lineItems = (
0x1379fb0 
,
0x1379fa0 
,
0x1379fd0 
,
0x1379fc0 

);
notes = nil;
otherDiscount = nil;
payments = (
);
pending = 0;
riskPoints = (
0x12ca8d0 
,
0x12c90d0 

);
salesPerson = 0x12e34e0 
;
});
oldVersion = 20;
snapshot = {
archivedBalance = 0;
archivedTotal = ;
bikes = {(
)};
bikesDiscount = ;
closed = 0;
customer = ;
date = 2009-01-27 17:21:44 +1100;
deleted = ;
discount = ;
generalSale = ;
invoiceNumber = 30;
lineItems = {(
 (entity: LineItem; id: 
0x1379fb0 
 
; data: {

applyDiscount = 0;
campaignModel = nil;
notes = "M Pink";
product = 0x12e9df0 
;
quantity = -1;
sale = 0x12ea530 
;
salePrice = 0;
}),
 (entity: LineItem; id: 
0x1379fa0 
 
; data: {

applyDiscount = 0;
campaignModel = nil;
notes = "M Pink";
product = 0x12e9df0 
;
quantity = 1;
sale = 0x12ea530 
;
salePrice = 0;
}),
 (entity: LineItem; id: 
0x1379fd0 
 
; data: {

applyDiscount = 0;
campaignModel = nil;
notes = "XL Pink";
product = 0x12e0640 
;
quantity = -1;
sale = 0x12ea

Apple Events and Modal Sessions

2009-01-28 Thread Seth Willits


I'm fiddling with a URL handler in my app and I noticed that if a  
modal session was running, the handler - registered with my NSApp's  
delegate - was not being called, even after the dialog closed. I  
looked around the docs for a bit to find a reason/workaround and  
discovered by chance that if I simply made the window's controller  
object the AE handler, then it worked; when the dialog is open, the  
handler is called. If the AE handler is NSApp's delegate, it doesn't.


I can't figure out *why* this happening though. All I do is call  
[NSApp runModalForWindow:window], so it's not as if the controller  
object is the delegate of the modal session and thus somehow something  
behind the scenes lets AEs fire. The controller isn't even the  
delegate of the window.


Does anyone know what's really going on here? Should AppleEvents  
always be firing during a modal session?



--
Seth Willits



___

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

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

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

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


Re: Apple Events and Modal Sessions

2009-01-28 Thread Seth Willits

On Jan 28, 2009, at 9:50 PM, Seth Willits wrote:

Does anyone know what's really going on here? Should AppleEvents  
always be firing during a modal session?


Call me a fool on this one. I didn't realize my AppleEvent handler was  
being set up after the call to runModal, thus it never would have  
worked. Silly me. I spent 20+ minutes trying to figure this out, and  
of course I figured it out 30 seconds after I emailed the list. :-p




--
Seth Willits



___

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

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

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

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


want to get position of Statusmenu item in menubar

2009-01-28 Thread Gami Ravi
Hi All,

I created one NSStatusMenuItem and i am displaying it to Menubar.I want to get 
position of that item in screen coordinates.

How can i get that position of that item?

Pleasle suggest. Any pointer should be appreciated.

Thanks & Regards,
R.

--
_
Disclaimer: This e-mail message and all attachments transmitted with it
are intended solely for the use of the addressee and may contain legally
privileged and confidential information. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution, copying, or other use of
this message or its attachments is strictly prohibited. If you have
received this message in error, please notify the sender immediately by
replying to this message and please delete it from your computer. Any
views expressed in this message are those of the individual sender
unless otherwise stated.Company has taken enough precautions to prevent
the spread of viruses. However the company accepts no liability for any
damage caused by any virus transmitted by this email.
__

___

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

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

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

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


Re: How to draw text with fade out effect?

2009-01-28 Thread Kyle Sluder
On Wed, Jan 28, 2009 at 10:57 AM, Thomas Davie  wrote:
> This solution will also throw sub-pixel anti-aliasing in the bin.

Perhaps the better solution is to draw the text as normal and then
re-draw the background with the appropriate alpha on top.

--Kyle Sluder
___

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

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

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

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


Re: How to draw text with fade out effect?

2009-01-28 Thread Quincey Morris

On Jan 28, 2009, at 22:32, Kyle Sluder wrote:

On Wed, Jan 28, 2009 at 10:57 AM, Thomas Davie   
wrote:

This solution will also throw sub-pixel anti-aliasing in the bin.


Perhaps the better solution is to draw the text as normal and then
re-draw the background with the appropriate alpha on top.


OK, I'll be the killjoy.

Perhaps the even better solution is not to spend the time on doing the  
fading at all.


The notable case (AFAIK) of using this text-fades-out effect is in  
path controls, where its function seems to be not so much to look cool  
(although it *does* look cool), but to indicate to the user that there  
is more text *that can be revealed by mousing over the incomplete  
text*. The reveal itself is an even cooler animation involving stuff  
sliding as well as fading in.


If the OP is intending to provide the text-reveal animation too,  
there's more coding to do than just getting a sub-pixel-anti-aliased  
text fade to look right. If it serves no functional purpose (like it  
does in the path control), then maybe it's not such a great idea.


Compare the path control metaphor to the table view metaphor.  
Truncated text in a table view column typically gets fadeless  
truncation and a "...", and the full text reveal is a tool-tip-style  
overlay, not an animation.


So what's the correct UI metaphor in the OP's scenario? Perhaps not  
fading after all.


FWIW


___

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

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

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

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


bind right part of NSPredicateEditor's row to array of strings

2009-01-28 Thread Vitaly Ovchinnikov
Hello all,

Still have problems with predicate editor. My items have tags and I
want to be able to filter items by those tags. My document has array
of all tags, so I added a row template with three popup buttons and
wanted to bind the third one to that array. I tried the following:

NSPopUpButton *pTagsCombo = [[pRowTemplateTags templateViews] objectAtIndex:2];
[pTagsCombo bind:@"contentValues" toObject:self
withKeyPath:@"document.tags" options:0];

but received errors. If I clear "Constant Values" field in IB for that
row, I receive:
In , different number of items (2) than
predicate template views (3) for template


that means that popup is empty. If I add some values to constants
field in IB, I get these:
In  with template
, we were not
able to find a popup item at view index 2 with title ib_const_1.
Available items are: (
,
,

)

To make sure about binding, I added a simple NSPopupButton near the
predicate editor and bound it using the same code - it works fine.

Next idea was that predicate editor clones it's rows and my binding
doesn't work for the clone. I subclassed NSPredicateEdtiorRowTemplate
and override -copyWithZone, so it just retains itself without any
copying. That's not a correct thing, but good enough to make just one
test. This didn't help - I got the same error as before ("we were not
able to find a popup item...").

Now ideas are over and I want to ask you: how the hell can I show a
list of my tags in the right popup?
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 arch...@mail-archive.com


one more NSPredicateEditor question

2009-01-28 Thread Vitaly Ovchinnikov
Hello once again, just a quick question:

It seems that predicate editor remains what right view was used for
each operation. If I add a row with numeric parameter and two
operators (less and greater) and then switch between them - predicate
editor will "remember" value I entered for "less" and when I switch to
"greater" it will show "it's" value. And vise versa.

How to get rid of this? I want to keep the value I entered while
switching between operators?
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 arch...@mail-archive.com