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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling multiple widgits

Status
Not open for further replies.

jwperez

Programmer
Joined
Apr 16, 2001
Messages
1
Location
US
I am trying to scroll 8 text widgits. All 8 will not show up on the window at once, so I need to alow scrolling. I am trying put a Frame on a Canvas which is on the Main Window, then add scrolling to the Canvas. But when I do this, I can not scroll to the widgits that do not appear. Here is my code:

Code:
#!/usr/bin/perl
use Tk;

#create window, scrolled canvas and frame  
my $m = MainWindow->new;
my $c = $m -> Scrolled(
	"Canvas", 
	-scrollbars => "se" );

my $f = $c -> Frame();

#use a loop to put 8 LabEntries, Lables and Text Widgits
#in the frame
my @label_entry= (8);
my @label = (8);
my @ministry_text = (8);

for( $i = 0; $i < 8; $i++ ) {
	$label_entry[$i] = $f -> LabEntry( 
		-label => &quot;Ministry Name:&quot;,
		-labelPack => [
			-side => &quot;left&quot;, 
			-anchor => &quot;w&quot;],
		-width => 40, 
		-background => &quot;white&quot; 
		) -> pack( -side => &quot;top&quot;, 
				 -anchor => &quot;nw&quot; );

	$label[$i] = $f -> Label( 
		-text => &quot;Ministry Description:&quot; 
		) -> pack(	
			-side => &quot;top&quot;,
			-pady => &quot;2&quot;,
			-anchor => &quot;nw&quot; );

	$ministry_text[$i] = $f -> Text( 
		-width => 70, 
		-height => 10, 
		-wrap => &quot;word&quot; 
		) -> pack( 
			-side => &quot;top&quot;,
			-pady => &quot;2&quot;,
			-anchor => &quot;nw&quot; );
}

#pack and start event loop
$f -> pack();
$c -> pack();
MainLoop;
What can I do to be able to scroll to the other widgits?

Thanks,
jwperez
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top