dani_cv_74 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

How to show the top level frame from an active child frame? I have tried the commands like withdraw() and deiconify(), but no good. I could able to show the child frame from the parent frame by using frame->raise(). But this is not happening for the parent frame (from child). I have both the frames attached to the very top level, main window object.

Here is the error I am getting...

Tk::Error: Failed to AUTOLOAD 'Tk::Frame::iconify' at CQSearchExt.pl l +ine 485 Carp::croak at C:/Perl/lib/Carp.pm line 269 Tk::Widget::__ANON__ at C:/Perl/site/lib/Tk/Widget.pm line 347 main::cmdDispCancel_Click at CQSearchExt.pl line 485 main::__ANON__ at CQSearchExt.pl line 244 <Button-1> (command bound to event)

Can any one please help me out?

Thanks in advance,
Dani

Code tags added and formating cleaned up by GrandFather

Replies are listed 'Best First'.
Re: Perl - TK - Frames - $frame->raise()...
by spiritway (Vicar) on May 10, 2006 at 20:17 UTC

    Hello, [id://dani_cv_74]. It would be very helpful if you were to show the code that is giving you this error. Try to simplify the code as much as possible, down to the shortest bit that still causes the error. As you do this, you may find that the answer jumps out at you. Even if it doesn't, it will give people a chance to see what, exactly, is going wrong.

    Also, it would be very helpful if you would use the <code> and </code> tags around your code and output, which makes that text much easier to read.

Re: Perl - TK - Frames - $frame->raise()...
by jdtoronto (Prior) on May 10, 2006 at 20:38 UTC
    I would suggest that if you have both frames attached to the "very top level, main window object" then tehy are siblings, not parent and child.

    But if you want to know who the parent is, thus getting the object reference and being able to mainpulate it:

    my $parent = $widget->parent();
    and to find the ref for the associated topleve,
    my $toplevel = $widget->toplevel();
    However, without my books close by, my recollection is that frame itself is a widget and cannot be raised. It is the toplevel (or MainWindow) that contains the widgets which gets raised, withdrawn, iconified and deiconified. To hide/show a frame widget you would need to use the geometry amanger and something like the pack and unpack methods. A frame is not a toplevel, it is a convenient container widget which is used to hold other widgets.

    jdtoronto