Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Gtk3 expand problem with box

by Kanishka.black0 (Scribe)
on Dec 30, 2011 at 15:18 UTC ( [id://945648]=perlquestion: print w/replies, xml ) Need Help??

Kanishka.black0 has asked for the wisdom of the Perl Monks concerning the following question:

even though Gtk3 module is still in development . Most the code is working in Gtk3.


i have experienced some issues when the window is resized .. buttons are expanding with it .. and help me with accelerators .... please

use strict; use warnings; use Gtk3 '-init'; use Glib qw/TRUE FALSE/; #Creating Window my $window = Gtk3::Window->new('toplevel'); $window->set( title=>rand(int(100)), # default_height=>'300', # default_width=>'300', resizable=>'TRUE', focus_on_map=>'TRUE' ); #creating a Vbox my $vbox = Gtk3::Box->new('vertical',3); $vbox->set( visible=>TRUE, can_focus=>FALSE, double_buffered=>FALSE, homogeneous=>TRUE, expand=>'false' ); #creating button my $button = &button; my $menubar = &createmenubar; my $text_view = Gtk3::TextView->new(); $text_view->set(editable=>FALSE,cursor_visible=>FALSE); my $scroll = Gtk3::ScrolledWindow->new(); $scroll->add($text_view); # Vbox # |--->Menubar # |--->Button # |--->TextView #adding itesm to Vbox $vbox->pack_start($menubar,FALSE,TRUE,3); $vbox->pack_start($scroll,TRUE,TRUE,0); $vbox->pack_start($button,FALSE,FALSE,0); # Window # |--->Vbox $window->add($vbox); #adding accelerator group my $accel_group = Gtk3::AccelGroup->new(); $window->add_accel_group($accel_group); #signale to destroy the main Gtk $window->signal_connect(destroy=>\&quit); $window->show_all; Gtk3->main; sub changetitle{ print $window->get_title(),"\n"; $window->set( title=>rand(int(100)), ); } sub createmenubar{ my $menu_item_file = Gtk3::MenuItem->new_with_label('File'); my $menu_bar = Gtk3::MenuBar->new(); $menu_bar->add($menu_item_file); my $menu_file = Gtk3::Menu->new(); my $menu_item_refresh = Gtk3::ImageMenuItem->new_from_stock('gtk-r +efresh'); $menu_file->add($menu_item_refresh); $menu_item_refresh->signal_connect(activate=>\&changetitle); my $menu_item_quit = Gtk3::ImageMenuItem->new_from_stock('gtk-quit +'); $menu_item_quit->signal_connect(activate=>\&quit); # $menu_item_quit->add_accelerator('activate',$accel_group,Gtk3::Ac +celerator->parse('<Control>Q'),'visible'); $menu_file->add($menu_item_quit); $menu_item_file->set_submenu($menu_file); return $menu_bar; } sub button { my $button_sub =Gtk3::Button->new_with_label('Click to Change the +Title'); #connecting signale connnect clicked to subroutine $button_sub->signal_connect(clicked=>\&changetitle); $button_sub->set( use_action_appearance=>FALSE, visible=>TRUE, can_focus=>TRUE, receives_default=>TRUE, use_action_appearance=>FALSE ); return $button_sub; } sub quit { Gtk3->main_quit; }
Sorry Mistake ... i have got figured the thing
#creating a Vbox my $vbox = Gtk3::Box->new('vertical',3); $vbox->set( visible=>TRUE, can_focus=>FALSE, double_buffered=>FALSE, expand=>'false' );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://945648]
Approved by Eliya
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-28 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found