in reply to Re^4: Right-click Edit/Paste in TK Browse Entry
in thread Right-click Edit/Paste in TK Browse Entry

Thanks for your reply! I'm just here to say that I figured out (sort of) what was causing the problem ...

my $mw = MainWindow->new(); my $widget = $mw->SomeWidget(\%some_options)->pack()->focus(); &add_edit_popup($mw, $widget); $mw->MainLoop;

This will fail. However ...

my $mw = MainWindow->new(); my $widget = $mw->SomeWidget(\%some_options)->pack(); &add_edit_popup($mw, $widget); $mw->MainLoop;

This will succeed. The difference is not placing the focus() call in the declaration of the widget. If you do it later in the code using ...

$widget->focus();

Then you're golden!

I'm sure there's a perfectly good explanation for this behavior. What that might be is beyond my Perl knowledge.

Anyway, BIG thanks to all for your help!

Replies are listed 'Best First'.
Re^6: Right-click Edit/Paste in TK Browse Entry
by Anonymous Monk on Jul 12, 2012 at 11:24 UTC

    I'm sure there's a perfectly good explanation for this behavior. What that might be is beyond my Perl knowledge.

    That technique is called method chaining, see chaining method calls

    pack returns the object being packed (it chains), but focus doesn't