in reply to Tk::Error: Failed to AUTOLOAD `TK::Widget::EnterFocus'

Interestingly, there's no such a thing as Tk::Widget::EnterFocus.

The string EnterFocus is mentioned several times in the Tk source, though:

$ ack EnterFocus ~/perl5/lib/perl5/ /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/Tk.pm 703:sub EnterFocus 720: $widget->bind('all','<Enter>','EnterFocus'); /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/Tk/Menu.pm 999: # $menu->bind('<Enter>','EnterFocus'); /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Tk/EnterF +ocus.al 6:#line 693 "blib/lib/Tk.pm (autosplit into blib/lib/auto/Tk/EnterFocu +s.al)" 17:sub EnterFocus 26:# end of Tk::EnterFocus /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Tk/autosp +lit.ix 21:sub EnterFocus /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Tk/.packl +ist 483:/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Tk/En +terFocus.al /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Tk/focusF +ollowsMouse.al 10: $widget->bind('all','<Enter>','EnterFocus');

What version of Perl and Tk are you running?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Tk::Error: Failed to AUTOLOAD `TK::Widget::EnterFocus'
by Discipulus (Canon) on May 16, 2023 at 08:10 UTC
    Hello choroba,

    I have the file EnterFocus.al under perl5.26.64bit\perl\site\lib\auto\Tk and it contains:

    # NOTE: Derived from blib\lib\Tk.pm. # Changes made here will be lost when autosplit is run again. # See AutoSplit.pm. package Tk; #line 693 "blib\lib\Tk.pm (autosplit into blib\lib\auto\Tk\EnterFocus. +al)" # focusFollowsMouse # # If this procedure is invoked, Tk will enter "focus-follows-mouse" # mode, where the focus is always on whatever window contains the # mouse. If this procedure isn't invoked, then the user typically # has to click on a window to give it the focus. # # Arguments: # None. sub EnterFocus { my $w = shift; return unless $w; my $Ev = $w->XEvent; my $d = $Ev->d; $w->Tk::focus() if ($d eq 'NotifyAncestor' || $d eq 'NotifyNonlinear +' || $d eq 'NotifyInferior'); } # end of Tk::EnterFocus 1;

    I also see this comment in Tk.pm source

    PS $widget->focusFollowsMouse is described here

    PPS perhaps I misread/misunderstood your answer :)

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^2: Tk::Error: Failed to AUTOLOAD `TK::Widget::EnterFocus'
by andyok (Novice) on May 16, 2023 at 13:15 UTC
    Thank you for your reply.

    I'm using PERL 5.16.3

    And Tk version 804.03

      Your Tk version is more than 11 years old: Changes, and your Perl is 10 years old: perlhist.

      It seems like some kind of namespace problem, the program tries to autoload EnterFocus and guesses the namespace incorrectly.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]