[Glade-users] how i click and open a file into textview?
gilles
bermudos@free.fr
Mon, 25 Oct 2004 12:53:41 +0200
On Sun, Oct 24, 2004 at 10:40:57PM -0700, Aaron Yang wrote:
> hi,
>
> after i insert a textview widget inside a window,
> does anyone know what i should do to display the
> contents of any file inside the widget?
>
> thanks in advance.
>
yes, sure.
imagine you have a button to show a help message.
sub on_conf_help_button_clicked {
my ($class, $data, $object, $instance, $event) = @_;
my $form = $__PACKAGE__::all_forms->{$instance};
$::HELP_TITLE="Configuration";
$::HELP_LABEL="Aide sur la configuration";
$::HELP_TEXT="Ces valeurs sont enregistrees dans un fichier qui est lu au demarr
programme. Les modifications sont donc effectives au demarrage
suivant.";
Gtk->init;
my $help = help_window->new;
$help->TOPLEVEL->show;
Gtk->main;
$help->TOPLEVEL->destroy;
} # End of sub on_conf_help_button_clicked
and in the programmeUI.pm, you place
#
# Construct a GtkWindow 'help_window'
..
$widgets->{'help_window'}->set_title($::HELP_TITLE);
# Construct a GtkLabel 'help_label'
...
$widgets->{'help_label'} = new Gtk::Label($::HELP_LABEL);
and
# Construct a GtkText 'help_text'
...
$widgets->{'help_text'}->insert(undef, $widgets->{'help_text'}->style->text('normal'), undef, $::HELP_TEXT);
at the good place.
gilles