RE: [PHP-GTK] Child Packing

From: Date: Thu, 06 Jan 2005 04:20:57 +0000
Subject: RE: [PHP-GTK] Child Packing
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5402@lists.php.net to get a copy of this message
Nghia wrote: > > I seem to be not quite getting the whole "child packing" thing... > > > > I mean, yeah, the Widgets I pack in there show up... > > > > And, sure, they are at the 'start' or 'end' depending on what I > > call... > > Would you be able to attach some sample code? <?php //Functions used by all windows: function shutdown(){ gtk::main_quit(); } function window_switch($button, $old, $new){ $new->show_all(); $old->hide_all(); } $cd_type_window = &new GtkWindow(); $cd_type_window->set_default_size(600, 600); $cd_type_window->set_position(GTK_WIN_POS_CENTER); $cd_type_window->set_title("Uncommon Ground Digital Jukebox CD Import"); $cd_type_window->connect("destroy", "shutdown"); $cd_type_main_box = &new GtkVBox(false, 0); $cd_type_window->add($cd_type_main_box); $cd_type_main_box->set_usize(100, -1); /* Skip reading these windows carefully. Same as above, mostly. */ $audio_cd_window = new GtkWindow(); $audio_cd_window->set_default_size(600, 600); $audio_cd_window->set_position(GTK_WIN_POS_CENTER); $audio_cd_window->set_title("Uncommon Ground Digital Jukebox Audio CD Import"); $audio_cd_window->connect('destroy', 'shutdown'); $audio_cd_main_box = &new GtkVbox(false, 0); $audio_cd_window->add($audio_cd_main_box); $data_cd_window = new GtkWindow(); $data_cd_window->set_default_size(600, 600); $data_cd_window->set_position(GTK_WIN_POS_CENTER); $data_cd_window->set_title("Uncommon Ground Digital Jukebox Data CD Import"); $data_cd_window->connect('destroy', 'shutdown'); $data_cd_main_box = &new GtkVbox(false, 0); $data_cd_window->add($data_cd_main_box); $enhanced_cd_window = new GtkWindow(); $enhanced_cd_window->set_default_size(600, 600); $enhanced_cd_window->set_position(GTK_WIN_POS_CENTER); $enhanced_cd_window->set_title("Uncommon Ground Digital Jukebox Enhanced CD Import"); $enhanced_cd_window->connect('destroy', 'shutdown'); $enhanced_cd_main_box = &new GtkVbox(false, 0); $enhanced_cd_window->add($enhanced_cd_main_box); $unknown_cd_window = new GtkWindow(); $unknown_cd_window->set_default_size(600, 600); $unknown_cd_window->set_position(GTK_WIN_POS_CENTER); $unknown_cd_window->set_title("Uncommon Ground Digital Jukebox Unknown CD Import"); $unknown_cd_window->connect('destroy', 'shutdown'); $unknown_cd_main_box = &new GtkVbox(false, 0); $unknown_cd_window->add($unknown_cd_main_box); $cd_type_audio_button = &new GtkButton('Audio CD'); $cd_type_main_box->pack_start($cd_type_audio_button, false, false, 10); $cd_type_audio_button->connect('clicked', 'window_switch', $cd_type_window, $audio_cd_window); $cd_type_data_button = &new GtkButton('Data CD'); $cd_type_main_box->pack_start($cd_type_data_button, false, false, 10); $cd_type_data_button->connect('clicked', 'window_switch', $cd_type_window, $data_cd_window); $cd_type_enhanced_button = &new GtkButton('Enhanced CD'); $cd_type_main_box->pack_start($cd_type_enhanced_button, false, false, 10); $cd_type_enhanced_button->connect('clicked', 'window_switch', $cd_type_window, $enhanced_cd_window); $cd_type_unknown_button = &new GtkButton('Unknown CD'); $cd_type_main_box->pack_start($cd_type_unknown_button, false, false, 10); $cd_type_unknown_button->connect('clicked', 'window_switch', $cd_type_window, $unknown_cd_window); /* These buttons are also rather boring -- same as above */ $audio_cd_back_button = &new GtkButton('Back'); $audio_cd_main_box->pack_end($audio_cd_back_button, false, false, 10); $audio_cd_back_button->connect('clicked', 'window_switch', $audio_cd_window, $cd_type_window); $data_cd_back_button = &new GtkButton('Back'); $data_cd_main_box->pack_end($data_cd_back_button, false, false, 10); $data_cd_back_button->connect('clicked', 'window_switch', $data_cd_window, $cd_type_window); $enhanced_cd_back_button = &new GtkButton('Back'); $enhanced_cd_main_box->pack_end($enhanced_cd_back_button, false, false, 10); $enhanced_cd_back_button->connect('clicked', 'window_switch', $enhanced_cd_window, $cd_type_window); $unknown_cd_back_button = &new GtkButton('Back'); $unknown_cd_main_box->pack_end($unknown_cd_back_button, false, false, 10); $unknown_cd_back_button->connect('clicked', 'window_switch', $unknown_cd_window, $cd_type_window); $splash_window->hide(); $cd_type_window->show_all(); gtk::main(); ?> Using pack_start($x, false, false, 10) does seem to shrink the buttons to normal size in one direction... They're *STILL* 600 pixels wide! I even asked their container to be 100 pixels wide with set_usize and it seems like I was ignored. So tried setting every individual button (but not the container VBox) to be 100 pixels wide. Again, that's ignored. For fun, I ignored the manual, and set *BOTH* the container and all the buttons with ->set_usize(100, -1) and it ignores me. What gives? Do I have to sacrifice a rubber chicken too? I'm only allowed ONE child in a window, but I can't express how to pack it, because windows aren't containers, they are bins, so I'm stuck with the one child being full-size of the window?... Do you always just put a Box in a Box in a Window, just so the inner box can be packed the way you want?... Would that work? I'm about to run off and try Glade, if I can get it to run, but I'm looking forward to using a GUI about as much as I look forward to getting a hangnail... :-^ Got a nice splash screen class I could clean up and post somewhere though. What's the best place? PS I'm not actually getting emails from the list. Must be on 'vacation' from years and years ago... CC me for now, if you would. -- Like Music? http://l-i-e.com/artists.htm

« previous php.gtk.general (#5402) next »