in reply to Keyboard traversal for Tk::Notebook

From the ActiveState documentation for Notebook.

"The NoteBook widget provides a notebook metaphor to display several windows in limited space. The notebook is divided into a stack of pages of which only one is displayed at any time. The other pages can be selected by means of choosing the visual ``tabs'' at the top of the widget. Additionally, the <Tab> key may be used to traverse the pages. If -underlineis used, Alt- bindings will also work."

Highlighting is mone.

jdtoronto

  • Comment on Re: Keyboard traversal for Tk::Notebook

Replies are listed 'Best First'.
Re: Re: Keyboard traversal for Tk::Notebook
by Anonymous Monk on Sep 12, 2003 at 15:57 UTC
    I'm using the underline option ...
    ... my $foo =$tab->add("FOO", -label => "Testing Tab", -underline => '0'); ...
    But Alt-T doesn't bring the tab into focus with multiple tabs
      No it doesn't does it!

      I realised after I wrote that note that I wasn't using the bindings on the Notebook widget, and when I tried it, like you I found it doesn't work.

      I won't be able to get back to it for a few hours, but have a look at Tk::bind in your doc tree, that might give the answer.

      The section in the Tk::Notebook doc's is taken stright from the Tcl docs unchanged - and obviously does not apply!

      jdtoronto Updated:

      Check also the docs for Tk::autobind. It seems relevant, but I haven't had time to try coding anything yet. Good luck.

      john

        I appreciate the help,

        Thanks

      I haven't used Tk in several years, so I'm pulling this out of thin air, but...might passing a true value for -underline help?
      I'm not familiar with Tk::Notebook and so the following may be way off:

      I believe you need to run 'bind' outside of the definition of your button. Using the 'underline' option literally only buys you the underlining of the '0'th position ('T') of the label. To actually make it DO something when you press <Alt-Key-T>, wouldn't you do something like the following in a statement outside of the 'my $foo' statement? ($tl is the toplevel widget where your widget lives)

      $tl->bind("<Alt-Key-T>", sub { $foo->invoke(); } );