Bloodelf has asked for the wisdom of the Perl Monks concerning the following question:

Greetings.
Changing the -font property of this widget, doesn't Change the font of the listbox that pops up. The best way that I can think of resolving this, is to change the module to pick up the font value of the browsentry widget, using cget I've looked at the module, but can't see where to do it.... any ideas?
Cheers.

Replies are listed 'Best First'.
Re: Tk::BrowseEntry
by strat (Canon) on Mar 25, 2002 at 13:09 UTC
    perhaps, you could access the listbox in the browseEntry ($browseEntry) with the following (untested):
    my $lb = $browseEntry->Subwidget('slistbox');
    and change the font for $lb. I think you can do something with all such composite subwidgets that are "Advertise"d in the Modules-Code

    Best regards,
    perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"

      Nice one.
Re: Tk::BrowseEntry
by {NULE} (Hermit) on Mar 25, 2002 at 14:37 UTC
    Hi Bloodelf,

    Want a brute-force way to do this? It may be ugly, but it will set the font of any grandchildren of the window to a font you specify.

    Please don't use this as is and instead refine it to minimally suit your needs. I just want to give you some ideas. Uncomment the print statements to see the widgets you are operating on.

    #! /usr/local/bin/perl -w use strict; use Tk; use Tk::BrowseEntry; # Create the main window my $w; $w->{main} = MainWindow->new; # Create the browse entry $w->{be} = $w->{main}->BrowseEntry( -label => "be" )->pack; $w->{be}->insert("end", "opt1"); $w->{be}->insert("end", "opt2"); $w->{be}->insert("end", "opt3"); # Make a font my $font = $w->{main}->fontCreate('myfont', -family => 'Helvetica', -s +ize => 20); # Assign it to the widget $w->{be}->configure(-font=> 'myfont'); # Find all the children of the browse entry. foreach ($w->{be}->children) { #print "$_\n"; # find all the grandchildren and assign them a new font. foreach ($_->children) { #print "\t$_\n"; if ($_->cget('-font')) { $_->configure(-font => 'myfont'); } } } MainLoop;
    Good luck,
    {NULE}
    --
    http://www.nule.org
      Many thanks - This code will also come in useful for loads of other stuff too.