Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Multiple rows of notebook tabs in Tk

by biochris (Beadle)
on Mar 11, 2005 at 17:15 UTC ( [id://438730]=perlquestion: print w/replies, xml ) Need Help??

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

Anyone knows how to make a second row of Notebook tabs? Thank you very much.

2005-03-12 Edited by Arunbear: Changed title from 'Notebook question', as per Monastery guidelines

Replies are listed 'Best First'.
Re: Multiple rows of notebook tabs in Tk
by ikegami (Patriarch) on Mar 11, 2005 at 18:05 UTC
      Very good! Thanks biochris
Re: Multiple rows of notebook tabs in Tk
by Ninthwave (Chaplain) on Mar 11, 2005 at 18:08 UTC

    From Mastering Perl/Tk by Steve Lidie & Nancy Walsh published by O'Reilly.

    "NoteBook Limitations - pg 580 - You can't have the tabs for a NoteBook automatically wrap around and make more than one line of tabs. Consequently, you might make so many tabs that your window will be too big to be displayed properly. In that case, you might consider having a page contain another NoteBook widget, which will essentially give you two rows of tabs."

    This would imply that you can use multiple NoteBook widgets on a page. So a quick test.

    use strict; use Tk; use Tk::NoteBook; my $MainWindow = MainWindow->new(-title => 'Testing Notebook Widgets') +; my $FirstNoteBook = $MainWindow->NoteBook()->pack(-expand => 1, -fill= +>'both'); my $SecondNoteBook = $MainWindow->NoteBook()->pack(-expand => 1, -fill + => 'both'); my $PageOne = $FirstNoteBook->add('page1', -label=> 'NB 1 Page 1'); my $PageTwo = $FirstNoteBook->add('page2', -label=> 'NB 1 Page 2'); my $PageThree = $SecondNoteBook->add('page3', -label=> 'NB 2 Page 1'); my $PageFour = $SecondNoteBook->add('page4', -label=> 'NB 2 Page 2'); MainLoop;

    This fired up fine with four tabs and blank pages. Now there may be some considerations depending on how you want the output of each page displayed.


    "No matter where you go, there you are." BB
      Thanks for the snipet. biochris

        It was there to show that you can have multipe notebook widgets on one main window, you would need to keep track of what you would call front row and back row and dynamically update the title of the pages to have this work like a multi row notebook page. Not too terribly hard but not efficient. I agree with most said about trying to visualise the data differently if you find space issues with this particular widget.

        "No matter where you go, there you are." BB
Re: Multiple rows of notebook tabs in Tk
by zentara (Archbishop) on Mar 11, 2005 at 17:21 UTC
Re: Multiple rows of notebook tabs in Tk
by kvale (Monsignor) on Mar 11, 2005 at 17:32 UTC
    I don't know of any modules that do multiple rows of tabs in Tk. Since a NoteBook page is just a frame, there is no reason that you could not put another NoteBook inside that frame. It would not look quite right, as notebook tabs on both rows would be enabled, but if the tabs could be arrangd hierarchically, then it would be fine. The first row of tabs would be broad categories and the second row would be specializations of those broad categories.

    From a UI point of view, too many tabs, like you see in some Windows dialogs, make my eyes cross :) At some point, I think it would be better to go with with ListBox of categories, where clicking on a category brings up the associated dialog.

    You might also consider Tk::DynaTabFrame as an alternative. The widget takes care of too many tabs by stacking them and having left/right arrows to scroll through them, similar to the worksheet tab interface in Excel.

    -Mark

      Great help. Thanks very much biochris
Re: Multiple rows of notebook tabs in Tk
by Courage (Parson) on Mar 11, 2005 at 18:44 UTC
      Looks very interesting. Thanks biochris
Re: Multiple rows of notebook tabs in Tk
by kimanaw (Beadle) on Mar 14, 2005 at 02:04 UTC
    FWIW: heres a link to the Tk::DynaTabFrame aka Tk::DTF homepage w/ plenty o' screenshots for your viewing pleasure.

    Also FWIW: Tk::DTF has a few other recently added niceties you might find useful:

    • tiny close buttons in the tab (optional)
    • orientable tabs - i.e., you pick the side, and edge to align on
    • a flash operation.

    Have fun!

      I am not an expert in perl but I will try it! Thanks anyway. biochris

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://438730]
Approved by kvale
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-18 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found