Re: Gtk2::TextView



ArtÅras Ålajus wrote:

Daniel Kasak wrote:

Hi all.

I want to display a note in a text widget.
From what I understand, I need a GtkTextView widget to display text that takes up more than one line.

Here's what I've got so far to get the note in the widget:

my ( $widget, $event ) = @_;
# Check if we've received a double-click event; exit if we haven't
if ($event->type ne '2button-press') {
return;
}
my $slist = $prospects->get_widget("Notes_SList");
my @selected = $slist->get_selected_indices;
my $note_txt = $slist->{data}[$selected[0]][3];
my $textbuffer = Gtk2::TextBuffer->new;
$textbuffer->set_text($note_txt);
my $notedetails = Gtk2::GladeXML->new($gladefile, 'NoteDetails');
$notedetails->get_widget("NoteTxt")->set_buffer($textbuffer);



I'm getting the correct text in $note_txt, but something goes wrong ( or doesn't happen ) after this, because my Gtk2::TextView is empty.

What am I doing wrong?

hmm
everything seems ok.
maybe there is another widgt with same name?

Nope.
$notedetails is a single-purpose window, containg 1 thing: $note_txt, which is a GtkTextView.
The above code runs without any errors at all.

Dan



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