Re: Extract Text From NSLabels to Mail

2010-09-19 Thread PJBorges
I got it to work Ken. Your last input helped a lot. Thanks for
explaining it to me. Made it more clear.

I don't know why I got the previous error. But it's gone now. It
occurred whenever I pressed the button that opens Mail. Obviously, the
error relates to my old faulty code.

For anyone who stumbles into the same problem this code extracts the
contents of multiple labels and a textview and inserts them into Mail:

NSString* content = [NSString stringWithFormat:@"%...@\n%@\...@\n%@\...@\n%@
\...@\n\n", [[self.messageContent textStorage] string],[self.sumBooks
stringValue], [self.sumBrochures stringValue], [self.sumMagazines
stringValue]];

// create a new outgoing message object. The @"content" string refers
to the text area where you write the actual email
MailOutgoingMessage *emailMessage =
[[[mail classForScriptingClass:@"outgoing message"] alloc]
 initWithProperties:
 [NSDictionary dictionaryWithObjectsAndKeys:[self.subjectField
stringValue], @"subject", content, @"content", nil]];

Look at the SBSendEmail project from Apple on how to implement send
mail from your app to Mail. Be sure to read the ReadMe file.
http://developer.apple.com/library/mac/#samplecode/SBSendEmail/Introduction/Intro.html

--Philip
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSImage

2010-09-19 Thread koko
 I have never done what I am asking about and don't want to go down  
the wrong path and waste time.


I want to display images in a view (call it the tool box), drag the  
images around and place them where the mouse goes up.


The images are also to be dragged from the tool box to another view  
(call it layout) and dropped


In the layout view I want to drag the images around and place them  
where the mouse goes up as well as rotate them via some mouse move.



So I thought I would draw the images as subclasses of NSImage in the  
tool box.  Use mouseDown and mouseMoved to move them around the tool  
box.


Use drag and drop to go from the tool box to the layout and then  
mouseDown and mouseMoved to reposition and reorient them in the layout.


Am I on the right track or is there something even easier?

-koko
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSImage

2010-09-19 Thread Erik Buck

On Sep 19, 2010, at 12:36 PM, k...@highrolls.net wrote:

> 
> Am I on the right track or is there something even easier?
> 

IMHO, No.

Please explain why you would subclass NSImage to accomplish any of your goals.  
I suspect that the effort of making that explanation will be insightful.  Hint: 
"has-a" vs. "is-a"

What you want was called a "palette" in the original Interface Builder in 1988 
and remained in vogue for 20 years or so until the invention of "libraries" in 
a recent update.  You can still see a palette in Microsoft Visio which copied 
Diagram which copied the idea from Interface Builder.  A quick search 
identified an interesting get-started tutorial that I just skimmed: 
http://cocoadevcentral.com/articles/56.php


___

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

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

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

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


NSSplitView with multiple dividers

2010-09-19 Thread Geoffrey Holden
I am trying to set up a window with three resizable panes.  Currently,  
I have done this by dragging an NSSplitView into my window (in IB) and  
then dragging another NSSplitView into that:


+NSSplitView
|--+NSView
|  '-NSTableView
|
|--+NSView
|  '-NSSplitView
|

Having done this, I am trying to constrain the minimum and maximum  
sizes for each pane.  Whilst Googling, I came across the following  
tutorial on the excellent Cocoa with Love site http://cocoawithlove.com/2009/09/nssplitview-delegate-for-priority-based.html


I used the following code (taken from the tutorial) and it worked  
perfectly - but only for the left hand pane.  I suspect that this  
might be because I don't have an NSSplitView with three sections.  My  
question is, how can I set up an NSSplitView with three sections?  Can  
I do it in IB or do I need to do it programatically?  If My nested  
NSSplitView is correct way of creating a three section splitview, how  
can I make the code work?



- (CGFloat)splitView:(NSSplitView *)sender
constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt: 
(NSInteger)offset

{
NSView *subview = [[sender subviews] objectAtIndex:offset];
NSRect subviewFrame = subview.frame;
CGFloat frameOrigin;
if ([sender isVertical])
{
frameOrigin = subviewFrame.origin.x;
}
else
{
frameOrigin = subviewFrame.origin.y;
}

CGFloat minimumSize =
[[lengthsByViewIndex objectForKey:[NSNumber  
numberWithInteger:offset]]

doubleValue];

return frameOrigin + minimumSize;
}



I daresay that the example project on CocoawithLove might answer my  
queries - but, since it doesn't seem to download, I'm resorting to  
asking the experts.


Thank you for your time.
___

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

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

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

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


Re: NSSplitView with multiple dividers

2010-09-19 Thread jonat...@mugginsoft.com

On 19 Sep 2010, at 18:14, Geoffrey Holden wrote:

> I am trying to set up a window with three resizable panes.  Currently, I have 
> done this by dragging an NSSplitView into my window (in IB) and then dragging 
> another NSSplitView into that:
> 
> +NSSplitView
> |--+NSView
> |  '-NSTableView
> |
> |--+NSView
> |  '-NSSplitView
> |
> 
I too did exactly the same the first time I tried this. But the solution is 
much easier.
In IB just draw another custom view onto the bottom or left edge of the 
NSSplitView.
A red line will appear to indicate that you have hit the sweet spot.
Drop the view and it will create another pane within the splitview.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
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: NSSplitView with multiple dividers

2010-09-19 Thread Kyle Sluder
On Sep 19, 2010, at 11:55 AM, "jonat...@mugginsoft.com" 
 wrote:

> 
> On 19 Sep 2010, at 18:14, Geoffrey Holden wrote:
> 
>> I am trying to set up a window with three resizable panes.  Currently, I 
>> have done this by dragging an NSSplitView into my window (in IB) and then 
>> dragging another NSSplitView into that:
>> 
>> +NSSplitView
>> |--+NSView
>> |  '-NSTableView
>> |
>> |--+NSView
>> |  '-NSSplitView
>> |
>> 
> I too did exactly the same the first time I tried this. But the solution is 
> much easier.
> In IB just draw another custom view onto the bottom or left edge of the 
> NSSplitView.
> A red line will appear to indicate that you have hit the sweet spot.
> Drop the view and it will create another pane within the splitview.
> 

It might be easier to drop the new view onto the split view in the document 
window (in tree mode).

NSSplitView puts splitters between all of its subviews. You only need to embed 
a split view in another if you want to have both vertical and horizontal splits.

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


What's the point of @properties?

2010-09-19 Thread Jim Thomason
I'm refactoring and updating a lot of my older code, and one of the
things I'm finally looking into is declaring things as properties.

But...what's the point? I've been trying to read up on the subject and
have found a lot of posts and discussion about the subject, but very
little of it seems to get down to the meat of what these things are
and why I should care about them.

At the simplest level, I just look at them as some syntactic sugar. So
I get to write one @property line in my @interface and one @synthesize
line in my @implementation (assuming no more complicated behavior, of
course). So it's nifty in that I save myself a lot of redundant
typing, but realistically? I could accomplish the same thing with a
preprocessor macro and have more fine grained control over exactly how
my generated methods look. I mean, it's cool and all that it's built
in and saves me from writing my own macro, but realistically this
isn't terribly interesting.

I know I'd get use of the dot syntax (I do need to use @properties to
do that, right?), but I'm eschewing it anyway. Again, I've seen all
sorts of arguments about people disliking it because it's not
objective-Cish or confusion about structs or whatever, but for me, I
simply just don't care to use it. I've got lots of existing code that
uses methods and I don't see any reason to update. I'm just a stick in
the mud sometimes.

So basically, I get a language built-in version of a macro, and an
option to use a new syntax that I'm not interested in anyway.

Is there something else I'm not seeing or some other utility to them
that I don't yet understand?

-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: Linked List

2010-09-19 Thread Daniel DeCovnick
On Sep 18, 2010, at 4:53 PM, Sherm Pendley wrote:

> On Sat, Sep 18, 2010 at 7:36 PM, Fritz Anderson  
> wrote:
>> On 18 Sep 2010, at 6:09 PM, k...@highrolls.net wrote:
>> 
>>> What is the Cocoa equivalent of a doubly linked list? Should I consider 
>>> NSMutablearray as the analog?
>> 
>> Yes.
>> 
>> The Foundation data types are distinguished by what they _are_ (ordered 
>> collections, unordered collections, dictionaries, strings, dates, data 
>> buffers) and not how they are _implemented._ Foundation is free to select 
>> any of a number of internal implementations for those generic forms. In 
>> fact, it may _change_ the implementation of your collections behind your 
>> back, to preserve performance as the collections grow.
>> 
>> There's no "doubly-linked list" because you don't really want a 
>> doubly-linked list, you want an ordered collection.
> 
> Can't say I agree with that 100%. It's true for simple iteration, but
> a linked list also has other performance characteristics that an array
> does not - the ability to remove and/or insert items at any position
> in constant time, for example.

CFMutableArray does this when there are more than 300,000 elements in the 
array. In fact, all operations start taking constant time (though some are 
fairly slow) when you reach 300,000 elements, and it's position-independent at 
that point (hit 300k, and there are no longer any favored insertion positions, 
including within the first 300k). Take a look at the graphs here:

http://ridiculousfish.com/blog/archives/2005/12/23/array/#fish_made_a_mess

-Daniel
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: What's the point of @properties?

2010-09-19 Thread Markus Spoettl
On Sep 19, 2010, at 3:52 PM, Jim Thomason wrote:
> I'm refactoring and updating a lot of my older code, and one of the
> things I'm finally looking into is declaring things as properties.
> 
> But...what's the point? 
> [...]
> Is there something else I'm not seeing or some other utility to them
> that I don't yet understand?


One thing you get is automatic KVO change notifications. When you set a 
property through its setter, you don't have to use -willChangeValueForKey: and 
-didChangeValueForKey: in order to trigger -observeValueForKeyPath: messages 
for those objects observing the property (via -addObserver:).

Regards
Markus
--
__
Markus Spoettl

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: What's the point of @properties?

2010-09-19 Thread Bill Bumgarner

On Sep 19, 2010, at 1:11 PM, Markus Spoettl wrote:

> One thing you get is automatic KVO change notifications. When you set a 
> property through its setter, you don't have to use -willChangeValueForKey: 
> and -didChangeValueForKey: in order to trigger -observeValueForKeyPath: 
> messages for those objects observing the property (via -addObserver:).

You'd get that anyway.

The point of @property was to capture getters and setters into a single 
syntactic unit such that it is easy to see exactly what should be treated as a 
property/attribute/data-thingy on any given class. But not just that the 
set/get methods exist, but:

- the memory management policy is now declarative in the interface
- atomic vs. nonatomic is declarative
- setter/getter can be mapped to other methods (getter=isEnabled, for example)
- synthesis "just works" (pretty much every attempt at hand-rolled atomicity 
I've seen has been wrong or bog slow)
- the IDE can deduce additional details of your code based on declaration 
(code-sense prefers properties on the RHS of a dot, for example)
- minimize lines of code

That last point has been achieved in stages.   In the move to the modern 
Objective-C 2.0 ABI (the runtime you get on iPhone and 64 bit Mac OS X), you 
don't need to declare iVars for @property()s as the compiler will synthesize 
the storage, too.   In llvm 2.0 top-of-tree, @synthesize is on by default for 
all @properties.

Thus, with the latest bleeding edge compiler, all you need is the @property() 
(and cleanup in -dealloc) to declare a fully KVO compliant attribute of your 
class.

The dot is syntactic convenience and pretty much nothing more.   The dot does 
enforce more compiler checking than regular method invocations, though (can't 
use dot w/id and the compiler will whine if you use the dot in a non 
setter/getter role).

b.bum
(Who is still on the fence as to whether the dot was a good idea;  it sure does 
cause confusion, but damned if it isn't awfully convenient.  Sigh.)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: What's the point of @properties?

2010-09-19 Thread Ken Thomases
On Sep 19, 2010, at 2:52 PM, Jim Thomason wrote:

> I know I'd get use of the dot syntax (I do need to use @properties to
> do that, right?)

No.  Dot syntax is syntactic sugar for invoking accessors.  The accessor do not 
have to be related to a declared property (i.e. @property).  Dot syntax works 
will plain old hand-rolled accessors.

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


DemoMonkey services MIA

2010-09-19 Thread Matt Neuburg
I downloaded and built the DemoMonkey example and created a document...

https://developer.apple.com/library/mac/#samplecode/DemoMonkey/Introduction/
Intro.html

... but the application's services are not appearing in my Services menu
(and yes, they are listed and checked in System Preferences, so I know the
system is aware of them). What might the problem be? Thx - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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


Drag and Drop in Same View

2010-09-19 Thread koko

I do

dragImage:at:offset:event:pasteboard:source:slideBack:

in a view's mouseDragged method.

The view also implements all the correct methods for dragging as  
outlined in the example Erik Buck referred to. These dragging methods  
are never called.  So what must be done to Drop in the view that  
originates the Drag?


It this possible?

-koko



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: DemoMonkey services MIA

2010-09-19 Thread Matt Neuburg
On or about 9/19/10 3:26 PM, thus spake "Matt Neuburg" :

> I downloaded and built the DemoMonkey example and created a document...
> 
> https://developer.apple.com/library/mac/#samplecode/DemoMonkey/Introduction/In
> tro.html
> 
> ... but the application's services are not appearing in my Services menu (and
> yes, they are listed and checked in System Preferences, so I know the system
> is aware of them). What might the problem be? Thx - m.

Answering my own question, for the record: The return type used by the
DemoMonkey services commands, public.plain-text, is overly optimistic.
Changing this to NSStringPboardType fixes the problem. m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: Drag and Drop in Same View

2010-09-19 Thread Raleigh Ledet
You need to register as a dragging destination for your dragging type:
-registerForDraggedTypes:

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:

-raleigh

On Sep 19, 2010, at 5:08 PM, k...@highrolls.net wrote:

> I do  
> 
> dragImage:at:offset:event:pasteboard:source:slideBack:
> 
> in a view's mouseDragged method.
> 
> The view also implements all the correct methods for dragging as outlined in 
> the example Erik Buck referred to. These dragging methods are never called.  
> So what must be done to Drop in the view that originates the Drag?
> 
> It this possible?
> 
> -koko
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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


Re: Drag and Drop in Same View

2010-09-19 Thread koko

Sorry ... I did not say I had done that as follows:

		[self registerForDraggedTypes:[NSArray  
arrayWithObjects:NSDragPboard, nil]];	




On Sep 19, 2010, at 7:19 PM, Raleigh Ledet wrote:


You need to register as a dragging destination for your dragging type:
-registerForDraggedTypes:

http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html 
%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:


-raleigh

On Sep 19, 2010, at 5:08 PM, k...@highrolls.net wrote:


I do

dragImage:at:offset:event:pasteboard:source:slideBack:

in a view's mouseDragged method.

The view also implements all the correct methods for dragging as  
outlined in the example Erik Buck referred to. These dragging  
methods are never called.  So what must be done to Drop in the view  
that originates the Drag?


It this possible?

-koko



___

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

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


Re: Drag and Drop in Same View

2010-09-19 Thread Raleigh Ledet
NSDragPboard is the name of a pasteboard, not the dragged type. The drag type 
is the type of data you put on the pasteboard to drag. For example, is  you are 
dragging a URL, then register for kUTTypeURL. If it's private data then it's 
along these lines:

NSString *myType = 
UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, 
CFSTR("privateDat", kUTTypeData); // You are using UTIs right?

-(id)init {
...
[self registerForDraggedTypes:[NSArray arrayWithObjects:myType, nil]];
...
}


-(void)mouseDown:(NSEvent*)event {
...
[pboard clearContents];
NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] autorelease];
[item setData:data forType:myType];
[pboard writeObjects:[NSArray arrayWithObject:item]];

// start drag
...
}




-raleigh

On Sep 19, 2010, at 7:43 PM, k...@highrolls.net wrote:

> Sorry ... I did not say I had done that as follows:
> 
>   [self registerForDraggedTypes:[NSArray 
> arrayWithObjects:NSDragPboard, nil]];
> 
> 
> 
> On Sep 19, 2010, at 7:19 PM, Raleigh Ledet wrote:
> 
>> You need to register as a dragging destination for your dragging type:
>> -registerForDraggedTypes:
>> 
>> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:
>> 
>> -raleigh
>> 
>> On Sep 19, 2010, at 5:08 PM, k...@highrolls.net wrote:
>> 
>>> I do
>>> 
>>> dragImage:at:offset:event:pasteboard:source:slideBack:
>>> 
>>> in a view's mouseDragged method.
>>> 
>>> The view also implements all the correct methods for dragging as outlined 
>>> in the example Erik Buck referred to. These dragging methods are never 
>>> called.  So what must be done to Drop in the view that originates the Drag?
>>> 
>>> It this possible?
>>> 
>>> -koko
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> 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


Re: Drag and Drop in Same View

2010-09-19 Thread koko

Word Up to Raleigh! Just added one of my type and voila!

Thanks.

-koko


[self registerForDraggedTypes:[NSArray arrayWithObjects:NSDragPboard,  
@"Jump", nil]];	


in -mouseDragged:

[pboard declareTypes:[NSArray arrayWithObject:@"Jump"] owner:self];
[pboard setData:[NSData data] forType:@"Jump"];
[self dragImage:img at:localPt offset:sz event:theEvent  
pasteboard:pboard source:self slideBack:NO];




On Sep 19, 2010, at 9:00 PM, Raleigh Ledet wrote:

NSDragPboard is the name of a pasteboard, not the dragged type. The  
drag type is the type of data you put on the pasteboard to drag. For  
example, is  you are dragging a URL, then register for kUTTypeURL.  
If it's private data then it's along these lines:


NSString *myType =  
UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType,  
CFSTR("privateDat", kUTTypeData); // You are using UTIs right?


-(id)init {
...
[self registerForDraggedTypes:[NSArray arrayWithObjects:myType, nil]];
...
}


-(void)mouseDown:(NSEvent*)event {
...
[pboard clearContents];
NSPasteboardItem *item = [[[NSPasteboardItem alloc] init]  
autorelease];

[item setData:data forType:myType];
[pboard writeObjects:[NSArray arrayWithObject:item]];

// start drag
...
}




-raleigh

On Sep 19, 2010, at 7:43 PM, k...@highrolls.net wrote:


Sorry ... I did not say I had done that as follows:

		[self registerForDraggedTypes:[NSArray  
arrayWithObjects:NSDragPboard, nil]];	




On Sep 19, 2010, at 7:19 PM, Raleigh Ledet wrote:

You need to register as a dragging destination for your dragging  
type:

-registerForDraggedTypes:

http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html 
%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:


-raleigh

On Sep 19, 2010, at 5:08 PM, k...@highrolls.net wrote:


I do

dragImage:at:offset:event:pasteboard:source:slideBack:

in a view's mouseDragged method.

The view also implements all the correct methods for dragging as  
outlined in the example Erik Buck referred to. These dragging  
methods are never called.  So what must be done to Drop in the  
view that originates the Drag?


It this possible?

-koko



___

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

Please do not post admin requests or moderator comments to the  
list.

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


How to double tap event on a UIButton

2010-09-19 Thread Jonathan Chacón
Hello,

I have some UIButtons in a UIView. They have an action for the 
UIControlEventTouchUpInside (tap gesture). I use this code:

[tmpUIButton addTarget:self action:@selector(cellClick:) 
forControlEvents:UIControlEventTouchUpInside];


Now I want add a new action for my buttons when the user do the double tap 
gesture on a button. I used the UIControlEventTouchDownRepeat but this doesn't 
work.

What can I manage the double tap gesture on a UIButton?

thanks





Regards
Jonathan Chacón Barbero
   Accessibility, usability and new technologies consultant

Phone: +34 679953948
e-Mail: jonathan.cha...@telefonica.net
Blog: http://programaraciegas.weblog.discapnet.es
Twitter: http://www.twitter.com/jonathanchacon
LinkedIn: http://es.linkedin.com/in/jonathanchacon
Facebook: http://www.facebook.com/jonathan.chacon.barbero
Messenger: tyf...@hotmail.com
Skype: Tyflos_
Ping for iPhone: jchacon

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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 and Drop in Same View

2010-09-19 Thread Raleigh Ledet
Koko,

Seriously, NSDragPboard is not a type. You should remove it from your array. It 
shouldn't hurt anything, but it will confuse you when you look at the code 
later.

[self registerForDraggedTypes:[NSArray arrayWithObject:@"Jump"]];

Cheers,
raleigh

On Sep 19, 2010, at 9:26 PM, k...@highrolls.net wrote:

> Word Up to Raleigh! Just added one of my type and voila!
> 
> Thanks.
> 
> -koko
> 
> 
> [self registerForDraggedTypes:[NSArray arrayWithObjects:NSDragPboard, 
> @"Jump", nil]]; 
> 
> in -mouseDragged:
> 
> [pboard declareTypes:[NSArray arrayWithObject:@"Jump"] owner:self];
> [pboard setData:[NSData data] forType:@"Jump"];
> [self dragImage:img at:localPt offset:sz event:theEvent pasteboard:pboard 
> source:self slideBack:NO];
> 
> 
> 
> On Sep 19, 2010, at 9:00 PM, Raleigh Ledet wrote:
> 
>> NSDragPboard is the name of a pasteboard, not the dragged type. The drag 
>> type is the type of data you put on the pasteboard to drag. For example, is  
>> you are dragging a URL, then register for kUTTypeURL. If it's private data 
>> then it's along these lines:
>> 
>> NSString *myType = 
>> UTTypeCreatePreferredIdentifierForTag(kUTTagClassNSPboardType, 
>> CFSTR("privateDat", kUTTypeData); // You are using UTIs right?
>> 
>> -(id)init {
>> ...
>> [self registerForDraggedTypes:[NSArray arrayWithObjects:myType, nil]];
>> ...
>> }
>> 
>> 
>> -(void)mouseDown:(NSEvent*)event {
>> ...
>> [pboard clearContents];
>> NSPasteboardItem *item = [[[NSPasteboardItem alloc] init] autorelease];
>> [item setData:data forType:myType];
>> [pboard writeObjects:[NSArray arrayWithObject:item]];
>> 
>> // start drag
>> ...
>> }
>> 
>> 
>> 
>> 
>> -raleigh
>> 
>> On Sep 19, 2010, at 7:43 PM, k...@highrolls.net wrote:
>> 
>>> Sorry ... I did not say I had done that as follows:
>>> 
>>> [self registerForDraggedTypes:[NSArray 
>>> arrayWithObjects:NSDragPboard, nil]];
>>> 
>>> 
>>> 
>>> On Sep 19, 2010, at 7:19 PM, Raleigh Ledet wrote:
>>> 
 You need to register as a dragging destination for your dragging type:
 -registerForDraggedTypes:
 
 http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html%23//apple_ref/occ/instm/NSView/registerForDraggedTypes:
 
 -raleigh
 
 On Sep 19, 2010, at 5:08 PM, k...@highrolls.net wrote:
 
> I do  
> 
> dragImage:at:offset:event:pasteboard:source:slideBack:
> 
> in a view's mouseDragged method.
> 
> The view also implements all the correct methods for dragging as outlined 
> in the example Erik Buck referred to. These dragging methods are never 
> called.  So what must be done to Drop in the view that originates the 
> Drag?
> 
> It this possible?
> 
> -koko
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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