From: JFisher on
Hi All,

Perhaps someone out there in cyberspace can help me with this one...
I'm working on a Windows XP machine and trying to evoke a function
before a
physical <<paste>> event. More specifically, I'm trying to execute a
function
AFTER a <<paste>> event using a <Control-v> bind and having no
success; the
function unfortunately runs before the <<paste>> event occurs. I've
tried a break command
at the end of the function with no success.

Is there anyone out there that has tackled this problem?

Any help with this is greatly appreciated.

Long live open source programming,
Jason
From: Alexandre Ferrieux on
On Jun 13, 3:39 am, JFisher <stormp...(a)gmail.com> wrote:
> Hi All,
>
> Perhaps someone out there in cyberspace can help me with this one...
> I'm working on a Windows XP machine and trying to evoke a function
> before a
> physical <<paste>> event. More specifically, I'm trying to execute a
> function
> AFTER a <<paste>> event using a <Control-v> bind and having no
> success; the
> function unfortunately runs before the <<paste>> event occurs. I've
> tried a break command
> at the end of the function with no success.
>
> Is there anyone out there that has tackled this problem?
>
> Any help with this is greatly appreciated.


The trick is that, even when you set up an "additive" binding
(concatenated to the existing one) by starting it with "+", it will
only concatenate itself to the script for this bindtag (which may be
".t", eg the widget's name, but also "Text", ".", or "all" -- see
bindtags.n), so it might not be "after" the one you want.

To introspect that, use the 1-arg [bind] and see where the relevant
code is hooked. In the case of the Text widget, we can see that [bind
Text <<Paste>>] returns:

tk_textPaste %W

As a consequence, you'll get your post-paste hook by saying:

bind Text <<Paste>> {+mystuff}

-Alex






From: JFisher on
On Jun 13, 6:21 am, Alexandre Ferrieux <alexandre.ferri...(a)gmail.com>
wrote:
> On Jun 13, 3:39 am, JFisher <stormp...(a)gmail.com> wrote:
>
>
>
> > Hi All,
>
> > Perhaps someone out there in cyberspace can help me with this one...
> > I'm working on a Windows XP machine and trying to evoke a function
> > before a
> > physical <<paste>> event. More specifically, I'm trying to execute a
> > function
> > AFTER a <<paste>> event using a <Control-v> bind and having no
> > success; the
> > function unfortunately runs before the <<paste>> event occurs. I've
> > tried a break command
> > at the end of the function with no success.
>
> > Is there anyone out there that has tackled this problem?
>
> > Any help with this is greatly appreciated.
>
> The trick is that, even when you set up an "additive" binding
> (concatenated to the existing one) by starting it with "+", it will
> only concatenate itself to the script for this bindtag (which may be
> ".t", eg the widget's name, but also "Text", ".", or "all" -- see
> bindtags.n), so it might not be "after" the one you want.
>
> To introspect that, use the 1-arg [bind] and see where the relevant
> code is hooked. In the case of the Text widget, we can see that [bind
> Text <<Paste>>] returns:
>
>     tk_textPaste %W
>
> As a consequence, you'll get your post-paste hook by saying:
>
>     bind Text <<Paste>> {+mystuff}
>
> -Alex

Thanks Alex, I finally got it working by replacing the widget's name
with "Text".

Jason