SD | 1 Dec 2011 11:25

Drag And Drop Killed By loadNibNamed

Hello all, hope you can help.

My application loads a window from a nib and then displays it.  This 
window has a Text View (NSTextView in NSScrollView).

When the window is loaded from a nib using:

[NSBundle loadNibNamed: <at> "nibfilename" owner:m];

dropping text (using drag and drop) on the NSTextView doesn't work.

It doesn't seem to matter how I show the window once I load the nib. 
Have it show via "Visible At Launch", show using 
makeKeyAndOrderFront, show using beginSheet.

If I copy the window into my main nib show it, then drag and drop 
works fine.  Does anyone have any ideas why the drag and drop is 
getting killed when I use loadNibNamed.

Thank you.
Alexander Reichstadt | 1 Dec 2011 12:42
Picon

Re: Drag And Drop Killed By loadNibNamed

I remember to have run into the same problem. Somehow the window was not present early enough. I ended up
using NSWindowController's

[[yourwindowcontrollersubclass alloc] initWithWindowNibName: <at> "YourNibNameWithoutExtensionNib"]

which worked.

Am 01.12.2011 um 11:25 schrieb SD:

> Hello all, hope you can help.
> 
> My application loads a window from a nib and then displays it.  This window has a Text View (NSTextView in NSScrollView).
> 
> When the window is loaded from a nib using:
> 
> [NSBundle loadNibNamed: <at> "nibfilename" owner:m];
> 
> 
> dropping text (using drag and drop) on the NSTextView doesn't work.
> 
> It doesn't seem to matter how I show the window once I load the nib. Have it show via "Visible At Launch", show
using makeKeyAndOrderFront, show using beginSheet.
> 
> If I copy the window into my main nib show it, then drag and drop works fine.  Does anyone have any ideas why the
drag and drop is getting killed when I use loadNibNamed.
> 
> Thank you.
> _______________________________________________
> MacOSX-dev mailing list
> MacOSX-dev@...
(Continue reading)

Christiaan Hofman | 1 Dec 2011 13:12
Picon

Re: Drag And Drop Killed By loadNibNamed


On Dec 1, 2011, at 12:42, Alexander Reichstadt wrote:

> I remember to have run into the same problem. Somehow the window was not present early enough. I ended up
using NSWindowController's
> 
> [[yourwindowcontrollersubclass alloc] initWithWindowNibName: <at> "YourNibNameWithoutExtensionNib"]
> 
> which worked.
> 
> 
> Am 01.12.2011 um 11:25 schrieb SD:
> 
>> Hello all, hope you can help.
>> 
>> My application loads a window from a nib and then displays it.  This window has a Text View (NSTextView in NSScrollView).
>> 
>> When the window is loaded from a nib using:
>> 
>> [NSBundle loadNibNamed: <at> "nibfilename" owner:m];
>> 
>> 
>> dropping text (using drag and drop) on the NSTextView doesn't work.
>> 
>> It doesn't seem to matter how I show the window once I load the nib. Have it show via "Visible At Launch",
show using makeKeyAndOrderFront, show using beginSheet.
>> 
>> If I copy the window into my main nib show it, then drag and drop works fine.  Does anyone have any ideas why
the drag and drop is getting killed when I use loadNibNamed.
>> 
(Continue reading)

SD | 2 Dec 2011 02:55

Re: Drag And Drop Killed By loadNibNamed

Subclassing and using NSWindowController worked, thank you.

Specifically:
	MyNSWindowController *m = [[[MyNSWindowController alloc] 
initWithWindowNibName: <at> "myNib"] autorelease];
	[m window];

SD

______________________________________________________________________
Previous message on 12/1/11 at 12:42 PM +0100
**********************************************************************
>I remember to have run into the same problem. Somehow the window was 
>not present early enough. I ended up using NSWindowController's
>
>[[yourwindowcontrollersubclass 
>alloc] initWithWindowNibName: <at> "YourNibNameWithoutExtensionNib"]
>
>which worked.
>
>
>Am 01.12.2011 um 11:25 schrieb SD:
>
>>Hello all, hope you can help.
>>
>>My application loads a window from a nib and then displays it. 
>> This window has a Text View (NSTextView in NSScrollView).
>>
>>When the window is loaded from a nib using:
>>
(Continue reading)

Christiaan Hofman | 5 Dec 2011 00:18
Picon

When is editWithFrame:... used?

Can anyone tell me when NSTextFieldCell's editWithFrame:... method is used? In my testing all ways of
editing I have tried always go through selectWithFrame:... and never use editWithFrame:.... I need to
know for a subclass whether I need to override this method, but for that I need to test it. But when it's not
used it's not tested...

thanks,
Christiaan
John Musbach | 7 Dec 2011 01:02
Picon

Re: When is editWithFrame:... used?

On Mon, Dec 5, 2011 at 3:00 PM,  <macosx-dev-request@...> wrote:
> Message: 1
> Date: Mon, 5 Dec 2011 00:18:35 +0100
> From: Christiaan Hofman <cmhofman@...>
> Subject: When is editWithFrame:... used?
> To: "macosx-dev@... List" <macosx-dev@...>
> Message-ID: <F256FB34-2237-4E54-820A-E9F9AA20A92C@...>
> Content-Type: text/plain;       charset=us-ascii
>
> Can anyone tell me when NSTextFieldCell's editWithFrame:... method is used? In my testing all ways of
editing I have tried always go through selectWithFrame:... and never use editWithFrame:.... I need to
know for a subclass whether I need to override this method, but for that I need to test it. But when it's not
used it's not tested...

editWithFrame:inView:editor:delegate:event:
Begins editing of the receiver’s text using the specified field editor.

- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView
editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent
*)theEvent
Parameters
aRect
The bounding rectangle of the cell.
controlView
The control that manages the cell.
textObj
The field editor to use for editing the cell.
anObject
The object to use as a delegate for the field editor (textObj
parameter). This delegate object receives various NSText delegation
(Continue reading)

Christiaan Hofman | 7 Dec 2011 01:17
Picon

Re: When is editWithFrame:... used?


On Dec 7, 2011, at 1:02, John Musbach wrote:

> On Mon, Dec 5, 2011 at 3:00 PM,  <macosx-dev-request@...> wrote:
>> Message: 1
>> Date: Mon, 5 Dec 2011 00:18:35 +0100
>> From: Christiaan Hofman <cmhofman@...>
>> Subject: When is editWithFrame:... used?
>> To: "macosx-dev@... List" <macosx-dev@...>
>> Message-ID: <F256FB34-2237-4E54-820A-E9F9AA20A92C@...>
>> Content-Type: text/plain;       charset=us-ascii
>> 
>> Can anyone tell me when NSTextFieldCell's editWithFrame:... method is used? In my testing all ways of
editing I have tried always go through selectWithFrame:... and never use editWithFrame:.... I need to
know for a subclass whether I need to override this method, but for that I need to test it. But when it's not
used it's not tested...
> 
> 
> editWithFrame:inView:editor:delegate:event:
> Begins editing of the receiver’s text using the specified field editor.
> 
> - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView
> editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent
> *)theEvent
> Parameters
> aRect
> The bounding rectangle of the cell.
> controlView
> The control that manages the cell.
> textObj
(Continue reading)

Christiaan Hofman | 8 Dec 2011 01:12
Picon

Re: When is editWithFrame:... used?


On Dec 8, 2011, at 0:51, Matt Neuburg wrote:

> 
> On Dec 7, 2011, at 12:00 PM, macosx-dev-request@... wrote:
> 
>> Message: 2
>> Date: Wed, 7 Dec 2011 01:17:53 +0100
>> From: Christiaan Hofman <cmhofman@...>
>> Subject: Re: When is editWithFrame:... used?
>> 
>> can read the documentation
> 
> Can you also search it? When I search the documentation on editWithFrame:, I find 8 sample code projects
that actually show editWithFrame: in use. I assure you that, for example, in the DragNDropOutlineView
example, in the ImageAndTextCell class, editWithFrame *is* called. m.
> 
> --
> matt neuburg, phd = matt@..., http://www.apeth.net/matt/
> pantes anthropoi tou eidenai oregontai phusei
> Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
> Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
> TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
> 

Are you sure about that? Did you test that? I really don't see that. I had not looked at that particular sample
code for a long time, but I sure did test in my own subclass (which is very similar to ImageAndTextCell), and
this method was not called, at least not after a mouseDown. As I implied. Otherwise, still the question is WHEN?

(Continue reading)

Christiaan Hofman | 8 Dec 2011 01:20
Picon

Re: When is editWithFrame:... used?


On Dec 8, 2011, at 1:12, Christiaan Hofman wrote:

> 
> On Dec 8, 2011, at 0:51, Matt Neuburg wrote:
> 
>> 
>> On Dec 7, 2011, at 12:00 PM, macosx-dev-request@... wrote:
>> 
>>> Message: 2
>>> Date: Wed, 7 Dec 2011 01:17:53 +0100
>>> From: Christiaan Hofman <cmhofman@...>
>>> Subject: Re: When is editWithFrame:... used?
>>> 
>>> can read the documentation
>> 
>> Can you also search it? When I search the documentation on editWithFrame:, I find 8 sample code projects
that actually show editWithFrame: in use. I assure you that, for example, in the DragNDropOutlineView
example, in the ImageAndTextCell class, editWithFrame *is* called. m.
>> 
>> --
>> matt neuburg, phd = matt@..., http://www.apeth.net/matt/
>> pantes anthropoi tou eidenai oregontai phusei
>> Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
>> Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
>> RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
>> TidBITS, Mac news and reviews since 1990, http://www.tidbits.com
>> 
> 
> Are you sure about that? Did you test that? I really don't see that. I had not looked at that particular
(Continue reading)

Matt Neuburg | 8 Dec 2011 00:51
Favicon
Gravatar

Re: When is editWithFrame:... used?


On Dec 7, 2011, at 12:00 PM, macosx-dev-request@... wrote:

> Message: 2
> Date: Wed, 7 Dec 2011 01:17:53 +0100
> From: Christiaan Hofman <cmhofman@...>
> Subject: Re: When is editWithFrame:... used?
> 
> can read the documentation

Can you also search it? When I search the documentation on editWithFrame:, I find 8 sample code projects
that actually show editWithFrame: in use. I assure you that, for example, in the DragNDropOutlineView
example, in the ImageAndTextCell class, editWithFrame *is* called. m.

--
matt neuburg, phd = matt@..., http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.com

Gmane