[TxMt] Drag&Drop Operation with NIB - TM don't get the focus automatically

Allan Odgaard throw-away-2 at macromates.com
Thu Nov 1 17:28:36 UTC 2007

On 30 Oct 2007, at 10:58, Hans-Joerg Bibiko wrote:

> I wrote a drag command which calls "$DIALOG" to show a nib. Fine.
> If I drag a file from Finder to a new empty TM window, the nib  
> popups, but unfortunately TM don't get the focus.
> If I drag and drop e.g. an image from Finder to an HTML document the  
> current document gets the focus.
> Is this behaviour changeable?

You can try issue a activateIgnoringOtherApps: in the Dialog plug-in  
before popping up the nib.

There might be a problem with not actually going active before the  
main event loop has gone through one iteration.

There is a more serious problem with the way drops are presently  
handled in that the code runs in the “drop callback” (so to speak) and  
e.g. the blogging bundle asks for a description of the dropped file,  
which may take longer to enter, than the dragging source is willing to  
wait, so a timeout occurs.

So I am looking at likely changing the structure here so that a drop  
is accepted fully, and then a command is allowed to work with it, and  
at least then, it should not be a problem to active TM fully before  
acting on the drop (but this will not be in 1.x).

More information about the textmate mailing list