in reply to DynaTab Hide error

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

Replies are listed 'Best First'.
Re^2: DynaTab Hide error
by merrymonk (Hermit) on Oct 07, 2021 at 21:17 UTC
    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.

        You've been here for 17 years and made almost 450 posts. Why is it so difficult for you to understand that an error message without the source code is completely meaningless? How are we supposed to know what's at line "nn"? How are we supposed to know what "Perl script" refers to?

        Here's the guts of what you probably need:

        #!/usr/bin/env perl use strict; use warnings; use Tk; use Tk::DynaTabFrame; my $mw = MainWindow::->new(); my $dtf = $mw->DynaTabFrame()->pack(qw{-fill both -expand 1}); my $dtf_static = $dtf->add(Static => qw{-label Static}); my $dtf_transient = $dtf->add(Transient => qw{-label Transient}); $mw->Button(-text => 'Show', -command => sub { $dtf->pageconfigure(Transient => qw{-hidden 0}) })->pack; $mw->Button(-text => 'Hide', -command => sub { $dtf->pageconfigure(Transient => qw{-hidden 1}) })->pack; MainLoop;

        Although barebones, this works as is. This is the type of code that your SSCCE should contain. All of your error or warnings messages should be provided verbatim within <code>...</code> tags. Read, and fully understand, "How do I post a question effectively?" before posting again.

        — Ken

        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

        Without your SSCCE I can only suggest that you look long and hard at line nn and the preceding statements.

        How can I get the application to use pagecget and pageconfigure from the DynaTabFrame module

        Perhaps the same way as the demo?


        🦛