[TxMt Plugins] sendAction Question
Kirt Fitzpatrick
kirt.fitzpatrick at gmail.com
Sat Mar 17 23:12:49 UTC 2007
I'm writing a Vi plugin, Currently I must create a list of events and send
them to NSWindow. However, this does not work for alot of actions that I
need. I need to be able to execute all of the movement commands and
selection commands. Having access to the undo stack would be great too.
kirt
On 3/17/07, Todd Ditchendorf <itod at mac.com> wrote:
>
> really we're going about this all wrong... TM has lots of great
> documentation and a wonderful dev community. You should describe here
> what effect it is you are trying to achieve. there's bound to be a
> way to do it... and possibly even thru published/documented api.
>
> Todd Ditchendorf
>
> Scandalous Software - Mac XML Developer Tools
> http://scan.dalo.us
>
>
>
> On Mar 17, 2007, at 4:03 PM, Kirt Fitzpatrick wrote:
>
> > It Todd appears is right. Which is what I was afraid of. Now I
> > really need to work blind (without documentation).
> >
> > kirt
> >
> > On 3/17/07, Todd Ditchendorf <itod at mac.com> wrote:> 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
> >
> > _______________________________________________
> > 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate-plugins/attachments/20070317/0550ed89/attachment.html>
More information about the textmate-plugins
mailing list