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

I am trying to use the DynTabFrame. I have created a DynaTab with the following
$dynatab_name = 'SNG'; dynatab_frame_child($tab_Tabbed, \$tabbed_frame{$dynatab_name}, $dynat +ab_caption, $dynatab_title, $dynatab_image, $dynatab_colour , $dynata +b_raised_colour);
$tab_tabbed has been created as a DynaTabFrame

This is the code for the dyantab_frame_child

sub dynatab_frame_child($$$$$$$) { my ($tab_parent, $ref_child, $dynatab_caption, $dynatab_title, $dynata +b_image, $dynatab_colour ,$dynatab_raised_colour) = @_; $$ref_child = $tab_parent->add( -caption => $dynatab_caption, -label => $dynatab_title, -tabtip => "Tip for tabno", ) ->pack() ; }
The following is a sub where I am trying to hide this tab frame using the sub hid_tab called from a button
sub hide_tab() { my ($hidden_value, $dynatab_name); $dynatab_name = 'SNG'; print "\n[hide_tab] entered\n"; $hidden_value = $tabbed_frame{$dynatab_name}->cget(-hidden); print "\n[hide_tab] for $dynatab_name - $hidden_value <$hidden_value>\ +n"; if(length($hidden_value) == 0) { print "\n[hide_tab] hiding $dynatab_name - $hidden_value <$hidden_ +value>\n"; $tabbed_frame{$dynatab_name}->configure(-hidden => 1); } }
This is the error I get in the hide_tab sub
[hide_tab] hiding SNG - <> Tk::Error: Can't set -hidden to `1' for Tk::Frame=HASH(0x20f90157e48): + unknown option "-hidden" at C:.....
What am I doing wrong?

The pod for DynaTab has:

-hidden
When set to a true value, causes the resulting tab to be hidden from view; can later be set to a false value to force the tab to be visible again.

Replies are listed 'Best First'.
Re: DynaTab Hide error
by kcott (Archbishop) on Oct 07, 2021 at 20:41 UTC

    G'day merrymonk,

    The Tk::DynaTabFrame documentation does not give -hidden as a widget option. The "... unknown option "-hidden" at ..." message that you received is quite correct.

    If you look in the METHODS section of that documentation, you'll see that the methods add(), pagecget() and pageconfigure() support a -hidden option.

    — Ken

      Many thanks for you and others pointing me in the right direction. Will try again tomorrow.
        I now have tried to use the pagecget and pageconfigure Methods. However, for both I get the error
        Tk::Error: Failed to AUTOLOAD 'Tk::Frame::pageconfigure' at ... line nn in Perl script

        I notice two things:
        1. the pod's description of add (which I use to create the dyna tabbed frame) is
        Adds a page with name pageName (if provided) to the notebook. Returns an object of type Frame.
        2. the Error mentions Tk::Frame so I guess it is looking in Tk::Frame rather than Tk::DynaTabFrame which contains the sub pageconfigure

        I guess there are two questions (an answer to either may solve the problem):
        1. Is there an alternate to add to create the DynaTab frame which creates a DynaTabFrame object - I could not see one
        2. How can I get the application to use pagecget and pageconfigure from the DynaTabFrame module

        So an answer to either or even another solution would be much appreciated.
Re: DynaTab Hide error
by Anonymous Monk on Oct 07, 2021 at 14:43 UTC
    No idea what you are talking about.

    I searched for DynTabFrame with no result.

    DynaTab has a result for Prisma, but at the end you talk about Tk

    badly formated, lazy worded ... again

    -> downvoted

      Sorry my question was not as clear as it should have been and was not 'formatted' correctly! The question is about the DynaTabFrame - (there were refereces to DynaTab elsewhere which may have been a clue). So help with the DynaTabFrame would be appreciated.
        "...So help with the DynaTabFrame would be appreciated."

        That's O.K. As asking questions is what the Monastery was made for. Here is a link for the uninitiated or Tk::DynaTabFrame - as you like. Else we will get some stuff about pet food, drugs or what ever. BTW, being a little bit more precise might be a pleasure.

        «The Crux of the Biscuit is the Apostrophe»