Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Question about embedded Tk::Canvas

by kschwab (Priest)
on Nov 20, 2013 at 16:56 UTC ( #1063556=note: print w/ replies, xml ) Need Help??


in reply to Question about embedded Tk::Canvas

Are you sure $canvas is actually a "Canvas"? Can you add print ref($canvas) . "\n"; and see what it prints out?


Comment on Re: Question about embedded Tk::Canvas
Download Code
Re^2: Question about embedded Tk::Canvas
by emilbarton (Scribe) on Nov 20, 2013 at 18:52 UTC
    This is the problem actually, my $canvas turned to a Tk::Frame in the process. In the simpler script with the same lines of code, even with

     $canvas =  $Matrix->windowCget("$tracknumber,1" , '-window')

    it remains a Canvas object.

     bless $canvas, "Tk::Canvas"

    doesn't help.
      Seems odd that it would turn into a Frame. I suspect the Canvas is just packed in that frame. Try $widget->children on the Frame, and I bet there's a Canvas there.
        Well I have

        Tk::Canvas=HASH(0x3071f58) Tk::Scrollbar=HASH(0x36db080) Tk::Frame=HASH(0x36db608)


        but the canvas would rather be a child of the matrix. I check that.
        The ancestors from the main window are:

        $tracker_window = MainWindow->new.. $TrackBook = $tracker_window->NoteBook.. $TrackTabs{'Tracks'} = $TrackBook.. $Matrix = $TrackTabs{'Tracks'}->Scrolled.. $canvas = $Mainwin->Scrolled('Canvas')->grid.. my $real = $canvas->Subwidget("canvas"); # for bindings.. $CstObj->{'matrix'}->windowConfigure( "$i,1", -window => $canvas )..
        I have also a loop to destroy canvases in refresh, it might be faulty:

        for (my $n = 0; $n < $Maxobj; $n++ ){ my $canvas = $CstObj->{'matrix'}->windowDelete("$n,1"); } ## should delete embedded widgets in canvas track too (I hope).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2015-07-04 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (58 votes), past polls