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"); }
I also tried putting the new Canvas into the top-level and using form, but it get's really glitchy.
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,
Perldough

In reply to Canvas floating above another canvas by perldough

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.