Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Tk::NoteBook focus on other page

by jerre_111 (Sexton)
on Mar 29, 2013 at 10:13 UTC ( #1026119=perlquestion: print w/ replies, xml ) Need Help??
jerre_111 has asked for the wisdom of the Perl Monks concerning the following question:

Hello monks

Once again I humbly come upon your gates of wisdom

I had some questions concirning the notebook widget from Tk

I am making a simple progam, just 1 window, 2 pages and on page 1 I have one button.

Now i have disabled page 2 from start, but I want to enbale it and go to there if the button is clicked on page 1. So when you click the button, page 2 enables en you automaticly go there

This is the code that I am using right now :

use Tk; use Tk::NoteBook; ######### Making the main Window ########## $mw = MainWindow->new; $mw->geometry("700x600"); $mw->title("tabbed window"); # Create the notebook and fill the whole window $nb = $mw->NoteBook( )->pack(-expand => 1, -fill => 'both'); ####### Create page 1 ########## $p1 = $nb->add('page1', -label => 'Page 1'); $p1->Button(-text => 'go to page 2 ')->pack( ); ####### Create page 2 ########## $nb->add('page2', -label => 'Page 2', -state=>'disabled'); MainLoop;

Hope somebody can help me..

Thanks in advance

Comment on Tk::NoteBook focus on other page
Download Code
Re: Tk::NoteBook focus on other page
by choroba (Abbot) on Mar 29, 2013 at 10:57 UTC
    Everything you need can be found in the documentation of Tk::NoteBook. Check the following sample:
    #!/usr/bin/perl use warnings; use strict; use Tk; use Tk::NoteBook; ######### Making the main Window ########## my $mw = MainWindow->new(-title => "Tabbed Window"); $mw->geometry("700x600"); # Create the notebook and fill the whole window my $nb = $mw->NoteBook->pack(-expand => 1, -fill => 'both', ); ####### Create page 1 ########## my $p1 = $nb->add('page1', -label => 'Page 1'); $p1->Button(-text => 'Go to page 2', -command => sub { $nb->pageconfigure('page2', -state => 'nor +mal'); $nb->raise('page2'); }, )->pack; ####### Create page 2 ########## my $p2 = $nb->add('page2', -label => 'Page 2', -state=>'disabled'); MainLoop();
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      Must have overlooked it in the documentation.

      Anyway, Thanks for your reply man (or women ;-) )!

      Works like a champ.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-08-29 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls