On Fri, Nov 19, 2010 at 8:52 AM, haratron <harat...@gmail.com> wrote:
> At the moment, I have 3 Gtk2::Entry and 3 Gtk2::ComboBox objects.
> I want to read their contents when a button is pressed (the OK button).
> To illustrate better, the user is entering his data (Entry) and makes
> his selections (ComboBox) and hits a button that reads "OK" . At that
> moment, I want to read in the contents of each Entry and Combobox.
>
> Following is the code that I currently have (handles only one Entry
> and one ComboBox). What changes should I do to accomplish the above?

>From IRC:

16:01 < ebassi> cfx: if you want to read in response to signals from other
                widgets - like a GtkButton::clicked signal - read the contents
                of the entry from that callback

So you should be reading your controls in the callback for the
'clicked' event (the sub{} block below).

> $button= $builder->get_object('button1');
>
> $button->signal_connect('clicked' => sub {my ($button,$userdata) =
> @_;},$userdata);

The documentation section of the Gtk2-Perl website [1] has a tutorial
[2] that comes with live code examples that could help you work out
the rest of your question above.  There's also the demos/examples in
the Gtk2-Perl git tree, as mentioned by Emmanuele in IRC[3], that will
have examples of callbacks for the 'clicked' event.

Thanks,

Brian

[1] http://gtk2-perl.sourceforge.net/doc/

[2] 
http://gtk2-perl.sourceforge.net/doc/gtk2-perl-study-guide/c901.html#SIGNALS_CALLBACK

[3] 03:38 < ebassi>
http://git.gnome.org/browse/perl-Gtk2/tree/examples and
http://git.gnome.org/browse/perl-Gtk2/tree/gtk-demo
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to