Several Monks kindly suggested that I use the DynaTabFrame to overcome problems I was having with the normal tabbed frame.
I have started to do this and am very pleased with the results.
I use the grid geometry manager and I found that I needed to have ->pack() at the end of each call to add which adds a tabbed frame.
Without the pack the tabbed frames were not displayed correctly.
I am more than content to do this but I wondered if this the best thing to do.
Attached is some Perl where it is simple to change whether or not pack is used.
use Tk; use Tk::DynaTabFrame; use strict; use warnings; my ($tabno, %frames, %label, %cp_wg, $raised_label); my $color = 'GREY'; my $raisecolor = 'WHITE'; my $side = 'nw'; my $mw = MainWindow->new(); my $frame_for_dynatab = $mw->Frame(-borderwidth => 4, -relief => 'rais +ed')->grid(-row => 0, -column => 0); my $dtf = $frame_for_dynatab->DynaTabFrame( -font => 'Arial 8', -raisecmd => \&raise_cb, -tabcolor => $color, -raisecolor => $raisecolor, -tabside => $side, -tabpadx => 3, -tabpady => 3, -tiptime => 600, -tipcolor => 'white' ) ->grid(-row => 0, -column => 0); $raised_label = $frame_for_dynatab->Label(-text => "")->grid(-row => 1 +, -column => 0); for($tabno = 1; $tabno <= 20; $tabno ++) { my $caption = "Caption $tabno"; # print "$caption\n"; $frames{$tabno} = $dtf->add( -caption => $caption, -tabtip => "Tip for $tabno", )->pack(); # ); $label{$tabno} = $frames{$tabno}->Label(-text => "Text in +$tabno Tabbed Frame", -width => 100)->grid(-row => 1, -column => 0); $cp_wg{$caption} = $frames{$tabno}; } sub raise_cb() { my ($current_tab, $current_tab_name, $lbr_str); $current_tab = $dtf->cget(-raised); $current_tab_name= $dtf->cget(-raised_name); $lbr_str = "current <$current_tab> name <$current_tab_name>"; $raised_label->configure (-text => $lbr_str); } MainLoop;

In reply to DynaTabFrame 'Add' syntax query by merrymonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.