Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: How to destroy and re-create bound widgets

by zentara (Archbishop)
on Nov 05, 2012 at 10:17 UTC ( #1002296=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How to destroy and re-create bound widgets
in thread How to destroy and re-create bound widgets

It sounds like you, as a beginner, my want to reconsider your design. The first thing I have to say, is why do you need the overlapping secondary sub-canvases? If you can make something on your sub-canvas, you can do the same thing on the underlying canvas. You can still put a background image on the main canvas, then instead of overlaying other canvases, why not create rectangular regions on the base canvas? In any event, look at this example:

#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow; my $main = $mw -> Scrolled("Canvas",-scrollbars=>'e')-> pack(-side =>'left', -fill => 'both', -expand => 1); my $canvas = $main->Subwidget("canvas"); Tk::bind($canvas, '<MouseWheel>', [ sub {$canvas->yview('scroll', -($_[1] / 120) * 3,'units')}, Ev('D')]); my $see = "\nHaaa, See that and scroll!"; my $info = $main->createText(180, 15, -text => "$see", -font => 'Arial 11 bold' , -fill => 'red'); $main->configure(-scrollregion => [0,0,2000 , 2000]); my $canvas_cube = $main->Canvas(-width => 45, -height => 45, -background => 'green'); my $canvasWindow = $main->createWindow(75,75, -window => $canvas_cube) +; Tk::bind( $canvas_cube, '<Enter>' => sub { print "Enter\n"; }); Tk::bind( $canvas_cube, '<Leave>' => sub { print "Leave\n"; }); Tk::bind( $canvas_cube, '<Button-1>' => sub { print "1\n"; }); $canvas->focus; MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re^3: How to destroy and re-create bound widgets
Download Code
Re^4: How to destroy and re-create bound widgets
by zentara (Archbishop) on Nov 05, 2012 at 11:32 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002296]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-12-26 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (163 votes), past polls