deadpickle has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use Gtk2 '-init'; use Glib qw/TRUE FALSE/; my $username = 'Whats the Server?'; my $server = 'Whats the Username?'; my $entry_sftp_username; my $entry_sftp_server; #create main window my $window = Gtk2::Window->new('toplevel'); $window->signal_connect(delete_event=> sub {Gtk2->main_quit}); $window->set_title("Config Load Notebook Test"); $window->set_default_size(400, 300); #create notebook my $notebook = Gtk2::Notebook->new; $notebook->set_tab_pos('top'); #build the correct interfaces &user_interface; #add widgets $window->add($notebook); $window->show_all; Gtk2->main; #-------------------Config Grabber------------------- #Grab the current config settings sub current { $username = $entry_sftp_username->get_text; $server = $entry_sftp_server->get_text; } #-------------------User Interface------------------- sub user_interface { #build the new notebook my $config_notebook = Gtk2::Notebook->new; $config_notebook->set_tab_pos('right'); #create tables my $table = Gtk2::Table->new(5, 2, FALSE); #Current settings display my $dis_table = Gtk2::Table->new(2, 1, FALSE); my $label1 = Gtk2::Label->new($server); my $label2 = Gtk2::Label->new($username); $dis_table->attach_defaults($label1, 0, 1, 0, 1); $dis_table->attach_defaults($label2, 0, 1, 1, 2); #Connection Group (all users) my $config_table = Gtk2::Table->new(2, 2, FALSE); my $label_sftp_username = Gtk2::Label->new( 'Username'); my $label_sftp_server = Gtk2::Label->new( 'Server'); $entry_sftp_username = Gtk2::Entry->new(); $entry_sftp_username->set_text($username); $entry_sftp_server = Gtk2::Entry->new(); $entry_sftp_server->set_text( $server); $config_table->attach_defaults($label_sftp_username, 0, 1, 0, 1); $config_table->attach_defaults($label_sftp_server, 0, 1, 1, 2); $config_table->attach_defaults($entry_sftp_username, 1, 2, 0, 1); $config_table->attach_defaults($entry_sftp_server, 1, 2, 1, 2); $config_notebook->append_page($config_table, "Connection"); $table->attach_defaults($config_notebook, 0, 2, 0, 1); $notebook->append_page($dis_table, "GPS"); $notebook->append_page($table, "Configure"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grab Config Setting When clicking on Notebook Tab
by starX (Chaplain) on Jan 28, 2008 at 00:55 UTC | |
|
Re: Grab Config Setting When clicking on Notebook Tab
by zentara (Cardinal) on Jan 28, 2008 at 17:42 UTC |