Re: [Newbie]: $buffer troubles



"Thierry" == Thierry Vignaud <tvignaud mandrakesoft com> writes:

    Thierry> Stefano Esposito <yankeegohome email it> writes:
    >> Hi all. I'm a newbie at GUI programming so, forgive me if
    >> the question has an obvious answer :)
    >> 
    >> When i try to run something like this
    >> 
    >> my $view = Gtk2::TextView->new(); ...
    >> $menu_new->signal_connect('activate', \&new, $view); ...
    >> sub new { my $view = $_[1]; my $local_buff =
    >> $view->get_buffer(); my $start_iter; my $end_iter;
    >> 
    >> $local_buff->get_start_iter($start_iter);
    >> $local_buff->get_end_iter($end_iter); ...
    >> }
    >> 
    >> I obtain this runtime error message:
    >> 
    >> *** unhandled exception in callback: *** Usage:
    >> get_start_iter(buffer) at ./main.pl line 128.  ***
    >> ignoring at ./main.pl line 109.
    >> 
    >> Can anyone tell me where's my error?

    Thierry> the usual design choice i usually complain about,
    Thierry> aka gtk2-perl just silently ignores exceptions in
    Thierry> callbacks

I do not want to start a flame war here, but *I*, for one, relies
on that design. Especially  when doing RAD, having an application
that do  not crash on  every exception (small  or big) is  a real
win.

But as the error message  begins with '*** unhandled exception in
callback:', it may  mean that it is possible  to catch exceptions
and that only unhandled  exceptions are... unhandled. And I would
not say silently neither  since we are precisely discussing about
the message issued.

Regarding the initial problem :

http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/TextBuffer.html

says the usage is

$textiter = $buffer->get_start_iter

*not*

$buffer->get_start_iter($textiter)

This is  perl, not C. $textiter is  a scalar, if it  appears as a
parameter,  it cannot  be changed  by the  subroutine.  In  C the
function  receives a pointer  and changes  the *content*  of this
pointer.

Hope this help,

     Vincent

P.S.: As a  side note, Stefano, some gtk2-perl  developers may be
north-american, there is  no need to be rude  with them with your
email when you need help :o)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]