Tuesday, December 17, 2013

RE: use perl with gtk2 with if_perl.xs?

> From: vim_use@googlegroups.com On Behalf Of Konovalov, Vadim

> I am using GVIM and I often do scripting in perl, using "+perl"
> Now, I wish to also insert some GUI perl scripting also.

> Given that I use Gtk-based GVIM, will it be possible to also perform perl scripting using
> Gtk2 perl module??
> Success stories, anyone??

Answering my own question - yes, this is possible and seemingly the coolest thing since the sliced bread,

so the following code just works -

-------------try1.vim----------
perl VIM::Msg("perl ver is $]; we-re on try1.vim, heh....")

perl <<EOSVIM

use Gtk2;

my $window = Gtk2::Window->new('toplevel');
my $entry = Gtk2::Entry->new();
my $button1 = Gtk2::Button->new('this');
my $buttonq = Gtk2::Button->new('that');

$button1->signal_connect (clicked => sub { print STDERR "this\n" });
$buttonq->signal_connect (clicked => sub { print STDERR $::curbuf->Get(1),';'; });

$window->add(
my $vbox = Gtk2::VBox->new ( 0, 6 )
);
#$vbox->show();

$vbox->pack_start( $entry, 1, 1, 0 );
$vbox->pack_start( $button1, 1, 1, 0 );
$vbox->pack_start( $buttonq, 1, 1, 0 );

$window->show_all;
EOSVIM
-------------end of try1.vim----------

For example, it is possible to introduce, say, "distant view" feature etc, which require some graphics and all that...

Regards,
Vadim.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: