Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl::Tk::NoteBook Question

Status
Not open for further replies.

thefinn123456789

Technical User
Jul 16, 2008
2
AU
If you can create tabs on a frame, that each have a "Cancel" button or something that can delete->(this tab); How do you do this?

I've sen sequential tabs being able to be deleted merely by counting through, but I cannot think of a way of destroying the current tab that the button is actually on - there seem to be no references to the tabs anywhere.

I'm not sure if I have explained this question sufficiently, so I will give an example.

When you open most web browsers, you can open a new tab. If you wished to destroy tab 1 before tab 2, how would you go about that in perl ?

What reference to the tab name is there?

Thanks
Peter.
 
Here an example how to delete current tab.


Code:
use Tk;
use Tk::NoteBook;

$mw = MainWindow->new();
$mw->geometry( "400x100" );
$book = $mw->NoteBook()->pack( -fill=>'both', -expand=>1 );


$tab1 = $book->add( "Sheet 1", -label=>"ONE");
$tab2 = $book->add( "Sheet 2", -label=>"TWO");
$tab3 = $book->add( "Sheet 3", -label=>"THREE");

$mw->Button( -text=>'Delete', -command => \&delete)->pack( expand=>1 );

MainLoop;



sub delete {		
	  my $page =$book->info("active");
	  $book->delete($page);
	 
}

dmazzini
GSM/UMTS System and Telecomm Consultant

 
Thanks very much for your reply, I found that I had been reading the documentation at ActivePerl - which if you check the page is incomplete.

Once I got your reply I checked out CPAN which did list this.

Great help,
Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top