[TxMt Plugins] sendAction Question

Todd Ditchendorf itod at mac.com
Sat Mar 17 22:55:34 UTC 2007


> Actually it's an NSResponder method,

yes, but if you're trying to move the text selection caret, the impl  
you actually want to call will be in something like NSTextView.

> It's worth a shot.

agreed. but still... I've peeked into the OakTextView.h header file  
using class-dump[1], and I don't see moveLeft: listed there. I really  
don't think this will work.

[1] http://www.codethecode.com/Projects/class-dump/

Todd Ditchendorf

Scandalous Software - Mac XML Developer Tools
http://scan.dalo.us



On Mar 17, 2007, at 3:51 PM, Rob Rix wrote:

> Actually it's an NSResponder method, and taking a glance at  
> TextMate.app/Contents/Resources/KeyBindings.dict shows that a  
> number of NSResponder methods are implemented by TextMate.
>
> It's worth a shot.
>
> Rob
>
> On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote:
>
>> oh... and btw, I don't think the line below is going to work  
>> anyhow... first of all, I think I gave you some bumb advice... I'd  
>> never heard of moveLeft: before... I just looked it up, and it  
>> looks like it's something that an NSTextView might implement, not  
>> an NSWindow.
>>
>> More importantly, Allan has developed his own alternative to  
>> NSTextView in TM, called OakTextView, and I would not be surprised  
>> if it doesn't implement that method anyhow, so this might be a  
>> dead end.
>>
>> Todd Ditchendorf
>>
>> Scandalous Software - Mac XML Developer Tools
>> http://scan.dalo.us
>>
>>
>>
>> On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote:
>>
>>> Kirt, I've done quite a bit of communication from a tm plugin to  
>>> the TM front most window[1][2][3]... I think you should probably  
>>> try something like this:
>>>
>>> [[[NSApplication sharedApplication] mainWindow] moveLeft:self]
>>>
>>>
>>> Note that +[NSApplication sharedApplication] returns an  
>>> NSApplication instance, not a window. An NSApplication handles  
>>> much of the application's lifecycle. A window is represented by  
>>> NSWindow. The frontmost TM editing window can always be fetched  
>>> by calling -[NSApplication mainWindow] on the TM application  
>>> instance from your plugin, as shown above
>>>
>>> If I were Allan, I would probably admonish you not to do anything  
>>> too crazy to the frontmost TM window from your plugin, as it  
>>> might surprise users. But then again, as I mentioned, I've  
>>> probably done more peeking under TM's skirt with my plugins than  
>>> anyone else has...  So far Allan hasn't complained ;-]
>>>
>>>
>>> [1] http://ditchnet.ort/texmlmate
>>> [2] http://ditchnet.ort/texslmate
>>> [3] http://ditchnet.ort/blogmate
>>>
>>>
>>> Todd Ditchendorf
>>>
>>> Scandalous Software - Mac XML Developer Tools
>>> http://scan.dalo.us
>>>
>>>
>>>
>>> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote:
>>>
>>>> I am trying to call the moveLeft method on the editor window and  
>>>> I don't seem to be having any luck.  I am a bit of a n00b to  
>>>> Objective C so I assume that I must be missing something.  This  
>>>> is what I came up with.  Am I doing something wrong?
>>>>
>>>> SEL methodSelector = sel_registerName( "moveLeft" );
>>>> [[NSApplication sharedApplication] sendAction:methodSelector  
>>>> to:nil from:self];
>>>>
>>>> kirt
>>>>
>>>> _______________________________________________
>>>> textmate-plugins mailing list
>>>> textmate-plugins at lists.macromates.com
>>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins
>>>
>>> _______________________________________________
>>> textmate-plugins mailing list
>>> textmate-plugins at lists.macromates.com
>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins
>>
>> _______________________________________________
>> textmate-plugins mailing list
>> textmate-plugins at lists.macromates.com
>> http://lists.macromates.com/mailman/listinfo/textmate-plugins
>
> _______________________________________________
> textmate-plugins mailing list
> textmate-plugins at lists.macromates.com
> http://lists.macromates.com/mailman/listinfo/textmate-plugins




More information about the textmate-plugins mailing list