perldough has asked for the wisdom of the Perl Monks concerning the following question:
I started work on a working GUI:
use Tk; use Tk; use Tk::PNG; use Tk::LabFrame; use Tk::Radiobutton; use Tk::Pane; use strict; our $MW = MainWindow->new(-title => " PROXY FOR MW"); $MW->geometry("+4+5"); review($MW); MainLoop; sub review { my ($MW) = @_; my ($RW, $FW, $CW) = makeReviewScreen($MW); } sub makeReviewScreen { my ($MW) = @_; our $width = $MW->screenwidth - 145; my $RW = $MW->Toplevel(-title => 'XXX'); $RW->geometry("+0+5"); my $LW = $RW->Frame; my $FW = $LW->Scrolled('Frame', -scrollbars => 'e')->pack(-expand +=> '1', -fill => 'y'); my $ZW = $LW->LabFrame(-label => " ZOOM ", -labelside => "acrossto +p", -bg => 'white'); my $CW = $RW->Scrolled('WorldCanvas', -width => $width, -height => '480', -background => 'white', -borderwidth => '3', -scrollbars => 'se', -relief => 'sunken', -scrollregion => [-100,0, 6000,40 +00]); foreach my $zoom (-4, -3, -2, 1, 2, 3) # Make the +diagram zoom buttons here { my $text = ($zoom > 0) ? 100 * $zoom : 100 / $zoom; $text = int($text); $ZW->Radiobutton( -text => "$text Percent", -bg => 'white', -value => $zoom )->pack; } $ZW->pack(-pady => 5); $LW->pack(-side => 'left', -fill => 'y', -expand => '1', -ancho +r => 'nw', ); $CW->pack(-side => 'left', -fill => 'both', -expand => '1' ); #addFloatingCanvas($RW, $FW, $CW); return( $RW, $FW, $CW); }
I want to place a much smaller, non-scrolling Canvas such that it is floating in the top-right corner of the existing WorldCanvas. In other words, I want the new canvas to always be there and visible regardless of scrolling in the existing WorldCanvas.
================== Attempts ==================The code for my failed attempts goes into a function named addFloatingCanvas($RW, $FW, $CW). The function call is commented out the code above.
I tried packing the new canvas it into the existing WorldCanvas, but it screws up all the dimensions:
sub addFloatingCanvas { my ( $RW, $FW, $CW) = @_; my $CC = $CW->Canvas(-width => '100', -height => '100', -background => 'grey', -borderwidth => '3', -relief => 'sunken' )->pack(-side => "right"); }
sub addFloatingCanvas { my ( $RW, $FW, $CW) = @_; my $CC = $RW->Canvas(-width => '100', -height => '100', -background => 'grey', -borderwidth => '3', -relief => 'sunken' )->form(-left => [$CW, -150]); }
I'd appreciate any help you could offer.
Thanks,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Canvas floating above another canvas
by Anonymous Monk on Jul 26, 2012 at 21:41 UTC | |
by Anonymous Monk on Jul 26, 2012 at 23:27 UTC | |
|
Re: Canvas floating above another canvas
by zentara (Cardinal) on Jul 27, 2012 at 13:24 UTC |