This is the Frequently Asked Question list for Glade-Perl source generator
--------------------------------------------------------------------------
Q   Why do I get message 'Can't locate object method "allow_grow" via package 
    "Gtk::Window" at Project3.pm line 115 (or similar)

A   This is caused by changes made to the CVS version of Gtk-Perl. Version
    0.45 will deal with this and other changes that have been made although
    there may be problems with earlier versions of Gtk-Perl :(
    The solution is to download and install Glade-Perl-0.45 (if you haven't
    already done so :)
        
--------------------------------------------------------------------------
Q   How do I set fonts, colours and bg-pixmaps of widgets at run time?

A   To change the fonts, colours and bg-pixmaps of widgets at run-time you can
    use something like the code below. This is for a button so it sets the style 
    of the button->child (in other words the label in the button) and the actual 
    way that you set the style will depend on what type of widget you are working
    with. There are many ways to get the colours but this is one approach:

    my $style = new Gtk::Style;
    my $cm = $form->{'button43'}->get_toplevel->window->get_colormap;

    $style->font(  Gtk::Gdk::Font->load(
        '-*-times-bold-r-normal-*-*-120-*-*-p-*-iso8859-1'));
    $style->fg('normal',   $cm->color_alloc(
        {red=>65000, green=>0,     blue=>0}));
    $style->fg('prelight', $cm->color_alloc(
        {red=>0,     green=>30000, blue=>0}));
    $style->fg('active',   $cm->color_alloc(
        {red=>0,     green=>0,     blue=>65000 }));

    $form->{'button43'}->child->set_style($style);

--------------------------------------------------------------------------
Q   Glade-Perl doesn't build your stock button correctly
    If you run Glade-Perl with 'verbose' => 2 and STDOUT visible (on an xterm) 
    you will see a message like:
    warn  Gtk-Perl version 0.6123 cannot do 'GnomeStock' (properly) 
        we need CVS module 'gnome-perl' after 19990914

A   Gtk-Perl 0.6123 doesn't do Gnome::Stock->button. Either remove the
    Stock Button property and use a label or upgrade to Gtk-Perl CVS after
    19990914.
    
--------------------------------------------------------------------------
Q   How do I see diagnostic messages when using glade2perl or from Glade?

A   Copy glade2perl and edit the 'verbose' line to read
        'verbose' => 2,     # for some diagnostics
        'verbose' => 4,     # for more diagnostics
        'verbose' => 6,     # for lots of diagnostics (more than you want ?)
        'verbose' => 10,    # for every diagnostic message available
    Then either run Glade from a terminal or call the edited glade2perl
    directly and redirect STDOUT to a file if you want to save the diagnostics.
    
--------------------------------------------------------------------------
Q   How do I write signal handlers in a separate module?

A   As always with Perl, there is more than one way to do it.
    1) The first way is to put your signal handlers in a .pm module and use() 
    the module from the generated source code. An example of this is the file
    '$DIST_DIR/Example/BusForm_mySUBS.pm. You then specify this module to 
    Glade-Perl with the user option 'use_module' which you can check in the
    distributed script $DIST_DIR/test.pl. This is not the best approach as you
    have to make sure that you Export the signal_handler names if they are to
    run when you cause the signal.

    2) The better and simpler way is to subclass the generated UI module and put 
    the signal handlers there. An example of this is $DIST_DIR/Example/SubBus.pm.
    Version 0.41 of Glade-Perl generates a subclass with a skeleton signal 
    handler for each signal handler that is needed. This is an OO approach.
    You can then copy this subclass somewhere and edit the signal handlers to do
    whatever you want. The advantage of this approach is that you can generate 
    the UI again and again without changing the subclass except for adding or
    removing new signal handlers.

--------------------------------------------------------------------------
Q   How do I access widgets to set or get their data/text?

A   Each instance of a form (you can have more than one copy of a UI showing at
    the same time) stores a complete hash of its widgets in a global anonymous
    hash (actually defined as $Glade::PerlRun::all_forms) that you can access
    from your signal handler. One way to get at an entry widget in a signal
    handler is to look up the widget in this hash.

    The AUTOLOAD()ed signal handler message box shows all the args that would be
    passed to the relevant signal handler but something like this should work:

      sub my_signal_handler {
        my ($class, $data, $object, $instance) = @ARG;
        my $form = $__PACKAGE__::all_forms->{$instance};
        my $entry_val = $form->{'entry_widget_name'}->get_text;
        ...
     }

    This is for the case where the entry widget is on the same form as the 
    widget that causes the signal. In other cases you will have to store the 
    $instance value in a global or pass it as an arg somehow.

--------------------------------------------------------------------------
Q   My GtkClock does not show the current time

A   Older versions of gnome-libs (at least <= 1.0.8) do not handle the clock 
    type 'realtime' properly. Gtk-Perl 0.6123 cannot explicitly set the type 
    so we are stuck. Upgrade to a newer version of gnome-libs.

        
--------------------------------------------------------------------------
Q   When I upgraded to Glade-Perl version 0.3.5 (or greater) I get error ...
    'Can't locate Gtk/Keysyms.pm in @INC (@INC contains: .....'
    
A   You have a flawed version of Gtk-Perl - eg released version 0.5121. There
    are many improvements in later versions (or in gnome.org CVS repository),
    for example, Glade-Perl now uses the new keysyms bindings in Gtk::Keysysms.
    Version 0.6123 is now available on CPAN (20 Aug 1999), otherwise you can
    get the CVS version ie. the 'gnome-perl' module in the CVS repository at 
    gnome.org and use that. There is a good description of the Gnome CVS on a
    Gnome mirror at http://www.uk.gnome.org/devel/whatiscvs.shtml
    
    If neither action is possible or desirable you can edit Glade::PerlUI.pm 
    in two places.
    
    change two lines in the Glade/PerlUI.pm module and 'make install' again

    #   use Gtk::Keysyms;               # comment out line 23 (or near)
    #   $self = $Gtk::Keysyms{$self};   # replace line 1590 (or near) 
                                        # by the line below
        $self = ord ($self );

    Of course, any keyboard accelerators that use keysyms other than A-Z,a-z
    will cause unusual behaviour but it should get you going.
    
--------------------------------------------------------------------------
Q   When I run glade2perl I get the following message ...
    Can't call method "merge_options" on an undefined value at
    /home/Perl/5.005_02/lib/site_perl/Glade/PerlProject.pm line 210.
    
A   Two people have reported this error, they use perl version 5.005_x with 
    some parts of perl installed in their home directory. I can't believe 
    that the problems come from perl but I don't know what else it could be,
    The error shown means that Glade::PerlGenerate->options has been called 
    without any arguments, not even a class name. 

    Eric Richardson <eric@gospelcom.net> found the problem! Thanks.
    It was caused by the use of @ARG to get at sub args. I still don't know 
    why this doesn't work with 5.005 but I have changed them all to the short 
    form of @_ in version 0.45 so this problem should not reappear.

--------------------------------------------------------------------------
