Re: Drag-and-drop onto an NSTextField?

2020-07-31 Thread Sandor Szatmari via Cocoa-dev
Took a bit to originally figure out but seems to me like it should be a 
default, or at least easily selectable behavior with an API.

Sandor

> On Jul 31, 2020, at 20:17, Carl Hoefs  wrote:
> 
> Sandor,
> 
> Ah! That's quite clever... and it works, too!
> 
> Thanks!
> -Carl
> 
> 
>> On Jul 31, 2020, at 5:16 PM, Sandor Szatmari  
>> wrote:
>> 
>> Carl,
>> 
 On Jul 31, 2020, at 20:07, Carl Hoefs  
 wrote:
 
>>> Hmm, subleasing NSTextField doesn't work for me (the dragged item gets 
>>> rejected). I've got the  protocol in my subclass of 
>>> NSTextField.
>>> 
>>> Is there something I need to set in -draggingEntered:?
>> 
>> I call…
>> 
>> [self becomeFirstResponder]
>> [self setNeedsDisplay:YES]
>> 
>> Then return the drag operation required.
>> 
>> Sandor
>> 
>>> I return NSDragOperationCopy.
>>> 
>>> Are there any other methods besides -draggingEntered: that must also be 
>>> overridden? 
>>> 
>>> -Carl
>>> 
>>> 
 On Jul 31, 2020, at 4:49 PM, Sandor Szatmari 
  wrote:
 
 For NSTexrField I have always created a subclass for my textfields
 
 I call -registerForDraggedTypes: in -awakeFromNib in the subclass
 
 And then to accept the drag implement the method in the sublclass
 
   -(NSDragOperation)draggingEntered:(id)sender
 
 If there’s an easier or better it’d be cool to learn about it
 
 Sandor
 
>> On Jul 31, 2020, at 19:29, Carl Hoefs via Cocoa-dev 
>>  wrote:
> 
> Why is drag-and-drop onto an NSTextField enabled only when it has focus? 
> 
> Is there any way around this?
> 
> -Carl
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Drag-and-drop onto an NSTextField?

2020-07-31 Thread Carl Hoefs via Cocoa-dev
Sandor,

Ah! That's quite clever... and it works, too!

Thanks!
-Carl


> On Jul 31, 2020, at 5:16 PM, Sandor Szatmari  
> wrote:
> 
> Carl,
> 
>> On Jul 31, 2020, at 20:07, Carl Hoefs  wrote:
>> 
>> Hmm, subleasing NSTextField doesn't work for me (the dragged item gets 
>> rejected). I've got the  protocol in my subclass of 
>> NSTextField.
>> 
>> Is there something I need to set in -draggingEntered:?
> 
> I call…
> 
> [self becomeFirstResponder]
> [self setNeedsDisplay:YES]
> 
> Then return the drag operation required.
> 
> Sandor
> 
>> I return NSDragOperationCopy.
>> 
>> Are there any other methods besides -draggingEntered: that must also be 
>> overridden? 
>> 
>> -Carl
>> 
>> 
>>> On Jul 31, 2020, at 4:49 PM, Sandor Szatmari  
>>> wrote:
>>> 
>>> For NSTexrField I have always created a subclass for my textfields
>>> 
>>> I call -registerForDraggedTypes: in -awakeFromNib in the subclass
>>> 
>>> And then to accept the drag implement the method in the sublclass
>>> 
>>>   -(NSDragOperation)draggingEntered:(id)sender
>>> 
>>> If there’s an easier or better it’d be cool to learn about it
>>> 
>>> Sandor
>>> 
 On Jul 31, 2020, at 19:29, Carl Hoefs via Cocoa-dev 
  wrote:
 
 Why is drag-and-drop onto an NSTextField enabled only when it has focus? 
 
 Is there any way around this?
 
 -Carl
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
 
 This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Drag-and-drop onto an NSTextField?

2020-07-31 Thread Sandor Szatmari via Cocoa-dev
Carl,

>> On Jul 31, 2020, at 20:07, Carl Hoefs  wrote:
> Hmm, subleasing NSTextField doesn't work for me (the dragged item gets 
> rejected). I've got the  protocol in my subclass of 
> NSTextField.
> 
> Is there something I need to set in -draggingEntered:?

I call…

[self becomeFirstResponder]
[self setNeedsDisplay:YES]

Then return the drag operation required.

Sandor

> I return NSDragOperationCopy.
> 
> Are there any other methods besides -draggingEntered: that must also be 
> overridden? 
> 
> -Carl
> 
> 
>> On Jul 31, 2020, at 4:49 PM, Sandor Szatmari  
>> wrote:
>> 
>> For NSTexrField I have always created a subclass for my textfields
>> 
>> I call -registerForDraggedTypes: in -awakeFromNib in the subclass
>> 
>> And then to accept the drag implement the method in the sublclass
>> 
>>   -(NSDragOperation)draggingEntered:(id)sender
>> 
>> If there’s an easier or better it’d be cool to learn about it
>> 
>> Sandor
>> 
 On Jul 31, 2020, at 19:29, Carl Hoefs via Cocoa-dev 
  wrote:
>>> Why is drag-and-drop onto an NSTextField enabled only when it has focus?
>>> Is there any way around this?
>>> -Carl
>>> ___
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
>>> This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Drag-and-drop onto an NSTextField?

2020-07-31 Thread Sandor Szatmari via Cocoa-dev
For NSTexrField I have always created a subclass for my textfields

I call -registerForDraggedTypes: in -awakeFromNib in the subclass

And then to accept the drag implement the method in the sublclass

-(NSDragOperation)draggingEntered:(id)sender

If there’s an easier or better it’d be cool to learn about it

Sandor

> On Jul 31, 2020, at 19:29, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> Why is drag-and-drop onto an NSTextField enabled only when it has focus? 
> 
> Is there any way around this?
> 
> -Carl
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
> 
> This email sent to admin.szatmari@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Drag-and-drop onto an NSTextField?

2020-07-31 Thread Carl Hoefs via Cocoa-dev
Why is drag-and-drop onto an NSTextField enabled only when it has focus? 

Is there any way around this?

-Carl
 
___

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

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

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

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